beegee-tokyo / SX126x-Arduino

Arduino library to use Semtech SX126x LoRa chips and modules to communicate
MIT License
235 stars 64 forks source link

Downlink (NewChannelReq) on Each Uplink #105

Closed abish7643 closed 1 year ago

abish7643 commented 1 year ago

I'm currently using ABP on SX1262 + ESP32 (Class A) Device along with a Gateway from RAK (Wisgate Edge Lite 2) .

The device only sends unconfirmed messages. The Gateway always sends a downlink (NewChannelReq) on each uplink. I'm not sure why this is the case, logically the Network Server may initiate Downlink if NewChannelAns is not received I guess.

Does the Library publish NewChannelAns if Channel List is Received? I can see the following snippet within ProcessMacCommands function. When will NewChannelAns be published?

AddMacCommand(MOTE_MAC_NEW_CHANNEL_ANS, status, 0);
abish7643 commented 1 year ago

@beegee-tokyo

I have tried to look further, it's obviously related to the usage of lmh_setSingleChannelGateway.

Once a single channel is configured, the node is not able to receive downlink properly (Mostly Timeout).

This means the NewChannelReq packet is not received by the end device, so NewChannelAns will not be sent. This forces the Network Server to continuously send NewChannelReq on every uplink.

If SingleChannelGetway is not configured, everything works as expected. Does the firmware forces the end node to listen to the frequency configured with lmh_setSingleChannelGateway?

abish7643 commented 1 year ago

I solved it by patching the library (ScheduleTx() Function) -> configured reception channel if singleChannelGateway is used. @beegee-tokyo If this is unintentional, I can make pull request.

if (singleChannelGateway){
  Channel = singleChannelSelected;
  LOG_LIB("LM", "Selected Channel %d", Channel);
}