In this project, we’ll demonstrate how to create custom AT commands on the Renesas DA14531MOD BLE module using the CodeLess SDK. Specifically, we’ll walk through the steps required to add functionality for displaying and modifying the Bluetooth Device Name.
The CodeLess SDK is based on SDK6, and we’ve combined insights from both the SDK6 documentation and the CodeLess User Manual to build this enhancement.
Tutorials:1) 7. SPI Flash — DA145XX Tutorial SDK peripherals2) 6. Adding Custom Commands — DA145XX Tutorial SDK Getting started
ObjectiveTo implement two custom AT commands:
AT+SHOWNAME
– Displays the current device name over the UART interface.
AT+SHOWNAME
– Displays the current device name over the UART interface.
AT+DEVNAME=<name>
– Updates the device name and stores it persistently in SPI Flash.
AT+DEVNAME=<name>
– Updates the device name and stores it persistently in SPI Flash.
The name set using AT+DEVNAME
is saved at a specific address in the SPI Flash. On boot, the firmware reads from this address to load the latest device name, ensuring the update persists across power cycles.
This tutorial is ideal for developers working with the Renesas DA14531MOD and looking to extend the CodeLess AT command set with custom functionality.
I worked on the latest CodeLess SDK v6.380.20.66 which can be downloaded from here: SmartBond™ - CodeLess™ AT Commands | Renesas
I am using Keil uVision v5.38 but e2 Studio IDE can be used as well.Open the codeless_device project for Keil uVision and select the codeless_531_datapump target:
Check the Software Changes/Code attachments for the necessary code snippets in order to implement this on your side.
Device Initialization FlowOn boot, the user_app_on_init
callback is executed as part of the custom application logic. This function serves as the ideal hook to initialize the device's configuration, including the dynamic assignment of the BLE name.
During this initialization, we read the contents of SPI Flash at address 0xBD80. If the memory at this location is empty (i.e., filled with 0xFF
), we proceed to use the default device name as defined in the user_config.h
file. This ensures a valid fallback name for first-time startups or when no custom name has been set.
If, however, a valid name is detected at 0xBD80, it indicates that the AT+DEVNAME
command has been previously issued. In this case, we parse and apply the stored name dynamically to the BLE device configuration.
Upon determining the device name (either default or user-defined), the application takes further steps to reflect this identity in BLE advertising packets:
The first 4 bytes of the name are set as the Short Device Name in the Advertising Data.
- The first 4 bytes of the name are set as the Short Device Name in the Advertising Data.
The full device name (up to 32 bytes) is included in the Scan Response Data, allowing BLE Central devices to retrieve the complete name upon scanning.
- The full device name (up to 32 bytes) is included in the Scan Response Data, allowing BLE Central devices to retrieve the complete name upon scanning.
This approach ensures proper BLE identification while maintaining advertising payload constraints.
Verifying Advertising BehaviorFollowing the initialization, the user_advertise
function is invoked to begin BLE advertising. At this stage, validation checks are performed to confirm that the correct device name has been applied and is reflected in the advertising payload.
The system remains responsive to name updates at runtime. The AT+DEVNAME
command can be safely used while the device is idle, advertising, or even connected, without disrupting ongoing BLE operations.
At any point, the user can issue the AT+SHOWNAME
command over UART to display the currently assigned device name. This command is helpful for verifying persistent configuration and confirming updates after name changes.
By integrating the AT+DEVNAME
and AT+SHOWNAME
commands with persistent storage and dynamic configuration, the DA14531MOD module offers a powerful yet simple mechanism to manage device identity in BLE applications. This approach, combined with the flexibility of the CodeLess SDK and the performance of Renesas hardware, enables rapid development and deployment of BLE-enabled products with minimal code overhead.
Demo Showcase:
Below you can find the Tera Term terminal logs while running the application and a short recording from a SmartPhone running the SmartConsole mobile application.DA14531MOD UART Log:
+READY
AT+DEVNAME=NewName
NewName
OK
AT+SHOWNAME
NewName
OK
AT+SHOWNAME=
INVALID COMMAND.
ERROR
AT+SHOWNAME=1
INVALID COMMAND.
ERROR
AT+DEVNAME
Use the AT+SHOWNAME command
OK
+AWAKE
+CONNECTED
+COMMAND MODE SUPPORTED
+BINARY MODE SUPPORTED
AT+DEVNAME=AnotherName
AnotherName
OK
+AWAKE
+DISCONNECTED
AT+SHOWNAME
AnotherName
OK
ATR
AnotherName
+READY
AT+SHOWNAME
AnotherName
OK
Video:
Comments