|
SmartSnippets DA1459x SDK
|
Application features:
It is used as a default target application by:
uartboot protocols use few terms:
uartboot uses 32-bits addressing.
The data length, CRC, address, bytes in OTP words should be sent using little-endian (LSB-first).
The application can be controlled using the serial console exposed over UART2.
GPIO pins configuration is as follows:
| DA1459x GPIO pin | DA1469x GPIO pin | DA1468x GPIO pin | Function |
|---|---|---|---|
| P0.13 | P0.9 | P1.3 | UART2 TX |
| P0.15 | P0.8 | P2.3 | UART2 RX |
UART settings are as follows:
| Setting | DA1459x/DA1469x | DA1468x |
|---|---|---|
| Baudrate | 115200 | 57600 |
| Data bits | 8 | 8 |
| Stop bits | 1 | 1 |
| Parity | None | None |
| Flow control | None | None |
This configuration can be changed, by modifying uartboot.bin binary at specific offsets:
| Offset | Description | Format |
|---|---|---|
| 0x0200 | TX port number | (4 bytes LE) |
| 0x0204 | TX pin number | (4 bytes LE) |
| 0x0208 | RX port number | (4 bytes LE) |
| 0x020C | RX pin number | (4 bytes LE) |
| 0x0210 | UART's baudrate value | (4 bytes LE) |
By default, all values are set to 0xFFFFFFFF.
A complete flow for command transmission handling (including in/out data) is as follows:
<= <STX> <SOH> (ver1) (ver2)
=> <SOH>
=> (type) (len1) (len2)
call HOP_INIT
<= <ACK> / <NAK>
if len > 0
call HOP_HEADER
=> (data...)
call HOP_DATA
<= <ACK> / <NAK>
<= (crc1) (crc2)
=> <ACK> / <NAK>
call HOP_EXEC
call HOP_SEND_LEN
if len > 0
<= (len1) (len2)
=> <ACK> / <NAK>
call HOP_SEND_DATA
<= (data...)
=> (crc1) (crc2)
<= <ACK> / <NAK>
'<=' - data sent by uartboot.
'=>' - data sent to uartboot by host application.
In case, error occures at any step (HOP_*), uartboot will send 'NAK', which shall terminate the transmission.
The application can be also controlled using the SWD interface (debugger commands), this can be done by performing the following actions:
| Offset | Field | Description | Format |
|---|---|---|---|
| 0x00 | DBGP | DBGP bytes | (4 bytes) |
| 0x04 | RUN_SWD | SWD interface usage marker (0: SWD is not used, other: SWD if is used) | (4 bytes LE) |
| 0x08 | NUM_ADDRESS | Current index of the command | (4 bytes LE) |
| 0x0C | CMD_BUF_ADDRESS | Current command buffer address | (4 bytes LE / pointer) |
| 0x10 | BUF_ADDRESS | Input/output payload buffer address | (4 bytes LE / pointer) |
| 0x14 | ACK_NAK_ADDRESS | Input/output ACK/NAK value | (4 bytes LE) |
Note: Detaching the debugger from board will cause a hardfault and it will be not possible to communicate with uartboot anymore until application restart.
uartboot application supports the following commands:
| Command | Name | Description |
|---|---|---|
| 0x01 | Write | Write data to RAM |
| 0x02 | Read | Read data from RAM |
| 0x03 | Copy to QSPI | Copy data from RAM to QSPI memory |
| 0x04 | Erase QSPI | Erase a part of the QSPI memory |
| 0x05 | Run | Execute a part of code |
| 0x06 | Write OTP | Write data to OTP memory |
| 0x07 | Read OTP | Read data from OTP memory |
| 0x08 | Read QSPI | Read data from QSPI memory |
| 0x09 | Customer specific | Perform customer specific action |
| 0x0A | Read partition table | Read partition table from FLASH memory |
| 0x0B | Get version | Get uartboot's version |
| 0x0C | Chip erase QSPI | Erase whole QSPI FLASH memory |
| 0x0D | Is empty QSPI | Check that a part of QSPI memory is empty |
| 0x0E | Read partition | Read data from FLASH partion |
| 0x0F | Write partition | Write data to FLASH partion |
| 0x10 | Get QSPI state | Get QSPI controller state |
| 0x11 | GPIO WD | Enable external watchdog notifying |
| 0x12 | QSPI direct write | Write data directly to QSPI memory |
| 0x13 | Chip erase eFLASH | Erase whole eFLASH memory |
| 0x14 | Read eFLASH | Read data from eFLASH memory |
| 0x15 | eFLASH direct write | Write data directly to eFLASH memory |
| 0x16 | Copy to eFLASH | Copy data from RAM to eFLASH memory |
| 0x17 | Erase eFLASH | Erase a part of the eFLASH memory |
| 0x18 | Is empty eFLASH | Check that a part of eFLASH memory is empty |
| 0x30 | Change baudrate | Change communication UART's baudrate |
| 0xFF | Dummy | Write 'Live' marker to data buffer |
Supported commands' description.
Write data to RAM memory.
| Byte Description | Value |
|---|---|
| SOH | 0x01 |
| Command Opcode | 0x01 |
| Length LSB | (0x04 + N) |
| Length MSB | (0x04 + N) >> 8 |
| Destination address LSB | 0xXX |
| Destination address | 0xXX |
| Destination address | 0xXX |
| Destination address MSB | 0xXX |
| Data 0 | Data byte 0 |
| … | … |
| Data n | Data byte N |
Note: SWD interface is able to write directly into RAM memory, which is suggested way for performing this operation. This command can be also used for writing values to registers.
Read data from RAM memory.
| Byte Description | Value |
|---|---|
| SOH | 0x01 |
| Command Opcode | 0x02 |
| Length LSB | 0x06 |
| Length MSB | 0x00 |
| Source address LSB | 0xXX |
| Source address | 0xXX |
| Source address | 0xXX |
| Source address MSB | 0xXX |
| Data length LSB | 0xXX |
| Data length MSB | 0xXX |
| Byte Description | Value |
|---|---|
| Data 0 | Data byte 0 |
| … | … |
| Data n | Data byte N |
Note: SWD interface is able to read directly from RAM memory, which is suggested way for performing this operation. This command can be also used for reading values from registers.
Copy data from RAM to QSPI FLASH/RAM memory.
| Byte Description | Value |
|---|---|
| SOH | 0x01 |
| Command Opcode | 0x03 |
| Length LSB | 0x0A |
| Length MSB | 0x00 |
| Source address LSB | 0xXX |
| Source address | 0xXX |
| Source address | 0xXX |
| Source address MSB | 0xXX |
| Data length LSB | 0xXX |
| Data length MSB | 0xXX |
| Destination address LSB | 0xXX |
| Destination address | 0xXX |
| Destination address | 0xXX |
| Destination address MSB | 0xXX |
Erase a part of the QSPI FLASH memory.
| Byte Description | Value |
|---|---|
| SOH | 0x01 |
| Command Opcode | 0x04 |
| Length LSB | 0x08 |
| Length MSB | 0x00 |
| QSPI address LSB | 0xXX |
| QSPI address | 0xXX |
| QSPI address | 0xXX |
| QSPI address MSB | 0xXX |
| Size LSB | 0xXX |
| Size | 0xXX |
| Size | 0xXX |
| Size MSB | 0xXX |
Note: All QSPI FLASH sectors which include given area (specified by address + size) will be erased (erase operation is sector aligned).
Execute a part of the code.
| Byte Description | Value |
|---|---|
| SOH | 0x01 |
| Command Opcode | 0x05 |
| Length LSB | 0x04 |
| Length MSB | 0x00 |
| Memory address LSB | 0xXX |
| Memory address | 0xXX |
| Memory address | 0xXX |
| Memory address MSB | 0xXX |
Note: Code can be executed from different memories e.g. RAM, eFLASH, QSPI, OTP, ROM. If the memory address is the same as the input buffer then uartboot will copy all data from input buffer at RAM 0 address and perform the SW Reset. This feature can be used for booting application from RAM which are too big for handling by ROM bootlaoder.
Write data to the OTP memory.
| Byte Description | Value |
|---|---|
| SOH | 0x01 |
| Command Opcode | 0x06 |
| Length LSB | (0x04 + N * 4) |
| Length MSB | (0x04 + N * 4) >> 8 |
| OTP cell offset LSB | 0xXX |
| OTP cell offset | 0xXX |
| OTP cell offset | 0xXX |
| OTP cell offset MSB | 0xXX |
| Word 0 LSB | 0xXX |
| Word 0 | 0xXX |
| Word 0 | 0xXX |
| Word 0 MSB | 0xXX |
| … | … |
| Word n LSB | 0xXX |
| Word n | 0xXX |
| Word n | 0xXX |
| Word n MSB | 0xXX |
Note: Cell size is 64-bits for DA1468x and 32-bits for DA1469x. In case of DA1459x, the OTP is emulated by allowing certain regions in eFLASH to be write/erase protected.
Read data from the OTP memory.
| Byte Description | Value |
|---|---|
| SOH | 0x01 |
| Command Opcode | 0x07 |
| Length LSB | 0x06 |
| Length MSB | 0x00 |
| OTP cell offset LSB | 0xXX |
| OTP cell offset | 0xXX |
| OTP cell offset | 0xXX |
| OTP cell offset MSB | 0xXX |
| Data length LSB | 0xXX |
| Data length MSB | 0xXX |
| Byte Description | Value |
|---|---|
| Word 0 LSB | 0xXX |
| Word 0 | 0xXX |
| Word 0 | 0xXX |
| Word 0 MSB | 0xXX |
| … | … |
| Word n LSB | 0xXX |
| Word n | 0xXX |
| Word n | 0xXX |
| Word n MSB | 0xXX |
Note: Cell size is 64-bits for DA1468x and 32-bits for DA1469x. Data length is a number of 32-bits words. In case of DA1459x, the OTP is emulated by allowing certain regions in eFLASH to be write/erase protected.
Read data from QSPI memory.
| Byte Description | Value |
|---|---|
| SOH | 0x01 |
| Command Opcode | 0x08 |
| Length LSB | 0x06 |
| Length MSB | 0x00 |
| Source address LSB | 0xXX |
| Source address | 0xXX |
| Source address | 0xXX |
| Source address MSB | 0xXX |
| Data length LSB | 0xXX |
| Data length MSB | 0xXX |
| Byte Description | Value |
|---|---|
| Data 0 | Data byte 0 |
| … | … |
| Data n | Data byte N |
Perform customer specific action.
| Byte Description | Value |
|---|---|
| SOH | 0x01 |
| Command Opcode | 0x09 |
| Length LSB | 0x00 |
| Length MSB | 0x00 |
Note: Behavior and input/output messages are implemented by the customer.
Read partition table from FLASH memory.
| Byte Description | Value |
|---|---|
| SOH | 0x01 |
| Command Opcode | 0x0A |
| Length LSB | 0x00 |
| Length MSB | 0x00 |
| Byte Description | Value |
|---|---|
| Length LSB | 0xXX |
| Length MSB | 0xXX |
| Sector size LSB | 0xXX |
| Sector size MSB | 0xXX |
| Start sector 0 LSB | 0xXX |
| Start sector 0 MSB | 0xXX |
| Start count 0 LSB | 0xXX |
| Start count 0 MSB | 0xXX |
| Partition ID 0 | 0xXX |
| Partition name length 0 LSB | 0xXX |
| Partition name length 0 MSB | 0xXX |
| Partition name 0 START | 0xXX |
| … | … |
| Partition name 0 END | 0x00 |
| … | … |
| Start sector N LSB | 0xXX |
| Start sector N MSB | 0xXX |
| Start count N LSB | 0xXX |
| Start count N MSB | 0xXX |
| Partition ID N | 0xXX |
| Partition name length N LSB | 0xXX |
| Partition name length N MSB | 0xXX |
| Partition name N START | 0xXX |
| … | … |
| Partition name N END | 0x00 |
Note: Check uartboot_types.h file for more details.
Get uartboot's version.
| Byte Description | Value |
|---|---|
| SOH | 0x01 |
| Command Opcode | 0x0B |
| Length LSB | 0x00 |
| Length MSB | 0x00 |
| Byte Description | Value |
|---|---|
| Version character 0 | '0' |
| Version character 1 | '.' |
| Version character 2 | '0' |
| Version character 3 | '.' |
| Version character 4 | '0' |
| Version character 5 | '.' |
| Version character 6 | '3' |
Note: Response string is sent without the '\0' character at the end. Its length is sent before the payload.
Erase whole QSPI FLASH memory.
| Byte Description | Value |
|---|---|
| SOH | 0x01 |
| Command Opcode | 0x0C |
| Length LSB | 0x00 |
| Length MSB | 0x00 |
Note: Execution time for this command is slightly longer than for the other commands.
Check that the part of the QSPI FLASH memory is empty.
| Byte Description | Value |
|---|---|
| SOH | 0x01 |
| Command Opcode | 0x0D |
| Length LSB | 0x08 |
| Length MSB | 0x00 |
| Size LSB | 0xXX |
| Size | 0xXX |
| Size | 0xXX |
| Size MSB | 0xXX |
| Start address LSB | 0xXX |
| Start address | 0xXX |
| Start address | 0xXX |
| Start address MSB | 0xXX |
| Byte Description | Value |
|---|---|
| Number LSB | 0xXX |
| Number | 0xXX |
| Number | 0xXX |
| Number MSB | 0xXX |
Note: If Number represents positive value, than it is a number of bytes that were checked to be erased. Otherwise, it represents position of first non-empty byte multiplied by -1.
Read data from FLASH partition.
| Byte Description | Value |
|---|---|
| SOH | 0x01 |
| Command Opcode | 0x0E |
| Length LSB | 0x07 |
| Length MSB | 0x00 |
| Source address LSB | 0xXX |
| Source address | 0xXX |
| Source address | 0xXX |
| Source address MSB | 0xXX |
| Data length LSB | 0xXX |
| Data length MSB | 0xXX |
| Partition ID | 0xXX |
| Byte Description | Value |
|---|---|
| Data 0 | Data byte 0 |
| … | … |
| Data n | Data byte N |
Note: Source address should be an offset from the partition beginning.
Copy data from RAM to FLASH partition.
| Byte Description | Value |
|---|---|
| SOH | 0x01 |
| Command Opcode | 0x0F |
| Length LSB | 0x0B |
| Length MSB | 0x00 |
| Source address LSB | 0xXX |
| Source address | 0xXX |
| Source address | 0xXX |
| Source address MSB | 0xXX |
| Data length LSB | 0xXX |
| Data length MSB | 0xXX |
| Destination address LSB | 0xXX |
| Destination address | 0xXX |
| Destination address | 0xXX |
| Destination address MSB | 0xXX |
| Partition ID | 0xXX |
Note: Destination address should be an offset from the partition beginning.
Get QSPI controller state
| Byte Description | Value |
|---|---|
| SOH | 0x01 |
| Command Opcode | 0x10 |
| Length LSB | 0x01 |
| Length MSB | 0x00 |
| QSPI Controller ID | 0xXX |
| Byte Description | Value |
|---|---|
| Driver configured | 0x01 / 0x00 |
| Manufacture ID | 0xXX |
| Device type | 0xXX |
| Density | 0xXX |
Note: DA1459x & DA1468x support only one QSPI controller, DA1469x and DA1470x can support 2. Manufacturer ID, Device type and Density depends on connected QSPI memory.
Enable external watchdog notifying. Start square wave on QPIO pin: 15ms high state, 2s low state.
| Byte Description | Value |
|---|---|
| SOH | 0x01 |
| Command Opcode | 0x11 |
| Length LSB | 0x02 |
| Length MSB | 0x00 |
| GPIO pad | (PORT << 5) + PIN |
| GPIO level | 0x00: 3.3V, 0x01: 1.8V |
Write data directly to QSPI memory.
| Byte Description | Value |
|---|---|
| SOH | 0x01 |
| Command Opcode | 0x12 |
| Length LSB | (0x05 + N) |
| Length MSB | (0x05 + N) >> 8 |
| Verify write | 0x00 / 0x01 |
| Destination address LSB | 0xXX |
| Destination address | 0xXX |
| Destination address | 0xXX |
| Destination address MSB | 0xXX |
| Data 0 | Data byte 0 |
| … | … |
| Data n | Data byte N |
Erase whole eFLASH memory (excluding the 0x40000 - 0x40800 area).
| Byte Description | Value |
|---|---|
| SOH | 0x01 |
| Command Opcode | 0x13 |
| Length LSB | 0x00 |
| Length MSB | 0x00 |
Read data from eFLASH memory.
| Byte Description | Value |
|---|---|
| SOH | 0x01 |
| Command Opcode | 0x14 |
| Length LSB | 0x06 |
| Length MSB | 0x00 |
| Source address LSB | 0xXX |
| Source address | 0xXX |
| Source address | 0xXX |
| Source address MSB | 0xXX |
| Data length LSB | 0xXX |
| Data length MSB | 0xXX |
| Byte Description | Value |
|---|---|
| Data 0 | Data byte 0 |
| … | … |
| Data n | Data byte N |
Write data directly to QSPI memory.
| Byte Description | Value |
|---|---|
| SOH | 0x01 |
| Command Opcode | 0x15 |
| Length LSB | (0x05 + N) |
| Length MSB | (0x05 + N) >> 8 |
| Verify write | 0x00 / 0x01 |
| Destination address LSB | 0xXX |
| Destination address | 0xXX |
| Destination address | 0xXX |
| Destination address MSB | 0xXX |
| Data 0 | Data byte 0 |
| … | … |
| Data n | Data byte N |
Copy data from RAM to eFLASH memory.
| Byte Description | Value |
|---|---|
| SOH | 0x01 |
| Command Opcode | 0x16 |
| Length LSB | 0x0A |
| Length MSB | 0x00 |
| Source address LSB | 0xXX |
| Source address | 0xXX |
| Source address | 0xXX |
| Source address MSB | 0xXX |
| Data length LSB | 0xXX |
| Data length MSB | 0xXX |
| Destination address LSB | 0xXX |
| Destination address | 0xXX |
| Destination address | 0xXX |
| Destination address MSB | 0xXX |
Erase a part of the eFLASH memory.
| Byte Description | Value |
|---|---|
| SOH | 0x01 |
| Command Opcode | 0x17 |
| Length LSB | 0x08 |
| Length MSB | 0x00 |
| eFLASH address LSB | 0xXX |
| eFLASH address | 0xXX |
| eFLASH address | 0xXX |
| eFLASH address MSB | 0xXX |
| Size LSB | 0xXX |
| Size | 0xXX |
| Size | 0xXX |
| Size MSB | 0xXX |
Note: All eFLASH sectors which include given area (specified by address + size) will be erased (erase operation is sector aligned).
Check that the part of the QSPI FLASH memory is empty.
| Byte Description | Value |
|---|---|
| SOH | 0x01 |
| Command Opcode | 0x18 |
| Length LSB | 0x08 |
| Length MSB | 0x00 |
| Size LSB | 0xXX |
| Size | 0xXX |
| Size | 0xXX |
| Size MSB | 0xXX |
| Start address LSB | 0xXX |
| Start address | 0xXX |
| Start address | 0xXX |
| Start address MSB | 0xXX |
| Byte Description | Value |
|---|---|
| Number LSB | 0xXX |
| Number | 0xXX |
| Number | 0xXX |
| Number MSB | 0xXX |
Note: If Number represents positive value, than it is a number of bytes that were checked to be erased. Otherwise, it represents position of first non-empty byte multiplied by -1.
Change communication UART's baudrate.
| Byte Description | Value |
|---|---|
| SOH | 0x01 |
| Command Opcode | 0x30 |
| Length LSB | 0x04 |
| Length MSB | 0x00 |
| Baudrate LSB | 0xXX |
| Baudrate | 0xXX |
| Baudrate | 0xXX |
| Baudrate MSB | 0xXX |
Note: 'ACK' after command execution is sent using the new baudrate. This command has no effect in SWD mode. Allowed baudrates: 4800, 9600, 14400, 19200, 28800, 38400, 57600, 115200, 230400, 500000, 1000000.
Write Live marker to the data buffer.
| Byte Description | Value |
|---|---|
| SOH | 0x01 |
| Command Opcode | 0xFF |
| Length LSB | 0x00 |
| Length MSB | 0x00 |
Note: This command writes 'Live' at the beginning of the data buffer.
1.8.16