Understanding flexcan callback/FIFO

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Understanding flexcan callback/FIFO

1,273件の閲覧回数
pb632146
Contributor V

I am trying to convert my canbus code so that instead of transmitting data constantly using sendblocking it waits to receive a message and then sends out data based on the message received. 

pb632146_1-1734436716453.png

 

I have this sample callback data from elsewhere example code, and am trying to understand how to utilize it properly. As it is written in this example when it finishes a receive command and writes the frame into rxData, it will then raise the  "rx_complete" event and start another receive. Does this event still get raised even if the send/read returns an error/non success?

Similarly with sending, since the send would raise a tx complete callback it would then start an infinite loop of sending the same data over and over? as itd send, raise "tx_complete" then send again?

 

So to return to the original goal of transmitting specific data based on the id received, I would want to place a function call within the rx_complete event case that would handle the parsing of the id, send the data off, and in the tx callback for a completed send I would call a receive to wait for its next request? I made a very basic block diagram to illustrate the intention does this make sense for how to use the callback functions?

pb632146_5-1734438267100.png

 

 

 

However if I only use one rx MB then there is no buffer correct? So if I receive too many frames too quickly then data can be lost? Which then leads into using the fifo instead as it can hold onto up to 6, and the procedure is the same as receive just that it reads the buffer instead of the waiting for a new frame?

pb632146_0-1734436684763.png

However the fifo says it uses message buffer 0, but the example canbus code provided  by Can_Example_S32K344 uses id 0 as the TX mb so what happens there? 

pb632146_2-1734437132683.png

Does the buffer initialize with the rest of the canbus or is there anything extra I need to do for it.

0 件の賞賛
返信
3 返答(返信)

666件の閲覧回数
il_ciancio
Contributor IV

Hi @pb632146,

did you understand something more about the CBK? I am looking also to the ID received in the context of the cbk.

 

Thanks!

0 件の賞賛
返信

1,254件の閲覧回数
pb632146
Contributor V
Is message buffer the same as mailbox in this, they seem to be used somewhat interchangeably in the user manual? Do they have any buffer to them or does each mailbox/MB only individually hold one message at a time and splitting them up is how you manage multiple things coming in at once?

How do you manage id filtering with them? Is that what rxmask type is for?
0 件の賞賛
返信

1,250件の閲覧回数
pb632146
Contributor V
If I have multiple mailboxes set to receive all ids or masked to receive certain ids, will it automatically see that one is full/busy and place the message into the next available mailbox?

0 件の賞賛
返信