MPC5634M FlexCAN not working

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MPC5634M FlexCAN not working

Jump to solution
3,477 Views
senthilcoramuta
Contributor II

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)

19480_19480.jpgFlexCAN schematic.JPG.jpg

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)

 

19481_19481.jpgFlexCAN Debug.JPG.jpg

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

Labels (1)
Tags (2)
1 Solution
2,730 Views
PetrS
NXP TechSupport
NXP TechSupport

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

View solution in original post

5 Replies
2,730 Views
PetrS
NXP TechSupport
NXP TechSupport

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

2,730 Views
senthilcoramuta
Contributor II

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

2,731 Views
PetrS
NXP TechSupport
NXP TechSupport

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

2,730 Views
senthilcoramuta
Contributor II

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

0 Kudos
Reply
2,732 Views
senthilcoramuta
Contributor II

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.

FlexCAN circuit.PNG.png

with regards,

senthil

0 Kudos
Reply