MSCAN communication problem between two SofTec EVB9S08DZ60

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

MSCAN communication problem between two SofTec EVB9S08DZ60

2,073 次查看
Aibolit
Contributor I
Hello everybody!
 
I am facing the problem in CAN bus communication between 2 equal SofTec evaluation boards
with MCU 9S08DZ60 mounted. I have downloaded to the both boards the same software. The only difference is the message id which is unique for every board.
 
First I was trying to run the example from AN 3034. But the program was always stucking at
     while ((CANTFLG & txbuffer) != txbuffer);  /* Wait for Transmission
                                                  * completion
                                                  */
of CANSendFrame function.
 
Then I have read here about the possible solution by the Processor Expert Initialization usage. After putting the MSCAN into Normal Operation Mode in Processor Expert instead of default Listen Only Mode the more details have become known about the problem.
 
Everytime the program reaches the end of Processor Expert generated CAN1_SendFrameExt function,
the InterruptError routine is called. And then every second InterruptError routine call is followed
by CAN1_OnBusOff(void).
  
Both boards have equal timing settings: Time segment1 - 10, Time segment2 - 3, sync jump width - 3,
125kbit/s bit rate...
 
The measured resistance between CANH and CANL is around 60 Ohms.
 
The wire connection is composed by CANH, CANL, GND. The boards are equipped with TJA-1040 CAN-transciever.
 
Does anybody have any ideas how to solve the problem?

Thanks in advance to everyone.
标签 (1)
0 项奖励
回复
3 回复数

356 次查看
Lundin
Senior Contributor IV
I have that board too. I bet the problem is that the CAN tranceiver isn't enabled. (Assuming you are using "high-speed CAN" and not "fault-tolerant CAN")

You have to check the following jumpers:

J502, should have jumper.
J501, jumpers should be between pin 1 and 3, and between 2 and 4.

Then enable the transceiver for the MCU:

PTED &= ~0x20;
PTEDD |= 0x20;
0 项奖励
回复

356 次查看
kef
Specialist I
Are you sure both boards are clocked at the same frequency, are you sure both boards are clocked from crystal oscilator and not from on chip oscilator?
0 项奖励
回复

356 次查看
Aibolit
Contributor I
kef, thank you very much, it was clocked by internal chip oscillator. Now I have configured the MCU like this:
 
MCGC1 = 0x80;
MCGC2 |= 0x26;
while(!MCGSC_OSCINIT);
 
Lundin, you are right! The TJA-1040 was not enabled!
I was trying to write so:
    PTEDD_PTEDD5 = 1;        /* */
    PTED_PTED5 = 0;          /* */
But it did not work out.

The combination of both advices forced it to work properly! Thanks a lot guys!


Message Edited by Aibolit on 2008-07-14 03:50 PM
0 项奖励
回复