Dear Supporters
I would like to make a CAN system using S32K144EVB. I would like to refer to the examples in S32DS, but there were three examples of CAN. The three were [sbc_uja1169_s32k144], [flexcan_encrypted_s32k144] and [FlexCAN_s32k144], and I don't know what the differences are in function. So, I would appreciate it if you would let me know this difference.
In addition, there are a few more questions I know that the example [sbc_uja1169_s32k144] is an example of switching the operating mode of the uja1169 CAN transceiver through the SPI. However, no code was found to send and receive CAN frame. How can I send and receive CAN frame using uja1169 in this example?
Hello,
You mentioned that we can work with SBC chip in the default setting "Normal Forced Mode" So we will not need any kind of SPI communication with the SBC, Right. If so What exactly will be the CAN specification in this case " DLC and baud rate CDR". and if we send a CAN frame with different baud rate or data length DLC what will be the reaction from the chip
Hi,
both flexcan_encrypted_s32k144 and FlexCAN_s32k144 do similar thing, transmit and receive a CAN message. FlexCAN_s32k144 is baremetal example, it does not use any driver, peripheral registers are directly programmed. Flexcan_encrypted_s32k144 is using SDK driver, so user does not care much of peripheral registers and the SDK API is used. The communication between the two nodes can be encrypted. The example documentation can be found in the S32 SDK documentation at Examples and Demos section. (<SDK_PATH>/doc/Start_Here.html)
The sbc_uja1169_s32k144 is also based on SDK and no CAN functionality is given here. If you want to use this example you need to add FlexCAN component into project and use driver similarly e.g. as it is on other Flexcan SDK examples.
Note: From the factory the SBC comes in this Forced Normal mode and no special init is needed for the SBC and its CAN transceiver. If the SBC leaves this init mode (by clearing FNMC bit of the SBC configuration control register) then the SBC init must be done. Or restoring factory preset values can be performed as mentioned in SBC datasheet. Executing this sbc_uja1169_s32k144 example will leave default Forced Normal mode.
BR, Petr
First of all, thank you for your kind reply.
I tested CAN communication using examples [can_pal_s32k144], [flexcan_encrypted_s32k144], [FlexCAN_s32k144] according to you. But nothing was successful. I have read the example manual and tried connecting the two s32k144 EVBs together as described, but no CAN communication was made. [FlexCAN_s32k144] was also aware that this was an example of using MC33903 instead of UJA1169, but examples [can_pal_s32k144] and [flexcan_encrypted_s32k144] also failed CAN communication. There were no signals from CAN_H, CAN_L pin and no signals from RXD and TXD pin on PTE4, PTE5.
I know I'm still a beginner, but please find my problem and let me know how to solve it.
In addition, please provide an example of sending and receiving CAN frames using s32k144 EVB (with built-in uja1169).
Thank you and best regards,
Minsik Choi
Hi,
examples from S32DS is working, but expect SBC is in default mode.
So do simple check, take one board and debug any CAN example. After FlexCAn is initialized, left Freeze mode, check the module ESR1 register, for its value. Also you can measure TX/RX lines with scope. Then send a message, normally you should see message repeating on the bus and TX, RX lines. Check again ESR1 and ECR registers. Do you see any error detected?
BR, Petr
Hi,
I tried using the example [flexCAN_s32k144] as you said. First, by adding some code, ESR1, ECR register value was sent to UART to confirm to PC.
I am attaching three pictures and my code, so please refer to them.
First of all, to start with the results for the scope, the RX pin remained low, and the TX pin was high but no signal was detected for the transmission. Pressing or releasing the [RESET] button changes the TX pin, but only very slight changes.
The ESR1, ECR registers all appear as 0x00. But the moment I press the RESET button, there are bits that randomly become one.
I don't think the example is wrong. So I'm missing something, or I'm expecting a hardware problem. Please check and let me know the answer.
Hi,
thanks for testing. If the RX is held low still, no message can be transmitted. The module does not see RX high and does not synchronize to the "bus". ESR1 remains cleared, in normal case SYNC and IDLE bit should be set upon leaving Freeze mode.
This will be caused due to SBC is not longer in default mode, CAN transceiver is disabled. Try to restore default setting as mentioned in the SBC datasheet (https://www.nxp.com/docs/en/data-sheet/UJA1169.pdf , chapter 7.11.2 Restoring factory preset values).
BR, Petr
Thanks for the answer.
Use the example [sbc_uja116x_s32k144] to set up the transceiver as you say. I conducted the test by adding part of the example [flexCAN_s32k144] to [sbc_uja116x_s32k144]. Please refer to the attached code first. When I executed the code, I confirmed that the TXD pin and the RXD pin were high. However, the CANH, CANL pins did not move at all. The CANH, CANL pin appeared to be active, but no signal was emitted. In addition, when the CAN frame was sent to uja1169 via PC CANlink for testing, the RXD pin became low again.
I will attach the picture, so please check it out.
I monitored the ESR1 register and the ECR register during the test, and the results are as follows.
ESR1 : 0b 00000000 00101000 01000000 00110110
ECR : 0b 00000000 00000000 00000000 xxxxxxxx(increasing gradually)
I know these represent errors, but I don't know how to deal with them. Please help me figure it out.
Hi,
as I wrote, using sbc_uja1169_s32k144 example SCB will leave default Forced Normal mode. And so CAN transceiver must be enabled, which is not done in that example. So do below modifications in SBC component, generate PE code and build/debug. CAN communication should work with your code.
BR, Petr
I tried to follow up on your reply but failed to open CAN communication through UJA1169. The reason has not been found yet, so the S32K144 EVB is connected to another CAN transceiver.
Here's one thing I'm curious about: I confirmed that using the example [FlexCAN_s32k144] I'm sending and receiving CAN. In that example, It use MB0 as the transmitting buffer and MB4 as the receiving buffer, but how do I configure the code to implement both transmission and reception in one buffer?
Hi,
why do you want to have single MB for transmission and reception?
At the same time it is not possible, the MB can be set up either for transmission or reception.
You can set the RTR bit for TX MB, then after successful transmission the MB becomes receive MB with the same ID.
BR, Petr