hey guys, I fixed the issue with the system entering Bus Off mode by enabling automatic recovery on the AVR128DA48 microcontroller. Now, the controller automatically recovers after detecting 128 consecutive error-free frames. To make sure it works smoothly, I also added a backup that manually resets the CAN controller if the automatic recovery doesn’t kick in.
Here’s the updated error handling code: