MQX and CAn: Be notified when remote frame received

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MQX and CAn: Be notified when remote frame received

Jump to solution
694 Views
arnogir
Senior Contributor II

Hello

I'm using a K70 on MQX 4.1.

With the FLEXCAN MQX driver, I made the following configuration (exemple)

_bsp_flexcan_io_init(0); FLEXCAN_Softreset(0); FLEXCAN_Initialize(0,0,0,125,FLEXCAN_IPBUS_CLK); FLEXCAN_Select_mode(0,FLEXCAN_NORMAL_MODE); FLEXCAN_Start(0);

FLEXCAN_Initialize_mailbox(0,9, 0x701, 2, FLEXCAN_TX, FLEXCAN_STANDARD, FLEXCAN_ENABLE); FLEXCAN_Activate_mailbox(0, 9, FLEXCAN_MESSAGE_TRANSMIT_ONCE);

Result = FLEXCAN_Install_isr(0, 9, MyITCallBAck);

Then after than, wth my IXXAT I send a  remote frame with ID = 0x701. ECU response with a frame of 2 Bytes.

Isr call my callback and because I configured an Rx buffer I have the Rx notification.

But How to be notified then remote frame was sent really? (Tx confirmation)

Because I need to be notified to update frame data by calling FLEXCAN_Update_message.

Thank

0 Kudos
1 Solution
380 Views
arnogir
Senior Contributor II

Hello

I come back here to post the solution what I found.

In fact, we absolutly wait the end of the transmission of the last frame before ask new transmission (No Hardware transmission Fifo)...

View solution in original post

0 Kudos
3 Replies
380 Views
soledad
NXP Employee
NXP Employee

Hello Arnaud,

In my opinion you need to use FLEXCAN_MESSAGE_TRANSMIT_RESPONED instead FLEXCAN_MESSAGE_TRANSMIT_ONCE

in addition you can use the return value for the notification FLEXCAN_OK this mean the remote frame was send.

Something like:

result= FLEXCAN_Activate_mailbox(0, 9, FLEXCAN_MESSAGE_TRANSMIT_RESPONED);
if (result==FLEXCAN_OK)

{

...

}...


Have a great day,
Sol

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
380 Views
arnogir
Senior Contributor II

Ok,  Thank for these information.

No I have a problem on Master side.

On CanOpen, The master must send a remote Network life frame on each slave.

do this, it must send periodiccaly a Remote frame to each slave with a different ID.

ex: Send a Remote frame on 0x702 for the slive which nodeID = 2 and also send frame on 0x703 for the slave nodeID = 3.

So I have the following code (simplified)

At init time:

Result = FLEXCAN_Initialize_mailbox(0, 12, 0x700, 0, FLEXCAN_TX, FLEXCAN_STANDARD, FLEXCAN_ENABLE);

In RuneTime when I want sent NM CAN frame to each slave (0x702 and 0x703):

ReturnValue = FLEXCAN_Activate_mailbox(0, 12, FLEXCAN_TX_MSG_BUFFER_NOT_ACTIVE); ReturnValue |= FLEXCAN_Tx_message(0, 12, 0x702, FLEXCAN_STANDARD, 0, MyDummyDataPtr);

ReturnValue = FLEXCAN_Activate_mailbox(0, 12, FLEXCAN_TX_MSG_BUFFER_NOT_ACTIVE); ReturnValue |= FLEXCAN_Tx_message(0, 12, 0x703, FLEXCAN_STANDARD, 0, MyDummyDataPtr);

But the problem is the 0x703 frame is not sent (I supposed is because the first was not yet entierly transmitted?)

0 Kudos
381 Views
arnogir
Senior Contributor II

Hello

I come back here to post the solution what I found.

In fact, we absolutly wait the end of the transmission of the last frame before ask new transmission (No Hardware transmission Fifo)...

0 Kudos