Can_transmit_issue_S32K344

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

Can_transmit_issue_S32K344

932 Views
Vijay98
Contributor II

Hello NXP team,

Currently we are working in can transmit and receive messages in S32K344 our customized board.

And we can be able to receive CAN messages and able to read the messages using freemaster.

Right now, we are facing the issue in transmitting the can messages.

We are able to configure the can_tx with the help of Can_transmit examples for S32k344.

Esakki_0-1722337350611.png

 

But the messages we are trying to transmit is not getting transmitted (we are also verified with bus master that the messages are not getting transmitted).

Kindly help us to resolve this issue.

I have shared the model and configuration with this post.

@Irina_Costachescu @Robin_Shen @dragostoma @constantinrazva @DrKarthi @Kavin_raj_mbd 

Thanks & regards,

Esakki

 

0 Kudos
Reply
8 Replies

851 Views
Adrian_Gherca
NXP Employee
NXP Employee

If you are using the Serial FreeMASTER, what you are seeing are the global variables, that store the data from the CAN messages, being sent through UART communication to the PC.

Please try first to get one CanController working. Then use from this CanController two separate CanHarwareObjects for transmission and reception of CAN messages respectively, both in the same Simulink model.
Once this step is passed you can split the transmission and reception on multiple CanControllers based on your application needs.

Further steps you can try to troubleshoot your CAN communication are:
- Make sure the corresponding TX and RX pins of the used CanController are correctly set on your custom board, here's an example:

Adrian_Gherca_0-1722503186233.png

- Make sure that the Transceiver associated with the used CanController is correctly initialized. In case of TJA 1043 only pin EN needs to be set to HIGH and pin STB needs to be set to LOW. Here's an example schematics on how the pins from the transceiver are connected to the microcontroller

Adrian_Gherca_1-1722503563056.png
In total at least 4 pins need to be connected between the microcontroller's CanController and its corresponding CAN transceiver: CANn_TX, CANn_RX, CANn_EN, CANn_STB.

 

I would also suggest to try first our example can\s32k3xx_can_receive_s32ct, src\S32K3_Examples\can\s32k3xx_can_transmit_ebt and MR-CANHUBK344\mrcanhubk344_can_s32ct.
All these are made for S32K344 and seem similar to what you are trying to achieve. Pin adjustments, as mentioned above, are needed.

0 Kudos
Reply

821 Views
Vijay98
Contributor II

Hello Adrian,

I have tried what you suggested, 

1. We can be able to receive the messages using both can controller (CAN 0 & CAN 2) and both Can hardware objects.

CAN_recieve.png

These are the pins we configured with EN as high and STB as low, 

*Can0_tx - PTA6.          *Can2_tx - PTC16     

*Can0_rx- PTA7.           *Can2_rx - PTC17

*Can0_EN - PTC21.        *Can2_EN - PTA16

*Can0_STB - PTC20.     *Can2_STB - PTC7

That we can be able to receive the can messages in both the can channel.

 

2. But while transmitting the can messages, we referred the examples 

Communicating over the CAN Bus - NXP Community but the can messages we are trying to send, we can't be able to read into bus master.

we tried troubleshooting the hardware pins that we can be able to see that Can2 transceiver EN pin is getting high so we can be able to understand that initialization is working correctly but the messages is not getting transmitted. 

So, we have a doubt that we are missing some configuration parameters that to be done for can transmit.

Kindly can you able to check our Can model and its Configuration for transmit is done correctly or not?

Kindly help us to resolve this issue.

Thanks & Regards.

Esakki

 

 

 

0 Kudos
Reply

796 Views
Adrian_Gherca
NXP Employee
NXP Employee

Hello,


1. Ok, you  are  able to receive CAN messages using both Can Controllers (CAN 0 & CAN 2) and both Can Hardware Objects. This is also visible in the screenshot you provided: there are two CAN messages in Busmaster with Rx under Tx/Rx column. This means that you are able to transmit CAN messages from your custom board to the PC Busmaster using both CanController0 and CanController2.

At this point both transceivers are working correctly


2.  What does it mean "we can't be able to read into bus master"? Doesn't this afirmation contradict point 1. and the attached picture from point 1. ?

Are you trying to send can messages from CanController0 to CanController2, of the same, board while also monitoring the bus with BusMASTER?
Are there any other nodes connected to this CAN bus that send and receive messasges?


