Skip to content

examples

Dennis Deng edited this page Oct 12, 2026 · 2 revisions

This page shows a few examples for specific tasks.

deal with crystal error

Sometimes, you may need to check and even correct the crystal error for your board:

>> bsp_get_crystal_err
crystal error: 16000
>> bsp_set_crystal_err 15040
>> bsp_get_crystal_err
crystal error: 15040

Join a LoRaWAN network and send uplink

Below command sequence shows how to set up end-device and requests to join the LoRaWAN network, and once get the JOINED event, sends an empty uplink packet. Finally, it leaves the network:

>> set_dev_eui  FE:FF:FF:FF:FD:FF:3B:00
>> set_join_eui 00:16:C0:01:FF:FE:00:01
>> set_app_key 0:0:0:0:0:0:0:0:0:0:0:0:0:0:3B:0
>> join_network
>>
----> Event happened (0 such event missed): JOINED (successfully joined network)

>> request_empty_uplink +fport 0x24 confirm
>> leave_network
>>

Note: set_app_key is called set_nwk_key in version 0.7.3.

Test commands

Before run Test commands, the user needs to run test_start first to enter the TEST mode, and call test_exit to exit from TEST mode once the tests are done.

Test Tx_CW

Note: Since test_tx_cw won't stop by itself, the user can use test_nop to stop it. Once done, an EVENT TEST_MODE will be triggered.

>> test_start
>> test_tx_cw 866200000 10
>> test_nop
>>
----> Event happened (0 such event missed): TEST_MODE
  STATUS: Test mode ended action

>> test_exit

Test RSSI

>> test_start
>> test_rssi 867200000 10 125000
>> test_read_rssi
rssi: -119
>> test_exit

ABP related commands

Version v0.8 includes 3 commands dedicated for ABP, and another 2 commands used for helping purpose. Below command sequence shows how to use them:

>> 
>> debug_connect_with_abp  00:00:00:0A  00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:AB  00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:CD
>> 
----> Event happened (0 such event missed): JOINED (successfully joined network)

>> 
>> request_uplink 0x24 confirm 40 5D 94
>> 
----> Event happened (0 such event missed): TXDONE (frame transmitted)
  STATUS: payload sent and ACK received

>> 
>> disable_event_process
automatically checking events is disabled
>> 
>> modem_backup_retention_ram_in_nvm
Succeed, and nvm has been written 11 times
>> 
>> system_reboot
Modem-E is under reboot.
Please wait one second...
>> 
>> modem_restore_retention_ram_from_nvm
elapsed time: 23000 = [0, 0, 0, 0, 0, 0, 89, 216]
>> 
>> enable_event_process
automatically checking events is enabled
>> 
>> request_uplink 0x24 confirm 40 5D 99
>> 
>> 
----> Event happened (0 such event missed): TXDONE (frame transmitted)
  STATUS: payload sent and ACK received

Note:

  • command modem_restore_retention_ram_from_nvm only can be used after chip reset or it will fail. Here we use system_reboot to reset the chip.
  • commands disable_event_process and enable_event_process are used to disable and enable the background event checking with command modem_get_event. This way can guarantee modem_restore_retention_ram_from_nvm succeeds after chip reset.
  • commands disable_event_process and enable_event_process are only available in Interpreter, not Modem-E API functions.

Clone this wiki locally