4. AT Commands — DA1458x CodeLess Tutorial

AT AT Basic AT command OK   ATI ATI Device information query. Returns firmware version, hardware type and unique organization identifier. CodeLess DA14585/6 Vx.x OK

CodeLess DA14585/6 V2.5.20180111

OK

ATE ATE=<0:off / 1:on> Turns UART echo on/off OK   ATZ ATZ Sets IO configuration back to default OK   ATF ATF=<0:off / 1:on> Turns error reporting on/off OK   ATR ATR Trigger platform reset READY   AT+TMRSTART AT+TMRSTART=<timer index 0-3>,<command slot index 0-3>,delay There are 4 timers that when expire after delay X10msec time will trigger command sequence stored in specified command slot OK

AT+TMRSTART=0,0,100 [timer 0 will expire after 1 sec and will trigger command sequence stored in command slot 0]

OK

AT+TMRSTOP AT+TMRSTOP=<timer index 0-3> Stop specified timer if not already expired OK

AT+TMRSTOP=0

OK

AT+CURSOR AT+CURSOR Places a time cursor in a SmartSnippetspower profiler plot OK   AT+RANDOM AT+RANDOM Returns a random 32bit number (hexadecimal)

0xXXXXXXXX

OK

0x00234112

OK

AT+BATT AT+BATT Returns the battery capacity in percentage of full capacity. Assumes CR2032 AT+BDADDR AT+BDADDR Queries the Bluetooth device address

XX:XX:XX:XX:XX:XX

OK

CA:D2:BE:0E:9F:E0

OK

AT+SLEEP AT+SLEEP=<0:awake / 1:sleep> Places the device in extended sleep or wake it up. Use ‘@’ command to wake the device from sleep OK   AT+IOCFG

