How do you exit Autorun Mode, to enable updating a smartBASIC application OTA or via the UART?

To be able to exit Autorun Mode it is necessary to include an option in the smartBASIC code, prior to loading it to the module, that provides a way to exit the application, or have access to the nAutoRun pin. The options are explained below for UART and OTA methods for exiting Autorun Mode.

UART Methods:

1) Provided access is available to the nAutoRun pin, pull the nAutorun pin HIGH to move the module from nAutorun mode to Development mode. Once this pin is pulled high and the module is reset it should enter into Interactive Command mode and it should be possible to erase the file system, using AT&F1 and load a new smartBASIC application over the UART.

2) Have a way to exit the application, via a command or pin setting, using Endfunc 0. If Waitevent is the last statement in the application, and a function triggered by the command or pin change returns "Endfunc 0", then the module will exit the application and return to Interactive Command mode. Once the module returns to Interactive Command mode, the file system can be erased with AT&F1, and the updated application can then be loaded.

Over-the-Air smartBASIC application loading requires control of the vSP pin. To enter into OTA mode, it is necessary to pull the vSP pin of the BL65x module high, while the nAutorun pin is held low. This places the module in vSP-Command Mode, as opposed to vSP-Bridge mode, as explained in the "Command and Bridge Mode Operation" section of the matching smartBASIC Extensions User Guide for the module (see links below).

BL654/BL654PA smartBASIC Extensions Guide v29.5.7.2
User Guide - BL653 and BL653µ smartBASIC Extensions Guide v30.2.3.0
User Guide - BL652 smartBASIC Extensions v28.10.7.2

However, if an $autorun$ application is loaded to the module when the vSP pin is pulled high it will just run the application, in which case the one of the following methods can be used to enable exiting the application and erase the file system so that an updated application can be loaded.

OTA Methods:

1) Invoke the EraseFileSystem() function in the smartBASIC application. This function is used to erase the flash file system which contains the application that invoked this function, if and only if, the vSP input pin is pulled high. Given that SIO2 is high, after erasing the file system, the module resets and reboots into command mode with the virtual serial port service enabled (vSP-Command Mode), and the application can then be loaded following the OTA method.

2) Have a way to exit the application within the smartBASIC code, via a command or pin setting, using Endfunc 0. If “Waitevent” is the last statement in the application, and a function triggered by the command or pin change returns "Endfunc 0", then the module will exit the application and return to Interactive Command mode. Once the module returns to Interactive Command mode, the file system can be erased with AT&F1, and the updated application can then be loaded.

For convenience, a list of the nAutoRun pins/SIO and vSP pins/SIO for all BL65x modules is provided below. These can also be found in the Datasheet for the specified module.

BL65x nAutoRun and vSP pins
Module nAutoRun
Pin | SIO
vSP
Pin |SIO
BL654PA Pin 5
SIO_35           
Pin 50
SIO_02
BL654 Pin 5
SIO_35           
Pin 50
SIO_02
BL653 Pin 34
SIO_35
Pin 50
SIO_02
BL653u Pin 34
SIO_35
Pin 37
SIO_02
BL652 Pin 28
SIO_13
Pin 23
SIO_02


Categories

Products