S32K146 CAN Tx: Error and Status 1 register (ESR1)

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

S32K146 CAN Tx: Error and Status 1 register (ESR1)

Jump to solution
2,930 Views
john24
Contributor III

Hello,

Our target board is S32K146 based, and we have a general question:

  • In the event of Error and Status 1 register, IDLE (bit 7), is not set (zero), should our firmware still go ahead and invoke 
    FLEXCAN_DRV_ConfigTxMb followed by 
    FLEXCAN_DRV_Send (or
    FLEXCAN_DRV_SendBlocking)?
     
    Thank you.
Tags (2)
0 Kudos
Reply
1 Solution
2,790 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@john24

I think you have a misunderstanding here. 

The IDLE of ESR1 only indicates that the current CAN bus is in the IDLE state, there is no relationship between the status of IDLE and your call "FLEXCAN_DRV_SendBlocking".

Even if the current CAN BUS is not in the IDLE state, you can still call "FLEXCAN_DRV_SendBlocking", the move-out mechanism iscompleted by FLEXCAN IP layer and does not require you to do anything.

 

After you call FLEXCAN_DRV_SendBlocking you need to call FLEXCAN_DRV_GetTransferStatus to determine whether the sending is completed.

View solution in original post

0 Kudos
Reply
8 Replies
2,909 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@john24

I'm sorry that I didn't understand your question, maybe you can describle your question in detail in Chinese.

0 Kudos
Reply
2,901 Views
john24
Contributor III

Hi Senlent,

Basically, when reading the S32K RM, we see bit 7 of the ESR1 register documented as:

IDLE

This bit indicates when CAN bus is in IDLE state. See the table in the overall ESR1 register description.
0b - No such occurrence.
1b - CAN bus is now IDLE.

Could you please explain what "0b - No such occurrence" means?

Thank you.

 

0 Kudos
Reply
2,861 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@John24

当前CAN bus状态不处于空闲状态

Senlent_0-1708912864965.png

 

0 Kudos
Reply
2,847 Views
john24
Contributor III

Thank you, Senlent, and please feel free to respond in Chinese. I can read it without problems, but to input Chinese would be difficult on my computer here.

So, when the IDLE bit is 0, is it recommended to call any S32K API (e.g. FLEXCAN_DRV_Send, or FLEXCAN_DRV_SendBlocking) in our firmware, to transmit a packet to the CAN bus?

Please let me know. Thanks!

0 Kudos
Reply
2,828 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@john24

you can use FLEXCAN_DRV_GetTransferStatus to get the status of the currently used MB to determine whether the reception or transmission was successful.

for example:

Senlent_0-1708998934021.png

This is a routine for CAN interrupt transmission and reception and shows you how to configure the mask, this may be helpful for you to learn the FLEXCAN module.

https://community.nxp.com/t5/S32K-Knowledge-Base/S32K1xx-FlexCAN-Mask-Setting-Demo/ta-p/1519753

 

0 Kudos
Reply
2,800 Views
john24
Contributor III

Hi Senlent,

Our question is actually simple: When FLEXCAN_DRV_GetErrorStatus returns the register ESR1 status with IDLE bit set to 0, can we still call FLEXCAN_DRV_SendBlocking to send a data packet on the CAN bus? Or, we will have to wait until the IDLE bit becomes 1 first?

Thank you!

0 Kudos
Reply
2,791 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@john24

I think you have a misunderstanding here. 

The IDLE of ESR1 only indicates that the current CAN bus is in the IDLE state, there is no relationship between the status of IDLE and your call "FLEXCAN_DRV_SendBlocking".

Even if the current CAN BUS is not in the IDLE state, you can still call "FLEXCAN_DRV_SendBlocking", the move-out mechanism iscompleted by FLEXCAN IP layer and does not require you to do anything.

 

After you call FLEXCAN_DRV_SendBlocking you need to call FLEXCAN_DRV_GetTransferStatus to determine whether the sending is completed.

0 Kudos
Reply
2,762 Views
john24
Contributor III

Thank you Senlent, for confirming that even if the IDLE bit in ESR1 is indicating the CAN bus not in the idle state, the SDK API calls can still be made in our firmware, to transmit CAN packets.

0 Kudos
Reply