How do I exit Bluetooth DTM direct test mode on the BL654 module in the IG60 Laird Linux

DTM functionality is integrated into our SmartBASIC firmware preloaded on the BL654 in the IG60 Laird Linux. Activation of DTM is done by AT+DTM command as described in this application note. Instead of using our UwTerminalX program you can use e.g., microcom to connect to the BL654 and communicate (microcom -s 115200 -p /dev/sttyS2, exit microcom with ctrl-x). After that DTM commands can be exercised which in fact are binary commands sent at 19200 baud instead of 115200 used for SmartBASIC interactive mode. However, most commands are composed of non-ascii bytes and hence it is not possible to enter these into microcom or other terminal programs. The below sequence shows how to send the exit-DTM-mode command from the Linux console as an example:

Set the serial port parameters to 19200/8N1:

stty -F /dev/ttyS2 19200 cs8 -parenb -cstopb

Echo a two-byte command (0x3f, 0xfe bytes) into the serial port device:

echo -ne "\x3f\xfe" > /dev/ttyS2

The -n switch will suppress the newline at string end and -e will allow for escape’ing of hex numbers. That way it will send the required bytes 0x3f and 0xff directly and raw into the serial port device.

Other DTM commands could be sent in the same way by replacing \x3f... with different hex numbers.