Cannot get the CAN bus working 

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

Cannot get the CAN bus working 

919 Views
Gman
Contributor I

Working successfully the CANbus on  9S12C64 9S12D128 and 9S12C32 controllers.

After switching on a new project to the 9S12P64 controller, I can get no CAN message onto the bus, and I cannot read any that is on the bus. 

There is only 1 register different on the P64 chip, and I wrote to that.

What are people usually do wrong, when they start with the P64 and CANbus ?

 

Thanks,

Gerhard

Labels (1)
Tags (1)
0 Kudos
2 Replies

674 Views
peter_pinewski
NXP Employee
NXP Employee

Gerhard,

The Clock generation module changed from the S12C to the S12P.  Can you verify that the clocks to the system are correct and the MSCAN module is selecting the correct clocks.  If you look at the MSCAN module, the MSCAN clocks default to the external oscillator reference so please make sure the S12P64 has its oscillator enabled.  Note that by default, the S12P64 comes up in the PLL Engaged Internal (PEI) mode with the external oscillator disabled.  Therefore, you must set the OSCE bit in the CPMUOSC register to enable the external oscillator.

I hope this resolves your issues.

Regards,

Peter

0 Kudos

674 Views
lama
NXP TechSupport
NXP TechSupport

Hi,

I have been using the same routines for entire portfolio of S12 devices. The only change I use is Buss off for newer devices.

Usually we have met following issues.

1) There are incompatible CAN interface ICs used for physical CAN bus. Only devices with the same electrical and timing characteristics are able to communicate.
2) Wrong communication speed design. You can use attached excel sheet to check CANBTR0 and CANBTR1 registers setup.
3) Wrong PCB design. There could be some EMI which affect CAN bus. Please check by oscilloscope signals at CAN bus and also at MCU’s CAN pins.

4) I hope SW approach is OK if you are able to work in the loopback mode.

5) You can test the can by simplified connection between two devices without transceivers described in the http://www.mikrocontroller.net/attachment/28831/siemens_AP2921.pdf.

As an example for communication I have attached SW I made "a few" days ago.
 
Best Regards, Ladislav

0 Kudos