We are not using Linux, but our own RTOS. We created a FlexCan driver test and it's been fine on boards like S32R45, S32G2. But I recently found S32G3 unhappy with it. The pseudo code is like below:
// loop-back off. MCR is 0x5921203f when this is executed (freeze mode)
CTRL1 = 0x9392004;
// get out of freeze mode
MCR = 0x0021_203f;
// CAN bus 0 is used (0x401B4000h)
send_msg(can0);
// on board like S32R45, S32G-VNP-RDB2, this rcv_msg fails to recv anything as expected. But on S32G-VNP-RDB3, this recvs msg.
if (rcv_msg(can0) == OK) ERROR(); // <<<<<<<< Problematic :(
// go to freeze mode (looped till FRZACK at BIT24 to be on)
MCR = 0x5921_203f;
// loop-back on
CTRL1 = 0x9393004;
// get out of freeze mode
MCR = 0x0021_203f;
// CAN bus 0 is used (0x401B4000h)
send_msg(can0);
// now we expect to recv what we send
if (rcv_msg(can0) != OK) ERROR();
If running on can1 (0x401BE000h) on S32G3, this test is also OK.
Could any one throw some light? What should I try differently? Thanks
已解决! 转到解答。
this can be closed. It's caused by something connected to the can bus 0:( I work remotely so I didn't know that was connected....