4. AT Commands — DA1458x CodeLess Tutorial

ATATBasic AT commandOK ATIATIDevice information query. Returns firmware version, hardware type and unique organization identifier.CodeLess DA14585/6 Vx.x OK

CodeLess DA14585/6 V2.5.20180111

OK

ATEATE=<0:off / 1:on>Turns UART echo on/offOK ATZATZSets IO configuration back to defaultOK ATFATF=<0:off / 1:on>Turns error reporting on/offOK ATRATRTrigger platform resetREADY AT+TMRSTARTAT+TMRSTART=<timer index 0-3>,<command slot index 0-3>,delayThere are 4 timers that when expire after delay X10msec time will trigger command sequence stored in specified command slotOK

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

OK

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

AT+TMRSTOP=0

OK

AT+CURSORAT+CURSORPlaces a time cursor in a SmartSnippetspower profiler plotOK AT+RANDOMAT+RANDOMReturns a random 32bit number (hexadecimal)

0xXXXXXXXX

OK

0x00234112

OK

AT+BATTAT+BATTReturns the battery capacity in percentage of full capacity. Assumes CR2032AT+BDADDRAT+BDADDRQueries the Bluetooth device address

XX:XX:XX:XX:XX:XX

OK

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

OK

AT+SLEEPAT+SLEEP=<0:awake / 1:sleep>Places the device in extended sleep or wake it up. Use ‘@’ command to wake the device from sleepOK 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+IOAT+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+ADCAT+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+I2CSCANAT+I2CSCANScans 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+I2CCFGAT+I2CCFG=<slave_Addressing_Bitcount>,<bit_rate>,<slave_register_width>Configures the I2C bus for devices

AT+I2CCFG=7,400,16

AT+I2CREADAT+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+I2CWRITEAT+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+PRINTAT+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+PINAT+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+CMDSTOREAT+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+CMDPLAYAT+CMDPLAY=<index:0-3>Executes the semicolon separated command strings in the corresposing index stored using CMDSTORE commandOK

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+CMDAT+CMDPLAY=<index:0-3>Display the semicolon separated command strings in the corresposing index stored using CMDSTORE commandOK

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

OK

AT+ADVSTOPAT+ADVSTOPStops advertising. Returns ERROR if not already advertisingOK

AT+ADVSTOP

     AT+ADVSTARTAT+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+ADVDATAAT+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+ADVRESPAT+ADVRESP[=<advertise data>]Sets or queries scan response data. Changes to take effect after restart of advertisingOK

AT+ADVRESP

AT+CENTRALAT+CENTRALSets 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+PERIPHERALAT+PERIPHERALSets the device Bluetooth role to peripheral. Any connection must be terminated before the role change is acceptedOK

AT+PERIPHERAL

AT+BROADCASTERAT+BROADCASTERSets the device Bluetooth role to broadcaster. Any connection must be terminated before the role change is acceptedOK

AT+BROADCASTER

AT+GAPSTATUSAT+GAPSTATUSReports 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+GAPSCANAT+GAPSCANStarts 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+GAPCONNECTAT+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+GAPDISCONNECTAT+GAPDISCONNECTDisconnects 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