Hello, I configured CAN0 of S32K344 EVB with RTD and it can work normally (not AUTOSAR). But after I use EB to configure the code, CAN0 does not work, am I missing something?
Solved! Go to Solution.
Hello @jacst,
I have seen some problems in your code:
1. The JTAG pins are being left as unused, which means their mode would be overwritten and hence lead to an unexpected reset. I have to comment out them in order to successfully initialize the Port pins:
Not sure how did you do to pass it, but you can check the UntouchPin list in EB Tresos and make sure that all of the JTAG pins (4, 10, 68, 69) are untouched:
2. You expected the SYS_CLK is the CAN clock source, however in fact FIRC is the clock source for CAN (by checking MC_CGM_3):
Which means the clock source frequency is 48MHz instead of 80MHz, it leads to incorrect CAN baud-rate. Due to the fact that TJA1153 only accepts 125, 250 and 500kbps during initialization, your sending frame wasn't responded and the buffer flag wasn't set.
Please change the CAN clock reference to correct clock source, it should be FLEXCAN_PE_CLK0_2 instead of SYS_CLK:
Then re-calculate the time quanta and modify the baud-rate segments.
Best Regards,
Nam
Hello @jacst,
What do you mean when you're saying: it worked normally in non-AUTOSAR? Can you send/receive the frames with your non-AUTOSAR project?
I asked this because the TJA1153 needs some pre-configuration before starting communication, and you need to get the TJA1153 document to figure out how to pre-configure it. Unfortunately, the document can't be shared here, and you need to contact NDA group to get that.
Best Regards,
Nam
Hello, I am using the RTD demo, which contains the configuration program of TJA1153, running on S32K344 EVB, I can see CAN0 send 0x141, 0x142.
Then, I used EB to configure MCAL and transplanted the configuration program of TJA1153, but the message could not be sent normally, and it would be stuck in the function FlexCAN_Ip_SendBlocking. I compared the values of CAN0, PLL and other module registers, but I didn’t find the problem. Can you help me see the reason?Many thanks
Hello @jacst,
Sorry I haven't realized that you've attached your code. The TJA1153 configuration (in My_Tja1153_Init) looks good although I haven't tried out it yet. You mean that you're stuck in one of the FlexCAN_Ip_SendBlocking function call in My_tja153_Init, right?
Best Regards,
Nam
hi,@
Yes, the program is stuck in the place where it sends data to 0x555. The return value of the function FlexCAN_GetBuffStatusFlag(base, mb_idx) has not been equal to 1, and the program is stuck in this place.
Hello @jacst,
I have seen some problems in your code:
1. The JTAG pins are being left as unused, which means their mode would be overwritten and hence lead to an unexpected reset. I have to comment out them in order to successfully initialize the Port pins:
Not sure how did you do to pass it, but you can check the UntouchPin list in EB Tresos and make sure that all of the JTAG pins (4, 10, 68, 69) are untouched:
2. You expected the SYS_CLK is the CAN clock source, however in fact FIRC is the clock source for CAN (by checking MC_CGM_3):
Which means the clock source frequency is 48MHz instead of 80MHz, it leads to incorrect CAN baud-rate. Due to the fact that TJA1153 only accepts 125, 250 and 500kbps during initialization, your sending frame wasn't responded and the buffer flag wasn't set.
Please change the CAN clock reference to correct clock source, it should be FLEXCAN_PE_CLK0_2 instead of SYS_CLK:
Then re-calculate the time quanta and modify the baud-rate segments.
Best Regards,
Nam
Hello,Thank you so much, the problem has been solved.
1.I added an unconfigured PORT.
2.The clock source was changed to FLEXCAN_PE_CLK0_2, the CAN baud rate was recalculated, and it is now OK.
When the problem occurred, I only chose an 80M McuClockReferencePoint, and did not realize the correlation between the CAN clock source and ClockMux3.
Thanks again
It seems to me that CAN baud rate is 150 kbit/s. TJA1153 supports 125, 250, 500 kbit/s.
I have connected logic analyser to TP275 & TP276 (CAN Rx and Tx) on S32K344 EVB and measured baud rate to be 150 kbit/s.
I haven't looked at config. There is also probability that there is bug in config tool or drivers.