Flex CAN tx problem
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-04-27 05:17 AM
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:
- while (can_lld_transmit(&CAND1,txmailbox, &txmsg)==CAN_MSG_WAIT){
- }�?�?�?�?�?�?
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
Solved! Go to Solution.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-04-27 11:40 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-04-27 07:11 AM
Hi,
is the CAN transceiver on the Pictus Discovery connected with another CAN transceiver?
Regards,
Luigi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-04-27 09:17 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-04-27 10:54 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-04-27 11:24 PM
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 reference
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-04-27 11:40 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-04-28 03:32 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-04-28 03:47 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-04-28 04:05 AM
Sorry for that,
i exaplain detailly
We have 2 Boards :
- SPC560p Discovery
- Our Custom Board(STM32L4 controller) and it also having the CAN transceiver
Then Software:
- For transmission we are using your code which is sent as zip file into the SPC560p Disc
- And We already have a Reception code for the STM32 custom Board and which is already working for Reception
- Now the problem is Connected this two board the transmission is not happening same place code is stucked
Kindly refer the pictures
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-04-28 04:22 AM
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