S32K310 CAN Interrupt Receive

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

S32K310 CAN Interrupt Receive

Jump to solution
2,120 Views
Embedded_novice
Contributor III

我使用CAN以及CANIF配置了S32K310的CAN驱动模块。我知道调用CAN_Write()函数进行报文的发送,但我存有以下的一些问题:

1.我该如何进行报文的接收呢?我看到有一些文章说能够通过CanIf_RxIndication()函数进行接收。但是这个函数在静态代码中的逻辑应当是自动调用,而不是由我在外部主程序中调用。或者说这个函数在触发中断自动执行后将数据进行了存储,那我该如何将这些数据读取出来呢?我是否能用自己编写的回调函数去替换他?(我在MCAL的例程中没有找到使用中断的CAN例程,似乎只有POLLING模式的例程)CAN.png

2.为什么CAN的接收一定要通过CANIF而发送却可以直接由CAN驱动发出?这是否有一些规范限制我必须这样做。

感谢帮助!!

0 Kudos
Reply
1 Solution
2,097 Views
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @Embedded_novice,

1. You can look at the following training for some information on how FlexCAN works with the drivers: FLEXCAN WITH RTD AND LOW-LEVEL DRIVERS. In order to receive messages in interrupt mode, you must configure the interrupt driver (IntCtrl) and select polling = FALSE inside the FlexCAN data info structure and use "FlexCAN_Ip_Receive".

You can use this example from community post as guidance: Example S32K344 FlexCAN_Ip TX/RX/EnhanceRXFIFO DMA test S32DS3.5 RTD400 - NXP Community.

2. I imagine you are referring to the CanIf_RxIndication API? As I said in the previous response, you can use FlexCAN_Ip_Receive instead.

Best regards,
Julián

View solution in original post

0 Kudos
Reply
1 Reply
2,098 Views
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @Embedded_novice,

1. You can look at the following training for some information on how FlexCAN works with the drivers: FLEXCAN WITH RTD AND LOW-LEVEL DRIVERS. In order to receive messages in interrupt mode, you must configure the interrupt driver (IntCtrl) and select polling = FALSE inside the FlexCAN data info structure and use "FlexCAN_Ip_Receive".

You can use this example from community post as guidance: Example S32K344 FlexCAN_Ip TX/RX/EnhanceRXFIFO DMA test S32DS3.5 RTD400 - NXP Community.

2. I imagine you are referring to the CanIf_RxIndication API? As I said in the previous response, you can use FlexCAN_Ip_Receive instead.

Best regards,
Julián

0 Kudos
Reply