Hi, I'm developing an CAN to USB converter, this converter needs to change the baud rate of the CAN when the user sends an determined message via UART.
The Prescaler, TimeSeg1, TimeSeg2 are all configured correctly for the baud rate I desire, as example:
hcan.Init.Prescaler = 100;
hcan.Init.TimeSeg1 = CAN_BS1_15TQ;
hcan.Init.TimeSeg2 = CAN_BS2_2TQ;
In the example above, I choose the baud rate to be in 20kbps, when the command is sent the values are correctly stored, but checking with the osciloscope I noticed that the baud rate didn't change.
The steps that im using are:
HAL_CAN_Stop(&hcan);
HAL_CAN_MspDeInit(&hcan);
hcan.Init.Prescaler = 100;
hcan.Init.TimeSeg1 = CAN_BS1_15TQ;
hcan.Init.TimeSeg2 = CAN_BS2_2TQ;
HAL_CAN_MspInit(&hcan);
HAL_CAN_Start(&hcan);
Is there something that I'm missing with this routine?
Values in hcan before sending the baud rate change

Values of hcan after sending baud rate change
