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
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
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 ?
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
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.
Also I tried to view through EmbSys registers but hex value of register is not there.
Whether any settings need to be changed for this so that I can view the register values?
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.
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
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.
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
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.
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
hi,
We are using Vehicle Spy as the CAN Transceiver Node and it is configured for 500kbps
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
Hi,
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.
hi,
We are using NON ISO part of above schematic in our board. Let me know if any other information need to be shared.
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
Hi,
R7 is connected. MCP2561-E/SN is the transceiver we are using in our board. Also the STB is always pulled LOW.
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
Hi,
In our customized board we are using 8Mhz crystal frequency.
Also PE clock is enabled. I have attached the clock configuration code below.
Also I have attached the Scope of both CAN tx and CAN RX below.
hi,
We can realize the CAN signals for the working code.
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