Description
u8_get_listen_only()
allows to read the mode in which the bootloader will start the CAN bus (MCAN0) at start up. If ‘true’ then the bootloader will initialise the first CAN bus (MCAN0) at start-up in listen only mode. The CAN bus will not drive any dominate states in this mode. If this setting is ‘false’ then the CAN bus will be started in normal operation mode. default value: false
Syntax
u8_get_listen_only();
Parameters
none
Returns
uint8_t: bus will be started in
0: normal (active) operation mode
1: listen only mode
Example Code
This example shows how to set, read and store the ‘listen only’ value of the bootloader settings.
void setup()
{
Serial.begin();
while (!Serial)
{
yield(); // wait for PC CAN2SER-monitor to open
}
Serial.print(" - listen only: ");
if( BOOTLOADER_SETTING.u8_get_listen_only() )
Serial.print("YES");
else
Serial.print("NO");
delay(2000);
Serial.println("");
Serial.println("Modify the settings");
BOOTLOADER_SETTING.u8_set_listen_only(false);
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
The listen only mode prevents the device to block the CAN bus in case of a wrong setting of the baud rate. However, remember that the CAN bus always needs at least two active nodes to establish communication. A CAN message remains on the bus until it is confirmed by at least one communication partner.