3. In the configuration file from can_test_hw.zip attachment I see that CanController_0 is mapped to FLEXCAN_2 and CanController_1 to FLEXCAN_0. This is confusing but not necessarily incorrect.
Adrian_Gherca_0-1722601619214.png

4. I cannot check if the pin mapping is correct as you have a "customized board".
But I do see some inconsistencies: Can0_tx and Can0_rx seem to be mixed up; same issue for Can2. Please check again the pins connected to the transceivers.Adrian_Gherca_1-1722601634716.png


5. Having block inputs connected to line Terminators may be a problem. Try updating the model like this:

Adrian_Gherca_3-1722601984758.png

I connected an array of constant values [1 2 3 4 5 6 7 8] to the Data input of the Can_Write block.

6. Please check that a CAN termination resistor is connected at the end of the physical CAN bus.

7. Please remove the initialization for TJA1153 transceiver since you only use TJA1043 for all CanControllers:

Adrian_Gherca_4-1722602139263.png


8. I made a mistake about the microcontroller pin connected to the TJA1043 STB input. The value of this pin needs to be HIGH, not LOW.

 

0 Kudos
Reply

649 Views
Vijay98
Contributor II

Hello Adrian,

Good morning, we are working in Can transmit and receive the messages.

We configured can controller 0 as can 0 for receive and

can controller 2 as can 2 for receive and transmit.

Example: can2 receive the messages and transmit to can0, then can0 receives that message and transmit to the bus (we tried to check that output messages by bus master).

But 

right now, we can't be able to receive the can messages from can0 that we are trying to send from can2.

while analyzing the output of can enable pin, we can be able to see that the en pin is getting high.

but we can't be able to receive the messages.

I have attached the configuration pictures with this post below,

Esakki_0-1723450292296.png

Esakki_1-1723450329096.pngEsakki_2-1723450345534.pngEsakki_3-1723450359588.pngEsakki_4-1723450378226.pngEsakki_5-1723450395018.pngEsakki_6-1723450408600.pngEsakki_7-1723450421163.pngEsakki_8-1723450445969.pngEsakki_9-1723450466016.pngEsakki_10-1723450523054.pngEsakki_11-1723450538977.png

We referred that can transmit and receive examples and Communicating over the CAN Bus - NXP Community

but we doubt that we are making some little issue with this configuration that we can't able to find.

Kindly help us to resolve this issue

 

 

Thanks & Regards,

Esakki.P

0 Kudos
Reply

903 Views
Adrian_Gherca
NXP Employee
NXP Employee

-->> "And we can be able to receive CAN messages and able to read the messages using freemaster."

Are you using Serial FreeMASTER  or  CAN FreeMASTER ?

0 Kudos
Reply

876 Views
Vijay98
Contributor II

Hello Adrian, 

We are using serial freemaster(PE micro universal JTAG debugger) to read the Can messages.

 

Esakki_1-1722492104732.png

Thanks & Regards,

Esakki

0 Kudos
Reply

905 Views
Adrian_Gherca
NXP Employee
NXP Employee

Hello,

In the picture you provided, the selected CanHarwareObject is "CanHarwareObject_Can1_Tx_Interrupt" which has as Controller Reference "CanController_1". Is it your intention to use CanController_1 instead of CanControler_0 ?

In the "initialize" block from the model you provided I see no initialization for this Can Controller nor for the Can transceiver which is used by this controller.

Please identify the corresponding transceiver (TJA1153, TJA1043, etc) and initialize both the Can Controller and its associated transceiver similarly to our MBDT Can exemples.

0 Kudos
Reply

866 Views
Vijay98
Contributor II

Hello Adrian,

1. Yes, for receive the can messages we are using cancontroller_0 instance and for transmitting the can messages we are using cancontroller_1 instance.

Esakki_0-1722492406794.png

Esakki_2-1722492477985.png

 

2. In initialization, we are initialized both can controller instances with the corresponding transceiver selection i.e., TJA1043.

Esakki_10-1722493763275.png

 

Esakki_11-1722493787409.png

 

Esakki_12-1722493799012.png

Esakki_13-1722493864844.png

 

 

but we can be able to read the can messages using freemaster,

Esakki_6-1722492760726.png

 

and for transmitting that same can messages through Cancontroller_1 instance, we can't be able to read those messages in bus master.

Kindly help us to resolve this issue.

 

Thanks & regards,

Esakki

 

 

 

0 Kudos
Reply