CAN: Is there a choice between interrupt and polling mechanisms for receiving a CAN message? If yes, how does it work with the FIFO mechanism?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hi there,

   

 

   

I am wondering whether there is a choice between an interrupt and a polling mechanism for receiving a CAN message.

   

All examples I found imlement the reception of a message with the automatically generated interrupt routines.

   

Is polling also possible? Therefore I could imagine polling mechanism in the main routine, which checks the CAN_RX_ACK_MSG bit in the CAN_RX[mailboxID].rxcmd register, which signalizes the receipt of a new message, right? If that is the case, lets consider the use of Full CAN mailboxes with FIFO functionality. Can I somehow release a mailbox/message to let it receive a new message or to let a message drop from the beginning of the FIFO?

   

 

   

Thanks in advance!

0 Likes
2 Replies
ShopithamR_26
Employee
Employee
25 replies posted 10 replies posted 5 replies posted

Hi,

   

I dont think it is possible to do polling in the CAN .  I checked registers in CAN to see if there is any registers that will be set when msg is transmitted or received . There are no such register expect for the CAN_CSR_INT_SR register . This is interrupt status register for CAN . In order to update this register you have to enable the Interrupts in the CAN Component .

   

You have to use interrupt only .

   

-sobi

0 Likes
Anonymous
Not applicable

No, I think it is possible since I recently discovered the register CAN[0..]_CSR_BUF_SR which contains flags for message receiption and transmission. I also saw it in use in the generated source files of a can controller in the function CAN_MsgRXIsr. I already made a test that realized a polling based on this.

   

However, this test still behaves strange, since I'm using linked mailboxes and I don't really understand the FIFO mechanism (see my other post: https://secure.cypress.com/?app=forum&id=2233&rID=103811)

0 Likes