How to send a Can2.0b message using FlexCAN_Ip_Example

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

How to send a Can2.0b message using FlexCAN_Ip_Example

2,295 次查看
pb632146
Contributor V

I am trying to convert the FlexCan example to be able to send and receive externally, I found from another post

https://community.nxp.com/t5/S32K/Porting-FlexCan-example-from-344-to-342/m-p/1986161/highlight/fals...

 

that I need to convert to normal mode, but taking the code from there still does nothing, I am trying to use my own transceiver I have connected to pins 90 and 91 which I have set in the pins, but sending isn't picked up on the second module I have connected and if I try to use the interrupt + callback it doesn't pick those up either. Trying to read its own message just gets stuck on busy or error. What should I look to do?

 

Additionally, is there any conversion I need to do to send from FlexCan to a Can2 module?

0 项奖励
回复
12 回复数

2,243 次查看
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @pb632146,

As the other post says, in order to use FlexCAN with another module, the normal mode must be configured:

FlexCAN normal mode.png

Additionally, the CAN transceiver must be initialized (if needed) before operation. The following example was configured in normal mode and initializes the TJA1153 (present in the S32K344 EVB): Example S32K344 FlexCAN_Ip TX/RX/EnhanceRXFIFO test S32DS3.4 RTD200 - NXP Community. You can use that example as reference.

If you are using an external transceiver, please contact the manufacturer for documentation on initialization and usage.

Best regards,
Julián

0 项奖励
回复

2,227 次查看
pb632146
Contributor V

Okay, is there any format conversion I need to do for Can 2.0B devices? or is just send/sendblocking function enough.

 

 

0 项奖励
回复

2,212 次查看
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @pb632146,

No need, when configured for flexible data rate (CAN FD), it can work with CAN FD standard and 2.0B:

Julin_AragnM_0-1730909953564.png

Best regards,
Julián

0 项奖励
回复

2,177 次查看
pb632146
Contributor V

I have tried following this and enabling canFD but I am still not seeing any messages go out from TX. The transceiver is not the one on the evaluation board but is very simple and only requires power. https://www.mouser.com/datasheet/2/268/20005991B-3443162.pdf

Regardless of if I attempt sendblocking which justreturns flexcan_status_timesout and send which just returns flexcan_status_error I am unable to send, what am I doing wrong?

pb632146_0-1730952475102.png

pb632146_1-1730952513049.png

pb632146_2-1730952600138.png

pb632146_3-1730952720074.png

 

0 项奖励
回复

2,167 次查看
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @pb632146,

How are you testing the communication? Do you have connected another bus or a CAN analyzer? 

Please double check the timing parameters, such as bitrate, sample point. Also check hardware connections.

Unfortunately, since this is an external transceiver, I am unable to test the communication with your setup, but I have tested both the example and the previous community post (Example S32K344 FlexCAN_Ip TX/RX/EnhanceRXFIFO test S32DS3.4 RTD200 - NXP Community) successfully, so please use them as reference. 

Best regards,
Julián

0 项奖励
回复

2,102 次查看
pb632146
Contributor V

I got a S32K3X4EVB-T172 to try this on but when I download the file its missing some includes and when I open the peripherals it gives me an error as its too old. Is there a recent version of this I could use?

 

pb632146_0-1731367963200.pngpb632146_1-1731367982958.png

 

0 项奖励
回复

2,086 次查看
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @pb632146,

Unfortunately, that is the only reference example version as of now. You can either port it to the newer version you are using, or simply download S32DS 3.4 and RTD 2.0.0 to use the example.

Best regards,
Julián

0 项奖励
回复

1,909 次查看
pb632146
Contributor V

pb632146_0-1733407686727.png

I downloaded 3.4 but it gives me the same version error, and I am unable to download RTD 2.0.0 because it tries to download other gcc extensions and errors out.

 

Would it be possible to screenshot the peripheral page on your end to show me the following

ip config interrupt controller

pb632146_1-1733407821103.png

 

flexCan configuration

pb632146_5-1733408170749.png

 

pb632146_3-1733407937224.png

Also does the CAN0_ORED_0_31_MB_IRQHandler handler need to be changed for different CAN channels? I am using flexcan_1 and I do not know if that is causing any issues. When I used loopback mode it was working fine but I'm not sure

 

Also in the setupCan function in the version you linked, do you know what this whole section does?

pb632146_4-1733408070949.png

 

Is this to setup the transceiver? I do not understand if this is for the transceiver on the evaluation board or something needed to be done to initialize the can frame in general.

Additionally how do you have 16 MB and 64 Payload size? When I set to 64 it gives me an error and makes me reduce the MB

0 项奖励
回复

1,886 次查看
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @pb632146,

Is that the same project I referenced previously? It has some differences in that function, but that part simply sets up the TJA1153 transceiver. You can find a brief description in the setupCanXCVR function:

"The TJA1153 transceiver does not come ready to use as most CAN transceivers
It enters configuration mode initially if it has not been configured before,
in this initial state, it is ready for receiving additional security
setups such as an ID blocklist for example.

In this example, the ID being transmitted is added to the CAN0 transceiver's
passlist, other configurations are left as default.

Refer to the NXP's TJA1153 data sheet for further detail."

Here is the configuration for the project:

Julin_AragnM_0-1733422083989.png

 

Julin_AragnM_1-1733422088153.png

For the IRQs, you can see them declared in the FlexCAN_Ip_IRQ.c file:

Julin_AragnM_2-1733424558483.png

Julin_AragnM_0-1733428748985.png

And finally, for the FlexCAN MB, each individual message buffer is 16, 24, 40, or 72 bytes, depending on the quantity of data bytes allocated for the message payload: 8, 16, 32, or 64 data bytes, respectively. Please refer to chapter 73.6.3 from the S32K3 Reference Manual.

Best regards,
Julián

0 项奖励
回复

1,837 次查看
pb632146
Contributor V

I found an oscilloscope and I managed to find that it is sending wave forms but I do not know how to read them to tell if anything is wrong, can you help?

oscilloscope exported bmp

NewFile0.bmp

 wfm file reader with both waveforms

canbus1.bmp

canh

Canbus high.bmp

 

 canl 

canbus low.bmp

0 项奖励
回复

1,700 次查看
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @pb632146,

In order to analyze the signal, you will need a CAN license to decode it. You can also use a USB to CAN analyzer such as PCAN-USB: PEAK-System.

I am not able to decode the waveform simply by looking at it.

Best regards,
Julián

0 项奖励
回复

1,908 次查看
pb632146
Contributor V

Extension installation error with RTD2.0.0

pb632146_0-1733408263662.png

 

0 项奖励
回复