Dear Team,
We are using DA14531 soc for our application. I have used "default_app_generate_unique_static_random_addr()" to generate the unique address for each device.
In this I want to flash this unique address into the OTP memory at this address 0x07F87FD4.
I am using smart snippets cli for programming. After flashing i want to verify the BD address in the OTP and the address my device advertise are same.
How to read the particular address from the OTP using cli? and how to flash the BD address in OTP.
Kindly help me to solve this issue.
Hi TDC,
Thank you for posting your questions online.
Please refer to this tutorial for OTP and CLI:
3.2. OTP — UM-B-083 (renesas.com)
8. CLI implementation — UM-B-083 (renesas.com)
BR,
JH_Renesas
How can I able to get the BD address of the device ( which is been generated using the "default_app_generate_unique_static_random_addr()" ) after flashing the program using command line. Where this MAC ID will be stored? How can I retrieve that using command prompt?
It was generated in the progress of initialing:
CLI does not support get BD addr for this.
Thank you for your support.
Is there any other alternative way to get the BD address of the device, without scanning using mobiles.
Dear TDC,Thank you for the reply.
TDC said: Is there any other alternative way to get the BD address of the device, without scanning using mobiles.
On the following callback function declare a custom callback function that will call the default_app_generate_static_random_addr callback and then just print out the BDA via the bd_addr struct.
//on user_callback_config.h file .app_on_generate_static_random_addr = default_app_generate_static_random_addr, //implementation of the default callback functions can be found on app_default_handlers.c file void default_app_generate_static_random_addr(struct bd_addr *addr) { // Check if the static random address is already generated. // If it is already generated the two MSB are equal to '1' if (!(addr->addr[BD_ADDR_LEN - 1] & GAP_STATIC_ADDR)) { // Generate static random address, 48-bits co_write32p(&addr->addr[0], co_rand_word()); co_write16p(&addr->addr[4], co_rand_hword()); // The two MSB shall be equal to '1' addr->addr[BD_ADDR_LEN - 1] |= GAP_STATIC_ADDR; } }
Best Regards,OV_Renesas
I'm working on a production implementation where I need to retrieve the MAC ID of the device after flashing it and then store that MAC ID in the OTP memory. I can program the DA14531 using the CLI, but I'm unsure how to obtain the MAC ID post-flashing. Can you provide guidance on this?
Dear TDC,Thank you for the reply.First Alternative:Use the default_app_generate_unique_static_random_addr callback function to generate the Unique BD Address, then store this BD Address on the SPI Flash. Via CLI you can read the specific address on SPI Flash to retrieve the BD Address and then burn it into the OTP.Second Alternative:Work with PLT,During Production, you can provide a csv file with all the BDA you want to be burned on the OTP header.Since you will provide the CSV you can guarantee that each device will have a unique BDA.Best Regards,OV_Renesas
Dear Team ,
Thank you for the reply.
I am following the SPI_Flash example available in the sdk , to store the BD address in the SPI flash. In this I have modified the code to write only one byte in the address at 0xf000. Please find the below code for the reference.
spi_flash_write_data_buffer(wr_data, 0x0000f000, 8, &actual_size); printf_string(UART, "Data written."); // Read SPI Flash first 512 bytes printf_string(UART, "\r\n\r\nReading SPI Flash first 512 bytes..."); spi_flash_read_data_buffer(rd_data,0x0000f000 , write_size, &actual_size); // Display Results for (i = 0; i < write_size; i++) { printf_byte(UART, rd_data[i]); printf_string(UART, " "); } printf_string(UART, "\r\nBytes Read: 0x"); printf_byte(UART, (actual_size >> 8) & 0xFF); printf_byte(UART, (actual_size) & 0xFF);
I can able to flash this code using smart snippet CLI. But when I try to read the spi_flash it shows error. I have use this below command to read the spi flash using CLI.
SmartSnippetsToolbox.exe -type spi -chip DA14531 -jtag 480073432 -cmd read -file spi_out.txt
Below I have attched the error message. How to solve this error? Is it possible to read the particular memory address of SPI flash instead of reading it fully.
C:\Program Files\SmartSnippetsToolbox\SmartSnippetsToolbox5.0.24>SmartSnippetsToolbox.exe -type spi -chip DA14531 -jtag 480073432 -firmware "jtag_programmer_531.bin" -cmd write -file spi_flash_531.hex -verify Launching SmartSnippets Toolbox v5.0.24.4128 Command line arguments: -type spi -chip DA14531 -jtag 480073432 -firmware jtag_programmer_531.bin -cmd write -file spi_flash_531.hex -verify Found SW-DP with ID 0x0BC11477 DPIDR: 0x0BC11477 Scanning AP map to find all available APs AP[1]: Stopped AP scan as end of AP map has been reached AP[0]: AHB-AP (IDR: 0x04770031) Iterating through AP map to find AHB-AP to use AP[0]: Core found AP[0]: AHB-AP ROM base: 0xE00FF000 CPUID register: 0x410CC601. Implementer code: 0x41 (ARM) Found Cortex-M0 r0p1, Little endian. FPUnit: 4 code (BP) slots and 0 literal slots CoreSight components: ROMTbl[0] @ E00FF000 ROMTbl[0][0]: E000E000, CID: B105E00D, PID: 000BB008 SCS ROMTbl[0][1]: E0001000, CID: B105E00D, PID: 000BB00A DWT ROMTbl[0][2]: E0002000, CID: B105E00D, PID: 000BB00B FPB BTLE device selected. Using default max memory size: 0x00200000 bytes. Found SW-DP with ID 0x0BC11477 DPIDR: 0x0BC11477 AP map detection skipped. Manually configured AP map found. AP[0]: AHB-AP (IDR: Not set) AP[0]: Core found AP[0]: AHB-AP ROM base: 0xE00FF000 CPUID register: 0x410CC601. Implementer code: 0x41 (ARM) Found Cortex-M0 r0p1, Little endian. FPUnit: 4 code (BP) slots and 0 literal slots CoreSight components: ROMTbl[0] @ E00FF000 ROMTbl[0][0]: E000E000, CID: B105E00D, PID: 000BB008 SCS ROMTbl[0][1]: E0001000, CID: B105E00D, PID: 000BB00A DWT ROMTbl[0][2]: E0002000, CID: B105E00D, PID: 000BB00B FPB Reset: Halt core after reset via DEMCR.VC_CORERESET. Reset: Reset device via AIRCR.SYSRESETREQ. Firmware File jtag_programmer_531.bin has been selected for downloading. Reset: Halt core after reset via DEMCR.VC_CORERESET. Reset: Reset device via AIRCR.SYSRESETREQ. Reset: Halt core after reset via DEMCR.VC_CORERESET. Reset: Reset device via AIRCR.SYSRESETREQ. Successfully downloaded firmware file to the board. Using default baudrate: 115200 Bd. Do you want SPI Flash memory to be bootable? ([Y / N]?) Y Added bootable header to image. Successfully configured SPI ports and pins. Read 9176 bytes from offset 0x00 Started burning memory with 9176 bytes of data at address 0x00000. Memory burning completed successfully. Reading memory to verify its contents after burn... Read 9176 bytes from offset 0x00 SPI Flash memory verification succeeded. Sent reset command. If application won't start replug the board. C:\Program Files\SmartSnippetsToolbox\SmartSnippetsToolbox5.0.24>SmartSnippetsToolbox.exe -type spi -chip DA14531 -jtag 480073432 -cmd read -file spi_out.txt Launching SmartSnippets Toolbox v5.0.24.4128 Command line arguments: -type spi -chip DA14531 -jtag 480073432 -cmd read -file spi_out.txt Found SW-DP with ID 0x0BC11477 DPIDR: 0x0BC11477 Scanning AP map to find all available APs AP[1]: Stopped AP scan as end of AP map has been reached AP[0]: AHB-AP (IDR: 0x04770031) Iterating through AP map to find AHB-AP to use AP[0]: Core found AP[0]: AHB-AP ROM base: 0xE00FF000 CPUID register: 0x410CC601. Implementer code: 0x41 (ARM) Found Cortex-M0 r0p1, Little endian. FPUnit: 4 code (BP) slots and 0 literal slots CoreSight components: ROMTbl[0] @ E00FF000 ROMTbl[0][0]: E000E000, CID: B105E00D, PID: 000BB008 SCS ROMTbl[0][1]: E0001000, CID: B105E00D, PID: 000BB00A DWT ROMTbl[0][2]: E0002000, CID: B105E00D, PID: 000BB00B FPB BTLE device selected. Using default max memory size: 0x00200000 bytes. Using default baudrate: 115200 Bd. Started reading 32768 bytes from SPI Flash memory offset 0x0. Failed configuring SPI ports and pins. Error: Failed reading 16384 bytes from offset 0x00 SPI Flash memory reading has failed.
Dear TDC,Thank you for the reply.You did not specify the offset and that is why it did not work on your side.For instance, try to use:
SmartSnippetsToolbox.exe -type spi -chip DA14531 -jtag 480071106 -cmd read -offset 0x0f000 -file spi_out.txt
C:\Program Files\SmartSnippetsToolbox\SmartSnippetsToolbox5.0.24>SmartSnippetsToolbox.exe -type spi -chip DA14531 -jtag 480071106 -cmd read -offset 0x0f000 -file spi_out.txt Launching SmartSnippets Toolbox v5.0.24.4128 Loaded the following properties from C:\Users\ovasinio\SmartSnippetsToolbox\properties.txt {Enable_FlashCode_NVParams=true, Enable_FlashCode_ProductHeaderBackup=true, Enable_FlashCode_ConfigurationScript=true, ENABLE_PART=true, Enable_FlashCode_FirmwareImage1=true, ENABLE_HIDDEN_TOOLS=true, ENABLE_TS=true, Enable_FlashCode_FirmwareImage2=true, Enable_FlashCode_ProductHeader=true, ENABLE_MP=true, ENABLE_TE=true} Command line arguments: -type spi -chip DA14531 -jtag 480071106 -cmd read -offset 0x0f000 -file spi_out.txt Found SW-DP with ID 0x0BC11477 DPIDR: 0x0BC11477 Scanning AP map to find all available APs AP[1]: Stopped AP scan as end of AP map has been reached AP[0]: AHB-AP (IDR: 0x04770031) Iterating through AP map to find AHB-AP to use AP[0]: Core found AP[0]: AHB-AP ROM base: 0xE00FF000 CPUID register: 0x410CC601. Implementer code: 0x41 (ARM) Found Cortex-M0 r0p1, Little endian. FPUnit: 4 code (BP) slots and 0 literal slots CoreSight components: ROMTbl[0] @ E00FF000 ROMTbl[0][0]: E000E000, CID: B105E00D, PID: 000BB008 SCS ROMTbl[0][1]: E0001000, CID: B105E00D, PID: 000BB00A DWT ROMTbl[0][2]: E0002000, CID: B105E00D, PID: 000BB00B FPB BTLE device selected. Using default max memory size: 0x00200000 bytes. Using default baudrate: 115200 Bd. Started reading 32768 bytes from SPI Flash memory offset 0xF000. Successfully configured SPI ports and pins. Read 16384 bytes from offset 0xF000 Read 16384 bytes from offset 0x13000 Memory contents exported successfully to spi_out.txt SPI Flash memory reading has finished. Read 32768 bytes.
I have tried the same command, still the I am able to read spi - flash memory.
This error message, I got when i try to read the custom board flash memory.
C:\Program Files\SmartSnippetsToolbox\SmartSnippetsToolbox5.0.24>SmartSnippetsToolbox.exe -type spi -chip DA14531 -jtag 480072666 -cmd read -offset 0x0f000 -file spi_out.txt Launching SmartSnippets Toolbox v5.0.24.4128 Command line arguments: -type spi -chip DA14531 -jtag 480072666 -cmd read -offset 0x0f000 -file spi_out.txt Found SW-DP with ID 0x0BC11477 DPIDR: 0x0BC11477 Scanning AP map to find all available APs AP[1]: Stopped AP scan as end of AP map has been reached AP[0]: AHB-AP (IDR: 0x04770031) Iterating through AP map to find AHB-AP to use AP[0]: Core found AP[0]: AHB-AP ROM base: 0xE00FF000 CPUID register: 0x410CC601. Implementer code: 0x41 (ARM) Found Cortex-M0 r0p1, Little endian. FPUnit: 4 code (BP) slots and 0 literal slots CoreSight components: ROMTbl[0] @ E00FF000 ROMTbl[0][0]: E000E000, CID: B105E00D, PID: 000BB008 SCS ROMTbl[0][1]: E0001000, CID: B105E00D, PID: 000BB00A DWT ROMTbl[0][2]: E0002000, CID: B105E00D, PID: 000BB00B FPB BTLE device selected. Using default max memory size: 0x00200000 bytes. Using default baudrate: 115200 Bd. Started reading 32768 bytes from SPI Flash memory offset 0xF000. Failed configuring SPI ports and pins. Error: Failed reading 16384 bytes from offset 0xF000 SPI Flash memory reading has failed.
when I try with the evaluation kit, it shows the below message
Why its fails to configuring the SPI pins? How to solve this issue?