I am working on MPC5634M and I have connected the freescale CAN port to Microchip CAN Bus analyser to test CAN frames.
I have written a code to transmit the following CAN frame continuously on Channel A of FlexCAN module.
(ID = 0x555, length=5, bytes = “Hello”)
So I have adapted the code from freescale supplied with the board (only main.c is changed), but it is not working. (Please refer the attached FlexCAN.zip file for the code)
I have checked the TX Pin of MPC5634M IC using CRO scope, but I don’t detect any CAN frames at all. (Please refer FlexCAN schematic.jpeg for more info)
My analysis:
In the code, I have chosen oscillator as the base clock for the FlexCAN module. But I feel the clock is not running for the FlexCAN module.
When I debug my code, I see all the registers are loaded with proper values. But after filling the transmit buffer and I set the CODE to Transmit (0x0C) the FlexCAN module does not change back the CODE to 0x08. The code is infinitely executing the while loop (Please refer the highlighted line in FlexCAN Debug.jpeg for more info)
Please check the issue and let me know if I have made some mistake.
with regards,
senthil
Original Attachment has been moved to: FlexCAN.zip
Solved! Go to Solution.
Well, on the TRK board the CAN transceiver is implemented within the SBC chip. So to use it you need
- power the SBC externally, so connect 9 to 12V to J1 connector and place jumper to SBC_5V-5V position on POWER_SELECT header.
- put the SBC to debug mode with a J5 jumper (J4 not installed), for ease of use
- enable the CAN transceiver through SPI
See following page for simple example testing the FlexCAN on the TRK board.
https://community.freescale.com/docs/DOC-103708
Regards,
Petr
Hi,
You have set the CAN TX pin as open drain. In that case do you have external pull up on this line? Or set at least weak pull up on this pin or use push/pull mode.
What kind of board do you use? Your own made or FSL EVB / TRK board?
Regards,
Petr
Hello Petr,
I am developing code on TRK MPC5634M. I am using the board mentioned in the below link
MPC563xM StarterTRAK (Development Kit)|Freescale
I am not connecting an external pull up resistor. I have connected the DB9 connector (for CAN) to the Microchip CAN bus analyzer (refer below link). In the microchip tool, I have configured for 100KHz and Normal CAN mode, but I am not observing any kind of frames.
CAN BUS Analyzer Tool - APGDT002 | Microchip Technology Inc.
Please note, The microchip bus analyzer tool seems to be working, I have checked in another CAN bus environment.
Also regarding the Tx open drain configuration, I have also made the below port pin configuration, but I see no change in behavior.
SIU.PCR[83].R = 0x0400;
SIU.PCR[84].R = 0x0400;
with regards,
senthil
Well, on the TRK board the CAN transceiver is implemented within the SBC chip. So to use it you need
- power the SBC externally, so connect 9 to 12V to J1 connector and place jumper to SBC_5V-5V position on POWER_SELECT header.
- put the SBC to debug mode with a J5 jumper (J4 not installed), for ease of use
- enable the CAN transceiver through SPI
See following page for simple example testing the FlexCAN on the TRK board.
https://community.freescale.com/docs/DOC-103708
Regards,
Petr
Hello Petr,
I am able to solve the issue with your suggestion. Your code works now :-).
Thank you, thank you thank you so so much...
with regards,
Senthil
Hello Petr,
I feel there is a small correction in the cookbook, corresponding to the FlexCAN example code.
There needs to be a short in the circuit below, marked in red circle.
Initially I tried without the short, the behavior was not consistent. I spent around 1 week to find the issue.
Later I found that by making a short, the FlexCAN code is working absolutely proper.
with regards,
senthil