I am trying to convert the FlexCan example to be able to send and receive externally, I found from another post
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?
Hi @pb632146,
As the other post says, in order to use FlexCAN with another module, the normal mode must be configured:
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
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?
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
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?
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
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
flexCan configuration
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?
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
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:
For the IRQs, you can see them declared in the FlexCAN_Ip_IRQ.c file:
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
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
wfm file reader with both waveforms
canh
canl
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