File is not transmitted through CAN

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

File is not transmitted through CAN

2,364 Views
AparnaSridharan
Contributor II

Hi,

I am currently working on CAN part of Bootloader program to flash application program into MCU (s32k144) memory automatically once update is received. Actually I am using OTA_s32k144_use_case_ws file for this. We have connected the Vehicle Spy on the CAN Bus to understand the CAN Communication. But we are not getting the data on the CAN bus. It's getting stuck in the FlexCAN0_transmit while loop.

while(0 == ( (CAN0->IFLAG1 >> CAN_TXbuffer_ptr->MB) & 1 )); 

 Could you let us know why it is getting stuck in the while Loop. What might be wrong ?. While debugging I observed that the code stuck at the line 234, Flexcan of gateway program.

I am using S32ds for ARM 2.2  development environment. 

We are testing this on our custom hardware with the same pinout used in the s32k144 evkb PTE4 & 5 for CAN TX / RX. 

We were able to send and recieve messages through CAN bus with our previous bootloader working. I have attached CAN part of that. Could please compare what 

 

 

0 Kudos
Reply
19 Replies

2,348 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

TX MB flag is set upon message is successfully transmitted without error detected. So either this is not true or maybe flag is cleared unintentionally.
Could you share content of FlexCAN registers when the code hangs on that line? Could be all registers or at least ECR, ESR1, MCR. Also share value of TX MB, guess MB0 in that code.
Also scope checking of CAN TX/RX line could be fine, to know if anything is transmitted.

BR, Petr  

0 Kudos
Reply

2,336 Views
AparnaSridharan
Contributor II

Hi PetrS,

       Below, I have attached the values of CAN register variables while the code hangs on that while loop. Also checked with oscilloscope, I am not able to observe any CAN Tx and Rx signals. So what are testing or necessary configurations that need to be checked to receive or transmit data through CAN bus for S32k144 board ? 

0 Kudos
Reply

2,329 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

thanks for more info, but please next time display HEX values to have it more readable. Also it does not show MB content, but I guess TX MB CODE field stays 0xC.

ESR1 shows zero, so FlexCAN is not synchronized to the bus, so there will be no communication.
Reason could be missing PE clock (FXOSC), wrong pin setting or wrong/disabled CAN transceiver.

BR, Petr

0 Kudos
Reply

2,316 Views
AparnaSridharan
Contributor II

Hi PetrS,

I am not able to view the register mapping details when hover over the register name in my working code. I am able to see only macro expansion. I am not able to see its values.

AparnaSridharan_0-1646916478124.png

Also I tried to view through EmbSys registers but hex value of register is not there.

AparnaSridharan_1-1646916685821.png

 

Whether any settings need to be changed for this so that I can view the register values?

0 Kudos
Reply

2,323 Views
AparnaSridharan
Contributor II

Hi Petr,

Kindly let us know how to share the hex Value.

Yes MB Content shows 0. But Where to check for the TX MB Code.

And guide us how to verify PE clock is enabled in the code. 

 

 

0 Kudos
Reply

2,297 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

you should double click on register to see its value, I think
For MB0 content display RAMn0-RAMn3 registers.
Clocks validity can be seen from SCG registers (like SOSCCSR, FIRCCSR, ...).

BR, Petr

0 Kudos
Reply

2,292 Views
AparnaSridharan
Contributor II

Hi PetrS,

I have attached the value of MB0  also register values of SCG, MCR,ECR, ESR for both working and non working code.  Kindly let us know the register values we need to change so that we can communicate through CAN bus. 

Also let me if any other details I need to forward.

 

 

 

 

0 Kudos
Reply

2,286 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

seems clocks are fine, in both pdfs it shows TX MB is not transmitted and also in both cases FlexCAN is detecting errors. 
I would suggest to check CAN bit timing setting, if it is a same on both nodes.

BR, Petr 

0 Kudos
Reply

2,283 Views
AparnaSridharan
Contributor II

Hi PetrS,

 I am configuring CAN 2.0 communication system. Can you suggest CAN bit timing specific to CAN 2.0. Or else any other resource related to that.

 

0 Kudos
Reply

2,271 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

there is no specific CAN bit timing, this is set by user, could be 500kbps.
Do you know how your nodes are configured with respect of that? 

BR, Petr

0 Kudos
Reply

2,269 Views
AparnaSridharan
Contributor II

hi,

We are using Vehicle Spy as the CAN Transceiver Node and it is configured for 500kbps

 

0 Kudos
Reply

2,265 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

how is your connection done?
If using own board, what is crystal used (if selected as PE clock source) and CAN circuitry
Share scope measurement of CAN TX/RX/bus line.

BR, Petr

0 Kudos
Reply

2,188 Views
AparnaSridharan
Contributor II

Hi,

AparnaSridharan_0-1647319352114.png

This is the crystal oscillator circuit we are using in our microcontroller.

Let me know if any other details required to fix issue regarding information transmission and reception through CAN bus.

0 Kudos
Reply

2,202 Views
AparnaSridharan
Contributor II

hi,

AparnaSridharan_2-1647250751009.jpeg

We are using NON ISO part of above schematic in our board. Let me know if any other information need to be shared.

 

 

0 Kudos
Reply

2,171 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

is the R7 really DNP and so transceivers do not powered, I guess no.
How is the STB driven? BTW what kind of transceiver is it?

BR, Petr

0 Kudos
Reply

2,168 Views
AparnaSridharan
Contributor II

Hi,

R7 is connected. MCP2561-E/SN is the transceiver we are using in our board. Also the STB is always pulled LOW.

0 Kudos
Reply

2,160 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi, 

then, assume transceiver is really in normal mode, then if connected to CAN bus and other node is sending a message, you have to see this message on RX pin and MCU should send ACK low pulse on TX line. Is this your case?

Also if transceiver is terminated and disconnected from bus/other nodes, and MCU is sending a message you have to see it on TX/RX lines, if not most probably pin are not properly configured.
You can also test pin setting by disconnecting transceiver and connecting TX/RX together, then send a message. You have to see message transmitted still.

BR, Petr

0 Kudos
Reply

2,204 Views
AparnaSridharan
Contributor II

Hi,

In our customized board we are using 8Mhz crystal frequency.

Also PE clock is enabled. I have attached the clock configuration code below.

AparnaSridharan_2-1647249934400.png

AparnaSridharan_1-1647249709569.png

Also I have attached the Scope of both CAN tx and CAN RX below.

AparnaSridharan_3-1647250123724.pngAparnaSridharan_4-1647250131443.png

 

 

 

 

 

 

0 Kudos
Reply

2,185 Views
AparnaSridharan
Contributor II

hi, 

We can realize the CAN signals for the working code. 

AparnaSridharan_1-1647322955440.png

 

AparnaSridharan_0-1647322949683.png

But for the Fota_gateway program I am not getting any can tx/rx signal. What might went wrong ? Kindly help to fix this issue

 

0 Kudos
Reply