File is not transmitted through CAN

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

File is not transmitted through CAN

3,925 次查看
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 项奖励
回复
19 回复数

3,909 次查看
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 项奖励
回复

3,896 次查看
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 项奖励
回复

3,889 次查看
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 项奖励
回复

3,876 次查看
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 项奖励
回复

3,883 次查看
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 项奖励
回复

3,857 次查看
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 项奖励
回复

3,852 次查看
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 项奖励
回复

3,846 次查看
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 项奖励
回复

3,843 次查看
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 项奖励
回复

3,831 次查看
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 项奖励
回复

3,829 次查看
AparnaSridharan
Contributor II

hi,

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

 

0 项奖励
回复

3,825 次查看
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 项奖励
回复

3,748 次查看
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 项奖励
回复

3,762 次查看
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 项奖励
回复

3,731 次查看
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 项奖励
回复

3,728 次查看
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 项奖励
回复

3,720 次查看
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 项奖励
回复

3,764 次查看
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 项奖励
回复

3,745 次查看
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 项奖励
回复