cancel
Showing results for 
Search instead for 
Did you mean: 

Flex CAN tx problem

Saravanan_Mari
Associate III

Hello,

I am working on a SPC560P Discovery Board.

I have imported test application 'SPC560Pxx RLACAN Test Application for Discovery' for FlexCAN testing. In this FlexCAN0 is used in loop back mode and it is working.

But after disabling loop back mode,I cant see any data on the CAN_TX pin with scope.

I configured the:

  • b[0] as CAN0TXD output and b[1] as CAN0RXD input in the pinmap wizard
  • Disable loopback mode
  • Enable FlexCAN0 Use External Clock
  • Set: PressDive =3 , PropSeg=2 , PSEG1=4 , PSEG2=7

After i start the application the program gets stuck in the transmit while loop:

  1. while (can_lld_transmit(&CAND1,txmailbox, &txmsg)==CAN_MSG_WAIT){
  2. }�?�?�?�?�?�?

Its seems like that thecan_lld_is_tx_empty function returns FALSE and it breaks the can_lld_transmit function.

Is the mailbox needs any additional configuration or I configured the CAN clock incorrectly?

Thanks for your help and sorry for the the lot questions but I am new to 32bit controller programming.

Regards,

Saravanan Mariyappan

1 ACCEPTED SOLUTION

Accepted Solutions
zambrano.luigi
Senior III

Hi,

in attachment you can find a CAN project developed for Pictus Discovery in which the CAN transceiver on the board is connect with a CAN analyzer (it is a module based on another SPC5 platform with a CAN transceiver that is able to catch the CAN flow and send it to an host PC via serial port, in order to analyze on the host the CAN flow). Please, check in this project how the CAN pin are configured and how the CAN driver is configure (especially the baudrate). I can guarantee you that this project has been tested on the hardware and we are able to catch on the host exactly the expected CAN flow. You can find more details about the project within the readme file in the zip.

Regards,

Luigi

View solution in original post

21 REPLIES 21
zambrano.luigi
Senior III

Hi,

is the CAN transceiver on the Pictus Discovery connected with another CAN transceiver?

Regards,

Luigi

Saravanan_Mari
Associate III

No just we checking with CRO, The CAN_L and CAN_H Pins are connected to the CRO to check the signals for that only its stucked in thecan_lld_is_tx_empty function returns FALSE and it breaks the can_lld_transmit function. and it never transmits anything on the CAN bus

Can anyone give me a solution for this issue?

Regards,

Saravanan Mariyappan

zambrano.luigi
Senior III

HI Saravanan,

if the TX transceiver is not connect with another CAN transceiver, it is normal that nothing is transmitted on the CAN bus. If you check with a state analyzer the CAN pins after the TX CAN transceiver, surely you will be not able to see any transaction. In order to observe the transaction on the pins, you should sample the signals before the TX CAN transceiver.

Regards,

Luigi

Saravanan_Mari
Associate III

But to verify that code is correctly working or not with help of CRO, Meanwhile our team already done the same thing send a message through CAN using STM32 Controller but here we can see that in the code it self it stucked into the function then how it will transmit when we connected with another CAN transceiver

Kindly check the pictures for your reference0693W00000AMimhQAD.jpg0693W00000AMioOQAT.png

zambrano.luigi
Senior III

Hi,

in attachment you can find a CAN project developed for Pictus Discovery in which the CAN transceiver on the board is connect with a CAN analyzer (it is a module based on another SPC5 platform with a CAN transceiver that is able to catch the CAN flow and send it to an host PC via serial port, in order to analyze on the host the CAN flow). Please, check in this project how the CAN pin are configured and how the CAN driver is configure (especially the baudrate). I can guarantee you that this project has been tested on the hardware and we are able to catch on the host exactly the expected CAN flow. You can find more details about the project within the readme file in the zip.

Regards,

Luigi

Saravanan_Mari
Associate III

Hi Luigi,

Thanks for the Reply

we have seen the Code which is same as our code only change we are using the Standard your code using as Extended but that not be issue right

Then we dumbed your code to the SPC560P Disc Board Same thing happened it not transmitting But this we are transmitting to another Board which having the Transceiver and it is working we already verified that one,

Now we doesn't understand what is the issue is how to solve this one

Regards,

Saravanan

zambrano.luigi
Senior III

Hi Saravanan,

sorry, but I'm not fully clear the situation. If I have understood, you have tried to transmit between 2 Boards with transceiver and the code works fine. Right?

Regards,

Luigi

Saravanan_Mari
Associate III

Sorry for that,

i exaplain detailly

We have 2 Boards :

  1. SPC560p Discovery
  2. Our Custom Board(STM32L4 controller) and it also having the CAN transceiver

Then Software:

  1. For transmission we are using your code which is sent as zip file into the SPC560p Disc
  2. And We already have a Reception code for the STM32 custom Board and which is already working for Reception
  3. Now the problem is Connected this two board the transmission is not happening same place code is stucked

Kindly refer the pictures0693W00000AMl78QAD.png

zambrano.luigi
Senior III

HI Saravan,

let me suggest to check the baudrate. It is mandotry to have the same baudrate on the 2 boards. Moreover, let me suggest to check also the endianess (ARM is little endian, PPC is big endian).

Regards,

Luigi