Changing CAN baudrate at runtime

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Hans_
Level 1
Level 1
10 sign-ins First like received First question asked

Under DAVE 4.4.2 I tried unsuccessfully to change the CAN baudrate with: "CAN_NODE_ConfigBaudrate()".

It turned out that the struct:

static const XMC_CAN_NODE_NOMINAL_BIT_TIME_CONFIG_t CAN_BUS_1_BitTimeConfig = {
   .can_frequency = (uint32_t)1.44E8,
   .baudrate = (uint32_t)(250 * 1000),
   .sample_point = (uint16_t)(80 * 100),
   .sjw = (uint16_t)1
};

from the file "can_node_conf.c" was created in Flash,
and therefore could not be changed at runtime.

After changing to:
"static XMC_CAN_NODE_NOMINAL_BIT_TIME_CONFIG_t CAN_BUS_1_BitTimeConfig = {.."
(without "const"),

the struct was created in RAM,
and I was able to change the baudrate with "CAN_NODE_ConfigBaudrate()".

Best Regards,
Hans

1 Reply
Alakananda_BG
Moderator
Moderator
Moderator
50 likes received 250 sign-ins 250 replies posted

Hi @Hans_ ,

Thank you for sharing us the information as of how to change the baud rate of CAN during runtime.

Regards,

Alakananda
0 Likes