dwm_cert_update_write

This call is available only on the ethernet gateway. It should be called repeatedly after dwm_cert_update_start to transfer the certificate until all the data chunks are transferred. Returns status “ok” followed by the data request until all the data is transferred, in which case status “ok” is returned with no data request following or until the update ends with some error. The error is indicated by a status code other than “ok”. The reasons for the failed update are:

  • internal error

  • invalid parameter - e.g. data chunk with zero length, or data chunk has been skipped

  • not permitted - not started yet, or the whole update process has failed

The size and the offset of the data already written to the flash by the update procedure so far are returned as a response on each call to dwm_cert_update_write until the update is completed.

C code example

void dwm_cert_update_write(dwm_mac_addr_list_t *mac_addr_list)
Parameters
  • input – id, data

  • id – ? 8-bit unsigned integer ? (certificate identifier, 0 - CA certificate, 1 - my certificate, 2 - my private key)

  • data – (binary data chunk of the certificate currently being uploaded, up to 128 bytes)

  • output – status_code, [offset, size]

  • offset – ? 32-bit unsigned integer? (expected offset of next data chunk)

  • size – ? 32-bit unsigned integer? (expected size of next data chunk)

SPI/UART example

TLV Request

Type

Length

Value

0x3B

0x24

offset

data chunk

0x00 0x00 0x00 0x00

0xA5 0xA5 0xA5 0xA5 0xA5 0xA5 0xA5 0xA5 …. 0xA5 0xA5 0xA5 0xA5

Type 0x3B (59 dec) means command dwm_cert_update_write

TLV Response

Type

Length

Value

type

Length

Value

0x40

0x01

0x00

0x7E

0x08

offset

size

0x00 0x00 0x00 0x00

0x00 0x10 0x00 0x00

Type 0x40 means status code
Type 0x7E (126 dec) means data request