AT+IOCFG[=<pin#>,<IO functionality>,<Optinal level to drive after configuration, default 0 for low>]

Refer Table 2 for the IO functionality inputs

Sets the functionality of a specified IO pin. Lists all pin configuration if no arguments are provided. OK

AT+IOCFG=10,4

[Configuring P1_0 as IO Output (‘4’)]

AT+IO AT+IO=<pin#>[,<0:low / 1:high>] Read specified pin status If one argument provided. Sets an Output if two arguments are provided.

X,

OK

or OK

ATr+IO=10,1 [Switch ON remote LED – D3]

AT+IO=10,1 [Switch ON local LED – D3]

AT+ADC AT+ADC=<pin#> Reads an analog input pin. Result provided as decimal (10bit ADC). Only pins P0_0 to P0_3 can be analog inputs!

AT+ADC=2 (on P0_2)

AT+I2CSCAN AT+I2CSCAN Scans the I2C bus for devices. Returns the address of detected devices and the content of register 0x00 where present

0xXX,0xXX

OK

AT+I2CSCAN

0x18,0x00

OK

AT+I2CCFG AT+I2CCFG=<slave_Addressing_Bitcount>,<bit_rate>,<slave_register_width> Configures the I2C bus for devices

AT+I2CCFG=7,400,16

AT+I2CREAD AT+I2CREAD=<slave_address>,<slave_register>[,<Number_Bytes>] Reads a 1 or more specified 8 bit registers from an I2C slave at a specified address

0xXX,0xXX,0xXX

OK

AT+I2CREAD=0x18,3 [reading 3 bytes]

0x01,0x02,0x03

OK

AT+I2CWRITE AT+I2CWRITE=<slave_address>, <slave_register>,<Data_Byte> Writes 8 bit data to a register of an I2C slave at a specified address. OK

AT+I2CWRITE=0x18,3,5

AT+PRINT AT+PRINT=<text_to_print> Prints a specified string to the UART. As opposed to the pipe command, the PRINT command returns OK

<text_to_print>

OK

AT+PRINT=Hello World!

Hello World!

OK

AT+MEM

AT+MEM=<index 0-3>,[<Text string to store>]

There are 4 such blocks each of 100 characters

This allows you to exchange data between devices without the need for custom commands.

lists the content of memory index entered

<text string to store>

OK

AT+MEM=0,Helloworld! [Stores Helloworld! in mem location 0]

AT+MEM=0 [Retreives data stored in location 0]

Helloworld!

OK

AT+PIN AT+PIN=[<Bluetooth access key (32bit integer)>] This feature allows you to set a passkey on your device which will force the device to prompt for a passkey (a.k.a. PIN code) when a central device attempts to connect

<lists the current access key>

OK

AT+PIN=1234 [sets the access key]

AT+PIN [Lists the current access key]

AT+CMDSTORE AT+CMDSTORE=<index:0-3>,<semicolon separated command strings> Stores one or multiple commands (semicolon separated) OK

AT+CMDSTORE=0, AT+IOCFG=10,4;AT+IO=10,1

AT+CMDPLAY AT+CMDPLAY=<index:0-3> Executes the semicolon separated command strings in the corresposing index stored using CMDSTORE command OK

AT+CMDPLAY=0

OK [Response to the AT+IOCFG=10,4 which is the first command stored using CMDSTORE in index 0]

OK [Response to the AT+IO=10,1 which is the second command stored using CMDSTORE in index 0]

AT+CMD AT+CMDPLAY=<index:0-3> Display the semicolon separated command strings in the corresposing index stored using CMDSTORE command OK

… [Whatever has been stored using CMDSTORE in index 0]

OK

AT+ADVSTOP AT+ADVSTOP Stops advertising. Returns ERROR if not already advertising OK

AT+ADVSTOP

          AT+ADVSTART AT+ADVSTART[=<adv_interval_ms>] Starts advertising. Advertising interval can optionally be specified in milliseconds (100 to 3000ms). Returns Error if advertising is already active or if the device is in central role. OK

AT+ADVSTART=100

AT+ADVDATA AT+ADVDATA[=<advertise data>] Sets or queries the advertising data. Data must be provided as hex string. The content will take effect only after advertising is restarted. OK

AT+ADVDATA=04:09:43:41:54

[Length =0x04, type =0x09, data = ‘CAT’ (C=0x43, A=0x41, T=0x54), the length includes type and data]

AT+ADVRESP AT+ADVRESP[=<advertise data>] Sets or queries scan response data. Changes to take effect after restart of advertising OK

AT+ADVRESP

AT+CENTRAL AT+CENTRAL Sets the device Bluetooth role to central role. Advertising must be stopped and any connection must be terminated before the role change is accepted. OK

AT+CENTRAL

AT+PERIPHERAL AT+PERIPHERAL Sets the device Bluetooth role to peripheral. Any connection must be terminated before the role change is accepted OK

AT+PERIPHERAL

AT+BROADCASTER AT+BROADCASTER Sets the device Bluetooth role to broadcaster. Any connection must be terminated before the role change is accepted OK

AT+BROADCASTER

AT+GAPSTATUS AT+GAPSTATUS Reports the Bluetooth role and connection status as X,Y where X is 0 for peripheral role and one for central role and Y is 0 for non-connected and 1 for connected.

AT+GAPSTATUS

AT+GAPSCAN AT+GAPSCAN Starts a Bluetooth device scan. Only accepted when device is in central role and not connected. A scan will continue for 8 seconds or until any character is received via UART

Scanning…

<list of devices>

Scan completed

OK

AT+GAPSCAN

Scanning…

( ) FD:37:13:D0:6D:02,R, Type: ADV, RSSI:-81

( ) FD:37:13:D0:6D:02,R, Type: RSP, RSSI:-80

( ) 69:35:59:5C:88:DA,R, Type: ADV, RSSI:-87

( ) 80:EA:CA:80:00:07,P, Type: ADV, RSSI:-52

( ) 80:EA:CA:80:00:07,P, Type: RSP, RSSI:-52

( ) 69:35:59:5C:88:DA,R, Type: RSP, RSSI:-81

( ) F0:1B:2A:F3:C6:0E,R, Type: ADV, RSSI:-67

( ) F1:5C:6F:77:62:AF,R, Type: ADV, RSSI:-64

( ) F1:5C:6F:77:62:AF,R, Type: RSP, RSSI:-64

( ) F0:1B:2A:F3:C6:0E,R, Type: RSP, RSSI:-67

Scan Completed…

OK

AT+GAPCONNECT AT+GAPCONNECT=<slave_address>,<P:public/ R:random> Initiates a connection with a specific slave device. The local device must be in central role. The connection attempt will continue until a connection has been established or until a character is received via the UART

Connecting…

Connected

AT+GAPCONNECT=FD:37:13:D0:6D:02,R

Connecting…

Connected

AT+GAPDISCONNECT AT+GAPDISCONNECT Disconnects from a peer Bluetooth device. This command can be used in both central and peripheral role

Disconnected

OK

AT+GAPDISCONNECT

Disconnected

OK

You Might Also Like