Looking for CAN Protocol Reference Project for S32K148

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Looking for CAN Protocol Reference Project for S32K148

1,229 Views
Joseph_David
Contributor I

Hi everyone,

I'm currently working on the CAN protocol using the S32K148 microcontroller. I'm looking for a basic reference project to help me get started, especially something beyond the default loopback example.

Unfortunately, I couldn't find a suitable example in the official SDK or example projects — only the loopback demo is available.

If anyone has a working CAN communication project (Tx/Rx using real CAN nodes or transceivers) for the S32K148, I’d really appreciate it if you could share or point me to one.

Best regards,
M.J.David

0 Kudos
Reply
5 Replies

1,199 Views
Joseph_David
Contributor I

Hi @Julián_AragónM 

    I am looking for the Can_43_FLEXCAN and Canlf. I have attached one photo for reference.  If you have anything related to it let me know.

Joseph_David_0-1754371620448.png

 

0 Kudos
Reply

1,165 Views
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @Joseph_David

You can do the same steps I've shared but in the MCAL layer. Add the Port component and initialize both PTE4 & PTE5 and disable Can Loop Back Mode in the CanController container.

Snag_a4e3ca.png

Best regards,
Julián

0 Kudos
Reply

1,148 Views
Joseph_David
Contributor I

Hi  @Julián_AragónM 

     I have configurations in the MCAL Layer according to my pin configurations. I have disabled the loopback mode. I am getting bus synchronization issue. I am attaching the screen shots for reference. Once look into it.

Joseph_David_0-1754546074846.pngJoseph_David_1-1754546099045.pngJoseph_David_2-1754546127625.pngJoseph_David_3-1754546204913.pngJoseph_David_4-1754546226044.png

 

0 Kudos
Reply

1,133 Views
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @Joseph_David

Simply configuring the pins and disabling loopback should work. Also add the port component and initialize them. I've attached the project so you can test it:

Snag_15dbddf.png

Best regards,
Julián

0 Kudos
Reply

1,206 Views
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @Joseph_David,

Since the CAN transceiver for the S32K148-EVB does not need any special initialization, you can do some changes to the RTD example for it to work in normal operation:

1. Firstly, enable the "Pins" component and initialize the CAN0 pins. (By default, PTE4 and PTE5):

Snag_83766b.png

You also need to change the Pins' functional group name from "BOARD_InitPins" to "PortContainer_0_BOARD_InitPeripherals".

Snag_86e62e.png

2. In Peripherals, change the FlexCAN operation mode from "Loopback" to "Normal mode or user mode":

Snag_94ec34.png

3. Add in "Drivers" the "Port_Ip" component to the project, and inside it, define both CAN0_RX/TX pins (PCR 132 & 133):

Snag_8d4623.pngSnag_8a2d4a.png

4. Finally, in the main.c code, add the Port_Ci_Port_Ip.h header, and initialize the pins with the following line:

Port_Ci_Port_Ip_Init(NUM_OF_CONFIGURED_PINS_PortContainer_0_BOARD_InitPeripherals, g_pin_mux_InitConfigArr_PortContainer_0_BOARD_InitPeripherals);

You can connect a CAN Analyzer, such as the PCAN-USB to header J11, or simply add another EVB as a secondary node, and the example code will transmit 10 messages, as defined by the FLEXCAN_NUMBER_OF_MSG definition:

Snag_912605.png

Hope this helps.

Best regards,
Julián

0 Kudos
Reply