CAN SPI Help/Confusion

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 8.

Moderator: Benj

Post Reply
User avatar
QMESAR
Valued Contributor
Valued Contributor
Posts: 1287
Joined: Sun Oct 05, 2014 3:20 pm
Location: Russia
Has thanked: 384 times
Been thanked: 614 times
Contact:

CAN SPI Help/Confusion

Post 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 2013 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 2013 times
Thank a million as always :D

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: CAN SPI Help/Confusion

Post 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

User avatar
QMESAR
Valued Contributor
Valued Contributor
Posts: 1287
Joined: Sun Oct 05, 2014 3:20 pm
Location: Russia
Has thanked: 384 times
Been thanked: 614 times
Contact:

Re: CAN SPI Help/Confusion

Post by QMESAR »

Leigh.

Thank you very much ,understood :D

Post Reply