u8_set_reset_message() allows you to customise the CAN reset message. If this messaged is received and addressed to the device (by its LID – local id) then it will trigger a system reset. This allows the engineer to reset the device and to put it into bootloader mode without the need to manually do a power cycle.
The function writes 6 bytes from the array pointed to by ‘opu8_new_reset_msg‘ to the current local (ram) copy of the bootloader settings.


u8_set_reset_message( opu8_new_reset_msg );


uint8_t* opu8_new_reset_msg: a pointer to an array of uint8_t (size 6 bytes).
default {‘R’, ‘E’, ‘S’, ‘E’,’T’,’\0′}


uint8_t return value meaning:
0 – setting changed (accepted).

Example Code

This example shows how to read, set and store the ‘reset message’ of the bootloader settings.

void setup()
  while (!Serial) 
    yield(); // wait for PC CAN2SER-monitor to open 

  uint8_t au8_tempString[6];
  Serial.print(" - reset msg:       ID 0x");
  Serial.print(BOOTLOADER_SETTING.u16_get_can_listen_id(), HEX);
  Serial.print(" DLC:8 - ");
  Serial.print((BOOTLOADER_SETTING.u8_get_local_id() << 2), HEX);
  Serial.print(" 0x07");
  for(int i=0; i < 6; i++)
	Serial.print(" 0x");
	Serial.print(((char)au8_tempString[i]), HEX);
  Serial.println("Modify the settings");
  uint8_t au8_newResetMsg[6] = {'R','E','S','E','T','\0'};
  Serial.println("Store the settings in flash");
  uint8_t u8_ret = BOOTLOADER_SETTING.u8_store_bootloader_settings();
  if(u8_ret != 0)
	Serial.println("Error writing into flash");

void loop () 

Notes and Warnings

The reset message consists of more than the bytes that are set above. It also contains information about the addressed device or if it is a broadcasting message, respectively. Also, the device apparently only accepts reset messages from the CAN-ID it is listening on. Find further details in the users manual.
It should normally not be necessary to change the reset message. The default message is what the tools (e.g. diceConfig, diceFlash, CAN2SER monitor) and libraries would work with.

Don’t forget to call the function u8_store_bootloader_settings() to write the changed settings into flash, so that the bootloader (and app.) has the new values at the next system start / reset.

See also

Device addressing