Description
u16_get_can_send_id()
returns the CAN identifier that the bootloader and the CAN2SER instances (e.g. Serial) will use to send messages on the CAN bus. default value: 0x766.
Syntax
u16_get_can_send_id();
Parameters
none
Returns
uint16_t – the standard (11 bit) ID of messages this device sends on the bus.
Example Code
This example shows how to read, set and store the ‘can send id’ value of the bootloader settings.
void setup()
{
Serial.begin();
while (!Serial)
{
yield(); // wait for PC CAN2SER-monitor to open
}
Serial.println("Current bootloader settings:");
Serial.print(" - can send id: 0x");
Serial.println(String( BOOTLOADER_SETTING.u16_get_can_send_id(), HEX ));
delay(2000);
Serial.println("Modify the settings");
BOOTLOADER_SETTING.u8_set_can_send_id(0x766);
delay(2000);
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");
Serial.println("DONE");
}
void loop ()
{
}
Notes and Warnings
This method returns the RAM copy value of the bootloader settings which are copied into the BOOTLOADER_SETTING object during its instantiation at system start (variant.cpp).
Each device must use a unique CAN ID on the same CAN bus. This means that this ID might need to be customised if there are more than one dice device connected to the bus or in cases where the identifier is already in use by another node. If you change this ID it would be recommendable to also change the local ID (LID) accordingly. Find addressing details and recommended settings here and in theĀ users manual.
See also
u8_store_bootloader_settings()
u16_get_can_listen_id()
SAMC21_CAN
u8_set_local_id()
u8_set_can_send_id()
device addressing