mirror of https://github.com/ARMmbed/mbed-os.git
STM32: CAN: do not overwite BTR register when setting frequency
BTR register has other bits than the ones calculated and set through the can_speed function, so let's take care to only write to the right registers.pull/4932/head
parent
759642af8e
commit
57222b604f
|
|
@ -211,7 +211,11 @@ int can_frequency(can_t *obj, int f)
|
|||
}
|
||||
}
|
||||
if (status != 0) {
|
||||
can->BTR = btr;
|
||||
/* Do not erase all BTR registers (e.g. silent mode), only the
|
||||
* ones calculated in can_speed */
|
||||
can->BTR &= ~(CAN_BTR_TS2 | CAN_BTR_TS1 | CAN_BTR_SJW | CAN_BTR_BRP);
|
||||
can->BTR |= btr;
|
||||
|
||||
can->MCR &= ~(uint32_t)CAN_MCR_INRQ;
|
||||
/* Get tick */
|
||||
tickstart = HAL_GetTick();
|
||||
|
|
|
|||
Loading…
Reference in New Issue