CAN PAL S32K144EVB

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

CAN PAL S32K144EVB

Jump to solution
1,589 Views
Coding_Torque-SDRS
Contributor III

Hello Community Members !

                          I'm presently working on CAN module in S32K144 EVB and looking for some support to send a dummy message through CAN0 module and sending it via PTE4 and PTE5 pins. And i'm using a CANanalyser to check for CAN messages. But I cant able to read it in Vector CAN box.

                         Do I've to change the clock configuration in CLOCK_SYS_Init or anything I've to change. My code has been attached for the reference. Please do let me know about any modification in it?

My Code:

#include "sdk_project_config.h"
#include <interrupt_manager.h>
#include <stdint.h>
#include <stdbool.h>
#include "peripherals_can_pal0.h"
 
#define MASTER
/*#define SLAVE*/
 
/* Definition of the TX and RX message buffers depending on the bus role */
#if defined(MASTER)
    #define TX_MAILBOX  (1UL)
    #define TX_MSG_ID   (1UL)
    #define RX_MAILBOX  (0UL)
    #define RX_MSG_ID   (2UL)
 
void BoardInit(void);
void BoardInit(void)
{
 
    /* Initialize and configure clocks
     *  -   Setup system clocks, dividers
     *  -   Configure FlexCAN clock, GPIO
     *  -   see clock manager component for more details
     */
    //CLOCK_DRV_Init(&clockMan1_InitConfig0);
//Clock configuration
CLOCK_SYS_Init(g_clockManConfigsArr, CLOCK_MANAGER_CONFIG_CNT, g_clockManCallbacksArr, CLOCK_MANAGER_CALLBACK_CNT);
CLOCK_SYS_UpdateConfiguration(0U, CLOCK_MANAGER_POLICY_AGREEMENT);
 
    /* Initialize pins
     *  -   Init FlexCAN and GPIO pins
     *  -   See PinSettings component for more info
     */
    PINS_DRV_Init(NUM_OF_CONFIGURED_PINS0, g_pin_mux_InitConfigArr0);
}
volatile int exit_code = 0;
 
int main(void)
{
    /* Do the initializations required for this application */
    BoardInit();
CAN_Init(&can_instance0, &can_config0);
        can_buff_config_t buff_config0 = {
                    .enableFD = false,
                    .enableBRS = false,
                    .fdPadding = 0,
                    .idType = CAN_MSG_ID_STD,
                    .isRemote = false
                };
 
        CAN_ConfigTxBuff(&can_instance0, TX_MAILBOX, &buff_config0);
        // Example dummy message
        can_message_t dummyMessage;
        dummyMessage.id = 0x123; // Example message ID
        dummyMessage.length = 8; // Example data length
        dummyMessage.data[0] = 0xAA; // Example data bytes
        // Populate other data bytes as needed
 
        // Call CAN_Send function to send the message
        status_t sendStatus =
        CAN_Send(&can_instance0, TX_MAILBOX, &dummyMessage);
        if (sendStatus != STATUS_SUCCESS) {
             //Handle send error
        }
        CAN_Deinit(&can_instance0);
 
    while(1) {
    CAN_Init(&can_instance0, &can_config0);
        CAN_Send(&can_instance0, TX_MAILBOX, &dummyMessage);
    }
for(;;) {
      if(exit_code != 0) {
        break;
      }
    }
    return exit_code;
}

 

Labels (1)
Tags (3)
0 Kudos
Reply
1 Solution
1,549 Views
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @Coding_Torque-SDRS,

It seems you are using the example for CAN PAL S32K144, is this correct? Have you modified any of the configurations or code? 

Do you have EVB board powered by external supply into J16? The SBC chip is powered by this external 12V source. Also, for CAN FD communication to work, another ECU with CAN termination must be connected for proper communication, with standard CAN, you can communicate only between ECU and Vector CAN Box.

Best regards,
Julián

View solution in original post

4 Replies
1,550 Views
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @Coding_Torque-SDRS,

It seems you are using the example for CAN PAL S32K144, is this correct? Have you modified any of the configurations or code? 

Do you have EVB board powered by external supply into J16? The SBC chip is powered by this external 12V source. Also, for CAN FD communication to work, another ECU with CAN termination must be connected for proper communication, with standard CAN, you can communicate only between ECU and Vector CAN Box.

Best regards,
Julián

1,346 Views
Coding_Torque-SDRS
Contributor III

@Julián_AragónM 

I've identified a minor oversight on my part that was causing the issue. It turns out that not using the CAN termination resistor was the culprit.

Once I rectified this oversight by implementing the termination resistor, the CAN reception began functioning flawlessly. Thanks for the support.

1,431 Views
Coding_Torque-SDRS
Contributor III

@Julián_AragónM 

Now I can able to transmit CAN message. Thanks for the support. If you think you can help me with this issue it'll be great - https://community.nxp.com/t5/S32-Design-Studio/CAN-PAL-Example-S32K144/m-p/1837077#M12090 

0 Kudos
Reply
1,516 Views
Coding_Torque-SDRS
Contributor III

@Julián_AragónM Thanks for the support it really helps. I'll try it out and let you update on the CAN.

0 Kudos
Reply