LoPy4 change uplink channels by itself?



  • @robert-hh I know this is a silly question, but how to implement this? Do I just download the file and modify this function first, and then how can I upload this file(or library) to my LoPy4? Is it like I upload the whole lora library to lopy4 using Atom, and then change the beginning of my code from "from network import lora" to "import lora" ? Thank you for your time! Appreciate it!
    Ok, so I can just flash this to my lopy4 using Pycom firmware update tool right?



  • @sheng In case that you do not have the build package running, I have prepared a tar-ball for offline-install named LoPy4-CN470-1.20.2.rc11.tar.gz here: https://github.com/robert-hh/Shared-Stuff.git
    It is the Basic compile package without PyBytes



  • @sheng In case that you have the code set-up to compile yourself, I have a modified version of the function .RegionCN470ChannelsRemove in file ../lib/lora/mac/region/RegionCN470.c, which you could try.

    bool RegionCN470ChannelsRemove( ChannelRemoveParams_t* channelRemove  )
    {
        uint8_t id = channelRemove->ChannelId;
    
        if( id >= CN470_MAX_NB_CHANNELS )
        {
            return LORAMAC_STATUS_PARAMETER_INVALID;
        }
    
        // Remove the channel from the list of channels
        Channels[id] = ( ChannelParams_t ){ 0, 0, { 0 }, 0 };
    
        return RegionCommonChanDisable( ChannelsMask, id, CN470_MAX_NB_CHANNELS );
    }
    


  • @sheng Looking at the code, lora.add_channel() calls in the end RegionCN470ChannelManualAdd(), and at a first glance overwrites the channel data table entry, such that remove seems not really required, if the same channel is overwritten. But in your case the TTN server may have programmed other channel entries, which then will not be deleted and used for further transmission.



  • @robert-hh Thank you so much for your reply, I checked the code for CN470, and tried the channel_manual_add and remove, but it didn't work.



  • @sheng Looking further into the code, there seems to be a kind of implementation shortcut, the in some case, if the function is not implemented by the target region, the code for EU433 applies. That is done for CHANNEL_MANUAL_ADD, CHANNEL_MANUAL_REMOVE and FORCE_JOIN_DATARATE.
    And that is strange, since in the respective functions it seems not to be supported in the code at all (Region.c, line 1026ff and line 1065ff). I wonder if the returned error code is taken care of.

    So that all looks messy!



  • @sheng Looking into the code like I did back in 2018 I see, that for the CN470 region the functions RegionCN470ChannelAdd() and RegionCN470ChannelsRemove() are empty. They do not perform anything, in contrast e.g. to the code for the region EU868. That may explain you behavior of not being able to control the channel table. A full power cycle should bring you to the initial state. That is something I observe with my LoPy4, in that they sometimes refuse to work es expected until I do a power cycle.

    Edit: If you want to dive in it: the code is in ...../pycom-micropython-sigfox/lib/lora/mac/region. There are .c and .h file for each region, and the file region.c, which contains the function tables for all regions.

    P.S.: There is no consistent implementation for the region codes about which function is supported an which not. The best supported code seems to be EU868 code, that's where Semtech is located. For all other regions the code seems to be only partially implemented by Semtech and Pycom. Since the actual sources have a (C) 2013 notice, upgrading to a newer version of these drivers may be an option for improvement.



  • @sheng I found that someone had the same problem back in 2018, I am not sure if the problem is solved, does the add_channels work for CN470 frequency band?



  • @jcaron Thank you for your reply, I am using ChirpStack as the network server. In the ChirpStack Network Server's configuration file, I only enabled these eight channels(as shown below).
    5ca12936-2c37-4bf0-a7c7-4ebdee8664be-image.png
    However, in ChipStack Gateway Bridge, there is no such an option to enable sub-channels. So I am using the max and min frequency to limit the channels I am using. I tried to leave it as default (the default minimum frequency is 470MHz, and the maximum frequency is 510MHz), it doesn't work. I changed it to my current settings(as shown below), still doesn't work.
    09e41f0f-6e09-4247-8270-209fda9012e4-image.png



  • @sheng the network can send channels it wants the node to send uplinks on. What gateway/network are you connected to?



  • This post is deleted!

Log in to reply
 

Pycom on Twitter