2017-07-16 11:50 PM
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 #loopback2017-08-09 07:28 AM
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.
Best regards
Erwan
2017-08-10 03:57 AM
Hello
Erwan,
I am using MB0 for receiving and MB1 for transmitting.
Before the transmit while cycle the MB code shows inactive:
After trying to transmitting it, the code is 0xC which would mean: Transmit data frame unconditionally once.
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