I'm having some issues with the CAN module on my SAME51J20A part, which is riding on a custom board made by me. I am using Atmel Start to generate all of my HAL code, and then executing the example code given in driver_examples.c..
Problem 1 - When transmitting a 11bit STDID packet, all zeroes are transmitted on the bus - Instead of the packet I set up with an ID of 0x45A
Problem 2 - When I send a packet to my board that matches my filter&mask, I find all zeroes in the FIFO once the RX Callback is called
What I have done and noted so far:
- Bus is set for 100kbps
- I am using the Microchip CAN bus analyzer tool to receive packets on my PC, as well as sampling the signals using my scope to verify the signal and HW integrity.
- RX Mask&Filters ARE working (If I change the ID I send, my callback isn't called)
- HW has been verified, and a packet NOT containing all zeroes makes it into the micro, yet the FIFO is full of zeroes.
- I do have FreeRTOS running on this system (Which as I am typing this, I wonder if there is a conflict on interrupts and the data is being properly transfered to my FIFOs - Although that usually results in a Hard Fault OR in an Assert failing within FreeRTOS which causes the micro to halt - Which isn't happening)
Anyone have some suggestions on debugging? - At this point, I believe I have ruled out anything HW related, and that this problem is App code related.. What worries me the most, is that the HAL actually has a bug in it.
Here is my example code:
Here is a captured of the CAN_RX pin (The net between the micro and my transceiver), showing that I am in fact sending a packet that is not all zeroes to the micro - Yet when I get to my callback, there is nothing but zeroes.
Here is a captured output of the CAN_TX pin (The net between the micro and my transceiver), showing that even though I send a packet of non zero bytes - All zeroes are transmitted on the bus.