MSCAN Auto BaudRate in mc9s12xdt512

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

MSCAN Auto BaudRate in mc9s12xdt512

1,961 次查看
chrissam
Contributor I

Hello to all,

 

I am using mc9s12xdt512 and i have a code that implements the communication with the MSCAN  module.

I use a simulator that simulates a car operation that uses CAN Bus. The system runs fine and the operation is right.

 

The problem occurs when i want to change the baud rate of the simulator and connect with the application.

I have done the necessary changes to the MSCAN registers to support the new baud rate and i begin the

initialization process of the module from scratch.

The problem is that the MSCAN does not synchronize with the bus. The application at initialization

sends a wakeup and a bootup message. Are those messages essential for the CAN Bus communication or can i

bypass them.

When testing the application, if I am connected to the bus and receiving the messages with BR=125k and manually begin

the auto baudrate process without changing the BR value then the connection is fine but when i change the BR value to 250k

and then again to 125k the connection is lost. In that case i have the TFLG reg to 110 and the TIER reg to 1. The Synch bit

in the CTL0 reg is 1 for both BR values.

 

Does anyone knows how to auto baudrate in the MSCAN? Moreover, are there any messages that need to send for the

synchronization or is it dine automatically?

 

Thank you in advance,

 

Chris

标签 (1)
0 项奖励
回复
1 回复

1,646 次查看
RadekS
NXP Employee
NXP Employee

Hi chris,

If I understood correctly, your node receiving and sending messages (otherwise TFLG = 0b110 doesn’t make sense for me).

I suppose that you probably made some mistake in baud rate change process.

Change of baud rate is quite intrusive method and it cannot be invoke anytime without consequences.

The recommended solution is request the MSCAN to enter low power mode by asserting the SLPRQ bit in the CANCTL0 register. If there are one or more message buffers scheduled for transmission (TXEx = 0), the MSCAN will continue to transmit until all transmit message buffers are empty (TXEx = 1, transmitted successfully or aborted) and then goes into sleep mode. The same is valid for receiving process.

If sleep mode is active, the SLPRQ and SLPAK bits are set and we could switch CAN module to Initialization mode by INITRQ bit in CANCTL0 register.

When CANCTL1_INITAK bit indicates Initialization mode active, we could write new values to CANBTR0 and CANBTR1 registers and re-init CAN module.

Attached is simple CAN baud rate calculator.

0 项奖励
回复