CAN PSR register - RX Flag Stuck After FIFO Count Is Update

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

CAN PSR register - RX Flag Stuck After FIFO Count Is Update

1,021件の閲覧回数
chellapandi_1603
Contributor I

Hello everyone,

I'm working on a CAN implementation with external time stamping in microseconds and using a 16-bit timer for the timestamp source. Here's the setup and issue I'm encountering:

System Setup:

  • CAN controller with external timestamp source (16-bit, in µs).

  • On every received CAN frame, I read the external timestamp and combine it with the system time to get a full timestamp.

  • I handle timer overflow using a timer wrap callback, where I log the system time when the 16-bit timer wraps.

  • FIFO mode is enabled, and I track frames using RXF0S . F0GI and F0FL.

Observations

  • I check PSR.RX , FIFO count and index in timer wrap call back , FIFO count Is updated but PSR . RX Flag Is Not Clear.

  • There is no FIFO overrun (RF0L flag is not set).

  • System is not losing frames, and FIFO seems to update correctly.

  • However, PSR.RX doesn't clear even though no actual frame is being received at that moment.

My Questions:

  1. Under what exact conditions and time does PSR.RX clears?

  2. Is it safe to rely on PSR.RX to determine whether a frame is being received?

Additional Info:

  • The goal is to synchronise CAN frame timestamps to a system clock using the external µs timer and timer wrap handling.

  • I read:

    • FIFO count (F0FL)

    • FIFO index (F0GI)

    • PSR register

  • Will use those registers to determine the timing of old and current frames.

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

996件の閲覧回数
Harry_Zhang
NXP Employee
NXP Employee

Hi @chellapandi_1603 

May I ask which chip you are using?

BR

Harry

0 件の賞賛
返信

990件の閲覧回数
chellapandi_1603
Contributor I

Hi @harry,

Thanks for the response!

I'm using the LPC55S16 microcontroller, and the CAN interface is configured with the MCAN peripheral from the NXP SDK V2.15.000.

I’ve enabled external timestamping in microseconds (16-bit timer), and I'm syncing it with system time on frame receive and timer overflow. The issue I'm seeing is with the PSR.RX flag staying high even after FIFO count is increased.

Let me know if you need more details about my CAN setup or how I’m handling interrupts and timestamps.

Best regards,
chellapandi N

0 件の賞賛
返信

942件の閲覧回数
Harry_Zhang
NXP Employee
NXP Employee

Hi @chellapandi_1603 

Sorry, i checked the Protocol status register(RSR) in LPC55s1x RM.

Harry_Zhang_1-1748500118353.pngHarry_Zhang_2-1748500141738.png

 

But i didn't find the RX bit.

BR

Harry

0 件の賞賛
返信

887件の閲覧回数
chellapandi_1603
Contributor I

Hi @harry,

You're absolutely right — I double-checked the PSR register and realized I misinterpreted the status earlier.

The flag I was referring to is actually the ACT[4:3] bits (Activity field).
In my case, it was showing value 0x2, which indicates "receiver active".

Best regards,
Chellapandi N

0 件の賞賛
返信

682件の閲覧回数
chellapandi_1603
Contributor I

Just checking if anyone has insights on the ACT bits in PSR and how reliable they are for detecting CAN reception status, especially in relation to FIFO and timestamping logic. Any help would be appreciated!

0 件の賞賛
返信