CAN issue in K60

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

CAN issue in K60

1,580 Views
akhil
Contributor III

Hi all,

We have some issues in data transmission via CAN module. During long run, some data packets are missing. That is, sometimes the data reception/transmission is failing.

Other details are given below:

Controller: K60

OS: MQX 4.0.2

Scheduling: FIFO

CAN RX and TX task priority : 7

Main Task Priority: 9

Other tasks Priority: 8

Same ISR for both TX and RX.

Note: We are transmitting large amount of data via CAN.

We have noticed, FLEXCAN_Tx_message function unlocks the message buffer( temp16 = can_reg_ptr->TIMER ) . But in data sheet it is documented that "the locking mechanism only applies to Rx MBs". Is there any issue with this implementation?

Also we have noticed that the priority value of CAN RX/TX ISR(retrieved using the function _task_get_priority ) is same as that of the main task. So we would like to know the priority value, if there any, of the ISR. Is priority difference causing the CAN issue?

Please share your comments on this random CAN issue. We would like to figure out the root cause of this CAN issue ASAP. Please help us.

Tags (4)
0 Kudos
Reply
7 Replies

1,083 Views
soledad
NXP Employee
NXP Employee

Hello,

Could you please check the below thread?

Buffering CAN RX Messages - Missing Messages When TX Flow Control

Please let me know if this helps!!!


Have a great day,
Sol

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

0 Kudos
Reply

1,083 Views
akhil
Contributor III

Hi,

We already integrated the patch mentioned in the above link. But the issue is still there. 

0 Kudos
Reply

1,083 Views
akhil
Contributor III

Dear Sol,

Please help us on this issue.

0 Kudos
Reply

1,083 Views
soledad
NXP Employee
NXP Employee

Hello,

Sorry for my delay.

The MQX FlexCAN driver doesn't enable FlexCAN hardware module receive fifo.

Thus, software shall read each incoming message with a small latency, move it from the Rx Message Buffer into memory, otherwise new incoming message will be lost or overwritten.

The FlexCAN hardware module supports features like Rx FIFO (for up to 8 incoming CAN messages) or Rx Queue, none of these features is enabled in the MQX FlexCAN driver.

If you wish to use MQX FlexCAN software driver, I recommend to keep Rx interrupts enabled, and move the received data from Message buffer to a memory as quickly as possible. You can buffer the data in memory and process them by a task once per 1 sec if you wish, but moving data between Message Buffer and memory should be active all the time.


Have a great day,
Sol

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

0 Kudos
Reply

1,083 Views
akhil
Contributor III

Dear Sol,

We have sniffed the CAN packets using CAN analyzer and observed that, the message identifier changed to 0(expected is 242) , which is unexpected.

Here transmitter is a device with K10(K20 BSP) controller and receiver is a K60 device. Seems the issue with the CAN driver or micro controller. Is there any workaround to fix this issue.?

canissue.jpg

0 Kudos
Reply

1,083 Views
akhil
Contributor III

Dear Sol,

Is the Chip errata discussed in the below link applicable here?

can: flexcan: implement workaround for errata ERR005829 (a6cdbaec) | Commits | Andrea Scian / linux-...

MASK k60 :  3N96b

MASK k10 :  2N36b

0 Kudos
Reply

1,083 Views
akhil
Contributor III

Dear Sol,

We already enabled the receive interrupt and have a dedicated task to read data from the RX buffer. Here we are using events for the communication(to sync/signal) between interrupt handler and receive task. But the issue still exists.

It seems that sometimes receive/transmit interrupts are missing. Do the _int_disable()..._int_enable() function calls in other drivers cause any issue in the CAN interrupts?

Thanks

Akhil

0 Kudos
Reply