I used the following code to enable only channels 8-15 and 65 and had better, but not perfect results. During the JOIN process, the node continued to try frequencies that had been disabled by the code and not in the TTN US Frequency Plan (See the Serial Monitor Logs). When the node eventually tried to JOIN with a frequency in the TTN US Frequency Plan, it was successful right away. From that point on, all Uplinks sucessfully used only the frequencies in the TTN US Frequency Plan that I had specified in the code. The Uplink packets started to populate the Gateway Traffic and Application Data logs immediately, and there were no missed frames. In the Gateway Traffic log, you can see the Uplink packets start immediatley after the JOIN.
I need to try this a few more times and see if it consistently works this way. Are there other changes I should make to the code?
Click to see Serial Monitor logs with frequencies used
> Starting
> 15492: engineUpdate, opmode=0x8
> Packet queued
> 18547: engineUpdate, opmode=0xc
> 20899: TXMODE, freq=902300000, len=23, SF=7, BW=125, CR=4/5, IH=0
> Packet queued
> 331346: RXMODE_SINGLE, freq=923300000, SF=7, BW=500, CR=4/5, IH=0
> 393007: RXMODE_SINGLE, freq=923300000, SF=10, BW=125, CR=4/5, IH=0
> 402644: engineUpdate, opmode=0xc
> 444577: engineUpdate, opmode=0xc
> 444877: TXMODE, freq=903000000, len=23, SF=8, BW=500, CR=4/5, IH=0
> 755341: RXMODE_SINGLE, freq=923300000, SF=7, BW=500, CR=4/5, IH=0
> 817001: RXMODE_SINGLE, freq=923300000, SF=10, BW=125, CR=4/5, IH=0
> 826639: engineUpdate, opmode=0xc
> 1000727: engineUpdate, opmode=0xc
> 1001029: TXMODE, freq=914100000, len=23, SF=8, BW=125, CR=4/5, IH=0
> 1315366: RXMODE_SINGLE, freq=925100000, SF=8, BW=500, CR=4/5, IH=0
> 1378122: RXMODE_SINGLE, freq=923300000, SF=10, BW=125, CR=4/5, IH=0
> 1387695: engineUpdate, opmode=0xc
> 1388380: engineUpdate, opmode=0xc
> 1388683: TXMODE, freq=907800000, len=23, SF=8, BW=500, CR=4/5, IH=0
> 1699197: RXMODE_SINGLE, freq=925100000, SF=7, BW=500, CR=4/5, IH=0
> 1760856: RXMODE_SINGLE, freq=923300000, SF=10, BW=125, CR=4/5, IH=0
> 1770429: engineUpdate, opmode=0xc
> 2261287: engineUpdate, opmode=0xc
> 2261589: TXMODE, freq=907100000, len=23, SF=9, BW=125, CR=4/5, IH=0
> 2581783: RXMODE_SINGLE, freq=923300000, SF=9, BW=500, CR=4/5, IH=0
> 2644475: RXMODE_SINGLE, freq=923300000, SF=10, BW=125, CR=4/5, IH=0
> 2653984: engineUpdate, opmode=0xc
> 2661842: engineUpdate, opmode=0xc
> 2662144: TXMODE, freq=903000000, len=23, SF=8, BW=500, CR=4/5, IH=0
> 2972610: RXMODE_SINGLE, freq=923300000, SF=7, BW=500, CR=4/5, IH=0
> 3034270: RXMODE_SINGLE, freq=923300000, SF=10, BW=125, CR=4/5, IH=0
> 3043918: engineUpdate, opmode=0xc
> 3876355: engineUpdate, opmode=0xc
> 3876657: TXMODE, freq=902300000, len=23, SF=10, BW=125, CR=4/5, IH=0
> 4207284: RXMODE_SINGLE, freq=923300000, SF=10, BW=500, CR=4/5, IH=0
> 4269849: RXMODE_SINGLE, freq=923300000, SF=10, BW=125, CR=4/5, IH=0
> 4279422: engineUpdate, opmode=0xc
> 4321010: engineUpdate, opmode=0xc
> 4321311: TXMODE, freq=903000000, len=23, SF=8, BW=500, CR=4/5, IH=0
> 4631777: RXMODE_SINGLE, freq=923300000, SF=7, BW=500, CR=4/5, IH=0
> 4693437: RXMODE_SINGLE, freq=923300000, SF=10, BW=125, CR=4/5, IH=0
> 4702946: EV_JOIN_FAILED
> 4702975: engineUpdate, opmode=0xc
> 4725137: engineUpdate, opmode=0xc
> 4725438: TXMODE, freq=911300000, len=23, SF=10, BW=125, CR=4/5, IH=0
> 5056002: RXMODE_SINGLE, freq=926300000, SF=10, BW=500, CR=4/5, IH=0
> 5118566: RXMODE_SINGLE, freq=923300000, SF=10, BW=125, CR=4/5, IH=0
> 5128139: engineUpdate, opmode=0xc
> 5150168: engineUpdate, opmode=0xc
> 5150470: TXMODE, freq=911000000, len=23, SF=8, BW=500, CR=4/5, IH=0
> 5460937: RXMODE_SINGLE, freq=926300000, SF=7, BW=500, CR=4/5, IH=0
> 5522596: RXMODE_SINGLE, freq=923300000, SF=10, BW=125, CR=4/5, IH=0
> 5532170: EV_JOIN_FAILED
> 5532199: engineUpdate, opmode=0xc
> 5676291: engineUpdate, opmode=0xc
> 5676592: TXMODE, freq=911900000, len=23, SF=10, BW=125, CR=4/5, IH=0
> 6007220: RXMODE_SINGLE, freq=923300000, SF=10, BW=500, CR=4/5, IH=0
> 6015601: EV_JOINED
> 6015629: engineUpdate, opmode=0x808
> 6016094: TXMODE, freq=903900000, len=26, SF=10, BW=125, CR=4/5, IH=0
> 6100433: RXMODE_SINGLE, freq=923300000, SF=10, BW=500, CR=4/5, IH=0
> 6163061: RXMODE_SINGLE, freq=923300000, SF=12, BW=500, CR=4/5, IH=0
> 6167434: EV_TXCOMPLETE (includes waiting for RX windows)
> 6167478: engineUpdate, opmode=0x900
> 7417478: engineUpdate, opmode=0x908
> 7417937: TXMODE, freq=904100000, len=26, SF=10, BW=125, CR=4/5, IH=0
> 1699197: RXMODE_SINGLE, freq=925100000, SF=7, BW=500, CR=4/5, IH=0
> 1760856: RXMODE_SINGLE, freq=923300000, SF=10, BW=125, CR=4/5, IH=0
> 1770429: engineUpdate, opmode=0xc
> 2261287: engineUpdate, opmode=0xc
> 2261589: TXMODE, freq=907100000, len=23, SF=9, BW=125, CR=4/5, IH=0
> 2581783: RXMODE_SINGLE, freq=923300000, SF=9, BW=500, CR=4/5, IH=0
> 2644475: RXMODE_SINGLE, freq=923300000, SF=10, BW=125, CR=4/5, IH=0
> 2653984: engineUpdate, opmode=0xc
> 2661842: engineUpdate, opmode=0xc
> 2662144: TXMODE, freq=903000000, len=23, SF=8, BW=500, CR=4/5, IH=0
> 2972610: RXMODE_SINGLE, freq=923300000, SF=7, BW=500, CR=4/5, IH=0
> 3034270: RXMODE_SINGLE, freq=923300000, SF=10, BW=125, CR=4/5, IH=0
> 3043918: engineUpdate, opmode=0xc
> 3876355: engineUpdate, opmode=0xc
> 3876657: TXMODE, freq=902300000, len=23, SF=10, BW=125, CR=4/5, IH=0
> 4207284: RXMODE_SINGLE, freq=923300000, SF=10, BW=500, CR=4/5, IH=0
> 4269849: RXMODE_SINGLE, freq=923300000, SF=10, BW=125, CR=4/5, IH=0
> 4279422: engineUpdate, opmode=0xc
> 4321010: engineUpdate, opmode=0xc
> 4321311: TXMODE, freq=903000000, len=23, SF=8, BW=500, CR=4/5, IH=0
> 4631777: RXMODE_SINGLE, freq=923300000, SF=7, BW=500, CR=4/5, IH=0
> 4693437: RXMODE_SINGLE, freq=923300000, SF=10, BW=125, CR=4/5, IH=0
> 4702946: EV_JOIN_FAILED
> 4702975: engineUpdate, opmode=0xc
> 4725137: engineUpdate, opmode=0xc
> 4725438: TXMODE, freq=911300000, len=23, SF=10, BW=125, CR=4/5, IH=0
> 5056002: RXMODE_SINGLE, freq=926300000, SF=10, BW=500, CR=4/5, IH=0
> 5118566: RXMODE_SINGLE, freq=923300000, SF=10, BW=125, CR=4/5, IH=0
> 5128139: engineUpdate, opmode=0xc
> 5150168: engineUpdate, opmode=0xc
> 5150470: TXMODE, freq=911000000, len=23, SF=8, BW=500, CR=4/5, IH=0
> 5460937: RXMODE_SINGLE, freq=926300000, SF=7, BW=500, CR=4/5, IH=0
> 5522596: RXMODE_SINGLE, freq=923300000, SF=10, BW=125, CR=4/5, IH=0
> 5532170: EV_JOIN_FAILED
> 5532199: engineUpdate, opmode=0xc
> 5676291: engineUpdate, opmode=0xc
> 5676592: TXMODE, freq=911900000, len=23, SF=10, BW=125, CR=4/5, IH=0
> 6007220: RXMODE_SINGLE, freq=923300000, SF=10, BW=500, CR=4/5, IH=0
> 6015601: EV_JOINED
> 6015629: engineUpdate, opmode=0x808
> 6016094: TXMODE, freq=903900000, len=26, SF=10, BW=125, CR=4/5, IH=0
> 6100433: RXMODE_SINGLE, freq=923300000, SF=10, BW=500, CR=4/5, IH=0
> 6163061: RXMODE_SINGLE, freq=923300000, SF=12, BW=500, CR=4/5, IH=0
> 6167434: EV_TXCOMPLETE (includes waiting for RX windows)
> 6167478: engineUpdate, opmode=0x900
> 7417478: engineUpdate, opmode=0x908
> 7417937: TXMODE, freq=904100000, len=26, SF=10, BW=125, CR=4/5, IH=0
> Packet queued
> 7503620: RXMODE_SINGLE, freq=923900000, SF=10, BW=500, CR=4/5, IH=0
> 7566249: RXMODE_SINGLE, freq=923300000, SF=12, BW=500, CR=4/5, IH=0
> 7570685: EV_TXCOMPLETE (includes waiting for RX windows)
> 7570730: engineUpdate, opmode=0x900
> 8820729: engineUpdate, opmode=0x908
> 8821188: TXMODE, freq=904300000, len=26, SF=10, BW=125, CR=4/5, IH=0
> Packet queued
> 8906872: RXMODE_SINGLE, freq=924500000, SF=10, BW=500, CR=4/5, IH=0
> 8969501: RXMODE_SINGLE, freq=923300000, SF=12, BW=500, CR=4/5, IH=0
> 8974012: EV_TXCOMPLETE (includes waiting for RX windows)
> 8974057: engineUpdate, opmode=0x900
> 10224057: engineUpdate, opmode=0x908
> 10224517: TXMODE, freq=904500000, len=26, SF=10, BW=125, CR=4/5, IH=0
> Packet queued
> 10310073: RXMODE_SINGLE, freq=925100000, SF=10, BW=500, CR=4/5, IH=0
> 10372701: RXMODE_SINGLE, freq=923300000, SF=12, BW=500, CR=4/5, IH=0
> 10377074: EV_TXCOMPLETE (includes waiting for RX windows)
> 10377122: engineUpdate, opmode=0x900
> 11627121: engineUpdate, opmode=0x908
> 11627581: TXMODE, freq=904700000, len=26, SF=10, BW=125, CR=4/5, IH=0
> Packet queued
> 11713139: RXMODE_SINGLE, freq=925700000, SF=10, BW=500, CR=4/5, IH=0
> 11775766: RXMODE_SINGLE, freq=923300000, SF=12, BW=500, CR=4/5, IH=0
> 11780138: EV_TXCOMPLETE (includes waiting for RX windows)
> 11780186: engineUpdate, opmode=0x900
> 13030187: engineUpdate, opmode=0x908
> 13030647: TXMODE, freq=904900000, len=26, SF=10, BW=125, CR=4/5, IH=0
> Packet queued
> 13116204: RXMODE_SINGLE, freq=926300000, SF=10, BW=500, CR=4/5, IH=0
> 13178831: RXMODE_SINGLE, freq=923300000, SF=12, BW=500, CR=4/5, IH=0
> 13183203: EV_TXCOMPLETE (includes waiting for RX windows)
> 13183251: engineUpdate, opmode=0x900
> 14433252: engineUpdate, opmode=0x908
> 14433712: TXMODE, freq=905100000, len=26, SF=10, BW=125, CR=4/5, IH=0
> Packet queued
> 14519269: RXMODE_SINGLE, freq=926900000, SF=10, BW=500, CR=4/5, IH=0
> 14581896: RXMODE_SINGLE, freq=923300000, SF=12, BW=500, CR=4/5, IH=0
> 14586268: EV_TXCOMPLETE (includes waiting for RX windows)
> 14586316: engineUpdate, opmode=0x900
> 15836317: engineUpdate, opmode=0x908
> 15836777: TXMODE, freq=905300000, len=26, SF=10, BW=125, CR=4/5, IH=0
> Packet queued
> 15922333: RXMODE_SINGLE, freq=927500000, SF=10, BW=500, CR=4/5, IH=0
> 15984961: RXMODE_SINGLE, freq=923300000, SF=12, BW=500, CR=4/5, IH=0
> 15989333: EV_TXCOMPLETE (includes waiting for RX windows)
> 15989381: engineUpdate, opmode=0x900
> 17239381: engineUpdate, opmode=0x908
> 17239856: TXMODE, freq=903900000, len=26, SF=10, BW=125, CR=4/5, IH=0
> Packet queued
> 17325412: RXMODE_SINGLE, freq=923300000, SF=10, BW=500, CR=4/5, IH=0
> 17388041: RXMODE_SINGLE, freq=923300000, SF=12, BW=500, CR=4/5, IH=0
> 17392413: EV_TXCOMPLETE (includes waiting for RX windows)
> 17392461: engineUpdate, opmode=0x900
> 18642462: engineUpdate, opmode=0x908
> 18642922: TXMODE, freq=904100000, len=26, SF=10, BW=125, CR=4/5, IH=0
> Packet queued
Here is another test using the same code that has the odd behavior of mulitple successful JOINs before the Uplink packets.
Click to see Serial Monitor logs with frequencies used
> Starting
> 230: engineUpdate, opmode=0x8
> Packet queued
> 2311: engineUpdate, opmode=0xc
> 4599: TXMODE, freq=902300000, len=23, SF=7, BW=125, CR=4/5, IH=0
> Packet queued
> 315109: RXMODE_SINGLE, freq=923300000, SF=7, BW=500, CR=4/5, IH=0
> 376769: RXMODE_SINGLE, freq=923300000, SF=10, BW=125, CR=4/5, IH=0
> 386407: engineUpdate, opmode=0xc
> 422264: engineUpdate, opmode=0xc
> 422565: TXMODE, freq=903000000, len=23, SF=8, BW=500, CR=4/5, IH=0
> 733028: RXMODE_SINGLE, freq=923300000, SF=7, BW=500, CR=4/5, IH=0
> 794688: RXMODE_SINGLE, freq=923300000, SF=10, BW=125, CR=4/5, IH=0
> 804326: engineUpdate, opmode=0xc
> 855060: engineUpdate, opmode=0xc
> 855361: TXMODE, freq=914300000, len=23, SF=8, BW=125, CR=4/5, IH=0
> 1169826: RXMODE_SINGLE, freq=925700000, SF=8, BW=500, CR=4/5, IH=0
> 1232582: RXMODE_SINGLE, freq=923300000, SF=10, BW=125, CR=4/5, IH=0
> 1242155: engineUpdate, opmode=0xc
> 1303846: engineUpdate, opmode=0xc
> 1304147: TXMODE, freq=909400000, len=23, SF=8, BW=500, CR=4/5, IH=0
> 1614613: RXMODE_SINGLE, freq=925700000, SF=7, BW=500, CR=4/5, IH=0
> 1676274: RXMODE_SINGLE, freq=923300000, SF=10, BW=125, CR=4/5, IH=0
> 1685847: engineUpdate, opmode=0xc
> 2080700: engineUpdate, opmode=0xc
> 2081003: TXMODE, freq=903100000, len=23, SF=9, BW=125, CR=4/5, IH=0
> 2401261: RXMODE_SINGLE, freq=925700000, SF=9, BW=500, CR=4/5, IH=0
> 2463953: RXMODE_SINGLE, freq=923300000, SF=10, BW=125, CR=4/5, IH=0
> 2473525: engineUpdate, opmode=0xc
> 2478667: engineUpdate, opmode=0xc
> 2478969: TXMODE, freq=909400000, len=23, SF=8, BW=500, CR=4/5, IH=0
> 2789499: RXMODE_SINGLE, freq=925700000, SF=7, BW=500, CR=4/5, IH=0
> 2851159: RXMODE_SINGLE, freq=923300000, SF=10, BW=125, CR=4/5, IH=0
> 2860807: engineUpdate, opmode=0xc
> 3849846: engineUpdate, opmode=0xc
> 3850148: TXMODE, freq=909300000, len=23, SF=10, BW=125, CR=4/5, IH=0
> 4180712: RXMODE_SINGLE, freq=925100000, SF=10, BW=500, CR=4/5, IH=0
> 4243276: RXMODE_SINGLE, freq=923300000, SF=10, BW=125, CR=4/5, IH=0
> 4252849: engineUpdate, opmode=0xc
> 4268387: engineUpdate, opmode=0xc
> 4268689: TXMODE, freq=907800000, len=23, SF=8, BW=500, CR=4/5, IH=0
> 4579155: RXMODE_SINGLE, freq=925100000, SF=7, BW=500, CR=4/5, IH=0
> 4640815: RXMODE_SINGLE, freq=923300000, SF=10, BW=125, CR=4/5, IH=0
> 4650388: EV_JOIN_FAILED
> 4650417: engineUpdate, opmode=0xc
> 4714564: engineUpdate, opmode=0xc
> 4714865: TXMODE, freq=911700000, len=23, SF=10, BW=125, CR=4/5, IH=0
> 5045493: RXMODE_SINGLE, freq=927500000, SF=10, BW=500, CR=4/5, IH=0
> 5108058: RXMODE_SINGLE, freq=923300000, SF=10, BW=125, CR=4/5, IH=0
> 5117631: engineUpdate, opmode=0xc
> 5171754: engineUpdate, opmode=0xc
> 5172055: TXMODE, freq=914200000, len=23, SF=8, BW=500, CR=4/5, IH=0
> 5482521: RXMODE_SINGLE, freq=927500000, SF=7, BW=500, CR=4/5, IH=0
> 5544181: RXMODE_SINGLE, freq=923300000, SF=10, BW=125, CR=4/5, IH=0
> 5553690: EV_JOIN_FAILED
> 5553719: engineUpdate, opmode=0xc
> 6181324: engineUpdate, opmode=0xc
> 6181626: TXMODE, freq=913300000, len=23, SF=10, BW=125, CR=4/5, IH=0
> 6512254: RXMODE_SINGLE, freq=927500000, SF=10, BW=500, CR=4/5, IH=0
> 6520571: EV_JOINED
> 6520598: engineUpdate, opmode=0x808
> 6521071: TXMODE, freq=903900000, len=26, SF=10, BW=125, CR=4/5, IH=0
> 6605475: RXMODE_SINGLE, freq=923300000, SF=10, BW=500, CR=4/5, IH=0
> 6668103: RXMODE_SINGLE, freq=923300000, SF=12, BW=500, CR=4/5, IH=0
> 6672539: EV_TXCOMPLETE (includes waiting for RX windows)
> 6672585: engineUpdate, opmode=0x900
> 7922584: engineUpdate, opmode=0x908
> 7923042: TXMODE, freq=904100000, len=26, SF=10, BW=125, CR=4/5, IH=0
> Packet queued
> 8008662: RXMODE_SINGLE, freq=923900000, SF=10, BW=500, CR=4/5, IH=0
> 8071291: RXMODE_SINGLE, freq=923300000, SF=12, BW=500, CR=4/5, IH=0
> 8075663: EV_TXCOMPLETE (includes waiting for RX windows)
> 8075707: engineUpdate, opmode=0x900
> 9325708: engineUpdate, opmode=0x908
> 9326166: TXMODE, freq=904300000, len=26, SF=10, BW=125, CR=4/5, IH=0
> Packet queued
> 9411850: RXMODE_SINGLE, freq=924500000, SF=10, BW=500, CR=4/5, IH=0
> 9474479: RXMODE_SINGLE, freq=923300000, SF=12, BW=500, CR=4/5, IH=0
> 9478990: EV_TXCOMPLETE (includes waiting for RX windows)
> 9479035: engineUpdate, opmode=0x900
> 10729034: engineUpdate, opmode=0x908
> 10729493: TXMODE, freq=904500000, len=26, SF=10, BW=125, CR=4/5, IH=0
> Packet queued
> 10815050: RXMODE_SINGLE, freq=925100000, SF=10, BW=500, CR=4/5, IH=0
> 10877678: RXMODE_SINGLE, freq=923300000, SF=12, BW=500, CR=4/5, IH=0
> 10882051: EV_TXCOMPLETE (includes waiting for RX windows)
> 10882098: engineUpdate, opmode=0x900
> 12132098: engineUpdate, opmode=0x908
> 12132558: TXMODE, freq=904700000, len=26, SF=10, BW=125, CR=4/5, IH=0
> Packet queued
> 12218114: RXMODE_SINGLE, freq=925700000, SF=10, BW=500, CR=4/5, IH=0
> 12280742: RXMODE_SINGLE, freq=923300000, SF=12, BW=500, CR=4/5, IH=0
> 12285114: EV_TXCOMPLETE (includes waiting for RX windows)
> 12285162: engineUpdate, opmode=0x900
> 13535163: engineUpdate, opmode=0x908
> 13535623: TXMODE, freq=904900000, len=26, SF=10, BW=125, CR=4/5, IH=0
> Packet queued
> 13621178: RXMODE_SINGLE, freq=926300000, SF=10, BW=500, CR=4/5, IH=0
> 13683806: RXMODE_SINGLE, freq=923300000, SF=12, BW=500, CR=4/5, IH=0
> 13688179: EV_TXCOMPLETE (includes waiting for RX windows)
> 13688227: engineUpdate, opmode=0x900