Page 1 of 1

CAN SPI Help/Confusion

Posted: Tue Jun 12, 2018 12:31 pm
by QMESAR
Hi Team.
Please help me understand the MCP2515 CAN Components from the help file in my understanding is that once you know that you have a message in a buffer you have to read the Received Data bytes one by one out with a GetRxData Call is this correct ,It seems I have to do 8 Read to get the 8 data CAN bytes. I do not see any component call that read the complete buffer at once.
1.jpg
1.jpg (34.63 KiB) Viewed 2215 times
Another Confusion is that there is 2 RX Buffers and on a High Bus load we should check both buffers if any valid Message has been received this I do in a loop checking for the buffers if it has a message then read out the ID and then select which message it was with a case structure however now the GetRxData component ignores the Buffer ,So how does this component now know that buffer 1 has data and I read the ID from Buffer 1 and I want to read the data bytes from buffer 1

Please can you help me understand this as my mcu runs on a Bus with a few CAN messages :D
2.jpg
2.jpg (70.64 KiB) Viewed 2215 times
Thank a million as always :D

Re: CAN SPI Help/Confusion

Posted: Tue Jun 12, 2018 12:58 pm
by LeighM
once you know that you have a message in a buffer you have to read the Received Data bytes one by one out with a GetRxData Call is this correct
Yes
So how does this component now know that buffer 1 has data and I read the ID from Buffer 1 and I want to read the data bytes from buffer 1
The component copies the data bytes into device storage when CheckRx is called.
So it is best to call GetRxData, to read this data, immediately after CheckRx returns true

Even though GetRxData ignores the Buffer number, it is best to pass this to all macros,
such as GetRxIdent, as there are some differences between use with external or internal CAN

Re: CAN SPI Help/Confusion

Posted: Tue Jun 12, 2018 1:24 pm
by QMESAR
Leigh.

Thank you very much ,understood :D