cancel
Showing results for 
Search instead for 
Did you mean: 

FlexCAN Tx problem

Marcell Daniel
Associate II
Posted on July 17, 2017 at 08:50

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 =1 , PropSeg=0 , PSEG1=5 , PSEG2=7

After i start the application the program getsstuck in the transmit while loop:

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

Its seems like that thecan_lld_is_tx_empty functionreturns FALSE and it breaks the can_lld_transmitfunction.

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,

Marcell

#spc560p #spc56 #tx #flexcan #loopback
This discussion has been locked for participation. If you have a question, please start a new topic in order to ask your question
2 REPLIES 2
Erwan YVIN
ST Employee
Posted on August 09, 2017 at 16:28

Hello Marcell ,

Sorry for the late answer;-)

Could you check the Message Buffer code for TX buffers

the Mailbox should be inactive before sending the CAN Frame.

you can use the debugger to check this value.

0690X00000607lTQAQ.png

   Best regards

              Erwan

Posted on August 10, 2017 at 10:57

Hello

Erwan,

I am using MB0 for receiving and MB1 for transmitting.

Before the transmit while cycle the MB code shows inactive:

0690X00000607nsQAA.png

After trying to transmitting it, the code is 0xC which would mean: Transmit data frame unconditionally once.

0690X00000607olQAA.png

After a more detailed look it looks like the transmit loop gets stuck when its called the second time, which explains why it says the message buffer is not empty. Still I cannot seen anything on the Tx pin after the first attempt of the transmission.

Thanks for the help!

   Marcell