How to Exit a smartBASIC $autorun$ Application on the IG60-BL654 Gateway

There exist pre-defined GPIOs in the IG60 to control the BL654 module, which can be found under /sys/devices/platform/gpio:

  • bt_nautorun: If set to 0 (low) autorun is active and and $autorun$ application will start after power up/reset and if set to 1 (high) autorun will be disabled.
  • card_nreset: Setting to 0 (low) asserts BL654 reset and 1 (high) releases reset.

To exit an $autorun$ application nAUTORUN needs to be set high followed by a module reset.

echo 1 > /sys/devices/platform/gpio/bt_nautorun/value (disables autorun)
echo 0 > /sys/devices/platform/gpio/card_nreset/value (assert reset)
echo 1 > /sys/devices/platform/gpio/card_nreset/value (release reset)
echo 0 > /sys/devices/platform/gpio/bt_nautorun/value (re-enable autorun)

You should now be able to connect to the BL654 through e.g. microcom with access to the smartBASIC interactive mode:

microcom -s 115200 /dev/ttyS2

You can now use e.g. AT&F* to clear the flash file system before loading a new smartBASIC app to the module with the above Python script. (Note: CTRL-x will exit microcom).

Note: You can always check the current state of the above GPIOs with

cat /sys/devices/platform/gpio/.../value

See also the IG60-BL654 Online Guide on SmartBASIC with the IG60.