About the TXE bit of S12G128 msCAN

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

About the TXE bit of S12G128 msCAN

跳至解决方案
1,270 次查看
ikkishingu
Contributor II

Hello,

I now make the demo code to send CAN message using S12G128.

 

The following action is observed;
in normal situation(non-loopback configuration),
TXE bit of corresponded Tx buffer is not set after CAN message sending
and the same message has continued to be sent.
We use one TWR-S12G128 board as a message sender, and no listener.

 

Does this action meet the spec of S12G128?

 

On the other hand, in loopback configuration, we can observe the setting of TXE bit,
so I think it may be required the listener on the demo environment.

标签 (1)
标记 (1)
0 项奖励
回复
1 解答
1,122 次查看
lama
NXP TechSupport
NXP TechSupport

Hi Ikki,

Please test the code I have attached. Please ignore the name of the project. I have not used loopback mode now but his setup possibility is still visible there.

If you want to see what is sent then connect probe to a TXCAN . It is CT1. (It is close to JP4, close to CAN connector or close to CAN_EN jumper)

GND connect to J8 pin 4 on the board.

You have to see traffic on the Tx pin if you use the code I attached.

BTW; if you use setup for loopback (in the function main.c) then send/received data and IDHIT can be check by means of PC (UART for 9600bps)

For CAN setup you can find (main.c):

// init_CAN(0,0xC3, 0x58, 1); // 125 kb/s, loop enabled/disabled=1/0,  - LOOPBACK MODE

init_CAN(0,0xC3, 0x58, 0); // 125 kb/s, loop enabled/disabled=1/0,   - NORMAL MODE

Best regards,

Ladislav

在原帖中查看解决方案

0 项奖励
回复
3 回复数
1,123 次查看
lama
NXP TechSupport
NXP TechSupport

Hi Ikki,

Please test the code I have attached. Please ignore the name of the project. I have not used loopback mode now but his setup possibility is still visible there.

If you want to see what is sent then connect probe to a TXCAN . It is CT1. (It is close to JP4, close to CAN connector or close to CAN_EN jumper)

GND connect to J8 pin 4 on the board.

You have to see traffic on the Tx pin if you use the code I attached.

BTW; if you use setup for loopback (in the function main.c) then send/received data and IDHIT can be check by means of PC (UART for 9600bps)

For CAN setup you can find (main.c):

// init_CAN(0,0xC3, 0x58, 1); // 125 kb/s, loop enabled/disabled=1/0,  - LOOPBACK MODE

init_CAN(0,0xC3, 0x58, 0); // 125 kb/s, loop enabled/disabled=1/0,   - NORMAL MODE

Best regards,

Ladislav

0 项奖励
回复
1,122 次查看
ikkishingu
Contributor II

Hi lama-san,

Thank you for the test code!

I tried to test with this code, but
the code execution has been stuck on can.c line 96 in NORMAL MODE
  while(!(can->TFLG & (0x01<<tbuf_n_empty_flag))) // find empty transmit buffer from 3 buffers

,while it is not stuck in LOOPBACK MODE.

And when it has been stuck on line 96, TXE[2:0] bits are all cleared
and it means the TX buffers are not empty.

This action is similar to the action of my original test code.
After all, are CAN packets receiving required to set TXE[2:0] bits?

Best Regards,

Ikki

0 项奖励
回复
1,122 次查看
ikkishingu
Contributor II

I can solve this question.

The cause is no dominant driving from the receiver for ACK in CAN packet.

When I prepare the receiver with proper terminal resister on CAN bus, my test code is running.

Ikki

0 项奖励
回复