Question
Bug in CAN_TransmitStatus function?
Posted on June 10, 2013 at 23:31
I noticed something strange with the CAN_TransmitStatus function in the stm32f10x_can.c (V3.1.2) peripheral driver code. Most of the time it works fine but occasionally it returns the wrong status. The root cause is it’s reading the CANx->TSR register multiple times when updating “state�?. If that register changes between reads, the logic based on “state�? becomes corrupt. The correct way to do this is to first capture CANx->TSR in a local variable then test that value.
