STM32H743 CANBus TX Timing
Hi all, I have what's probably a niche problem but a problem (seemingly) nonetheless. I'm making a CANBus application that I'd like to use DAR (Disable Auto-Retransmit) mode for. I'm running into an issue where, after a certain amount of time while the only node on the bus (so each TX ends in an ACK error), the CAN peripheral will stop handling TX requests made through FDCAN_TXBAR (the last-queued message never goes out the wire) and no further IRQs occur.
I'm using just a single TX buffer (no queue or FIFO, just the one buffer). I've been probing the bus using a Saleae logic analyzer, and I've found an interesting thing about the timing of the CAN peripheral. A message will go out, the ACK error will occur near the end, and the peripheral will inject its own error frame (6 dominant or recessive bits in a row (depending on pre- or post-error passive mode activation) followed by 8 error delimiter bits and 3 IFS bits). All of that is expected. However, somewhat unexpectedly, when I toggle a GPIO at the beginning of the CAN IRQ to debug the timing, I notice the interrupt fires only a few bits into the error frame's initial 6 bits (nearly immediately after the ACK didn't occur).
This doesn't necessarily spell any doom yet, but I've noticed that if I let my application immediately send another message before the error delimiter and IFS bits are finished elapsing, I can get the CAN peripheral to go into the state I mentioned, where it stops sending out messages queued and requested using FDCAN_TXBAR. If I wait -- say, 1 millisecond -- before setting the bit in FDCAN_TXBAR, I can send thousands of messages in a row without any issues. After those thousands of requests, if I let my application randomly _not_ wait the 1-millisecond delay, the CAN peripheral goes into its not-sending state.
Is this a known thing with the STM32H7 (or broader) CAN peripheral? Is there something somewhere that says I have to manually wait for those bits to elapse before performing a subsequent FDCAN_TXBAR request? Or maybe a configuration somewhere that I missed that controls the timing of when the IRQ fires?
Thanks!