Simple FlexCAN receive example using RTDs

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Simple FlexCAN receive example using RTDs

2,514 次查看
hns80
Senior Contributor I

After verifying the FlexCAN_Ip_Example_S32K344 example can reach the end of the code, I modified it from loopback to Normal mode and assigned the pins to the CAN transceiver.

I then verified the message was transmitted correctly onto the CAN bus using a bus analyzer.

I removed the call to FlexCAN_Ip_Send() and tested again, this time using the CAN bus analyzer to transmit an 8 byte message to CAN ID 0x14. I expected to see FlexCAN_Ip_GetTransferStatus() succeed, but it never sees the message. I can see the message data reaching the CAN RX pin on the micro.

Is there anything else in the example that needs to change to successfully receive a CAN message?

 

0 项奖励
回复
3 回复数

2,488 次查看
hns80
Senior Contributor I

I tried to convert this example to use CAN1 instead of CAN0 but get a hard fault at line  FlexCAN_Ip_ConfigEnhancedRxFifo_Privileged(INST_FLEXCAN_1, &CAN1_EnhanceFIFO_IdFilterTable[0]);

I changed the following declarations INST_FLEXCAN_0, FlexCAN0_1_IRQn, flexCAN0_Callback, FlexCAN_Config0 to all use FlexCAN1 instead of FlexCAN0. I also updated the payload to use 8 bits instead of 64 bits.

What else do I need to change to make this work with CAN1?

Screenshot 2023-02-02 165750.png

0 项奖励
回复

2,463 次查看
PetrS
NXP TechSupport
NXP TechSupport

Hi,

enhanced RXFIFO is only available on FlexCAN0, so most probably the hard fault comes from this, accessing reserved space.

PetrS_0-1675680028258.png

BR, Petr

 

0 项奖励
回复

2,495 次查看
PetrS
NXP TechSupport
NXP TechSupport
0 项奖励
回复