AnsweredAssumed Answered

What setup step am I missing for bxCAN on STM32F302?

Question asked by Shane Snover on Mar 25, 2018
Latest reply on Mar 26, 2018 by Shane Snover



I'm currently writing a bare metal CAN driver for the STM32F302. I'm struggling to get transmission working at the moment. I've been reading through the HAL source as a double check and I can't seem to locate the detail I'm missing nor can I find the missing element in the reference manual chapter.


Here's where I'm at: I've configured the RCC for CAN and GPIOB (as well as all the GPIO settings), the bit timing and frequency (250 kbps if it matters), enable loopback in hardware, and set the peripheral to Normal mode (I've verified this by checking the INAK and SLAK bits in the MSR). 


Then I initiate a transmission by first checking that mailbox 0 is empty, clearing the transmit request bit, loading my data into the mailbox, and then setting the transmit request bit. I check the ESR register for errors and I'm not getting any. On subsequent calls, I verify that the bit signifying that mailbox 0 is no longer empty is now cleared meaning there is data pending transmission.


However, data never sends. I'm monitoring the CANTX pin on a logic analyzer and the pin is pulled high, but never changes. I do not have a bus with a second node connected, but I do not know if this matters if the peripheral is in loopback mode. I've been struggling with this for quite some time, if anyone viewing this needs more information I'll gladly give it.