Can Examples s32k344

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

Can Examples s32k344

Jump to solution
1,624 Views
AchrafOukheir
Contributor III

Hello All,

I’m working with the HVBMS RDK344BMU and trying to set up CAN communication. I’ve found a loopback example Can_Example_S32K344 , but I need to modify it for normal mode. Specifically, I want to observe the output on the CAN bus (VCU CAN).

Here are the steps I’ve taken so far:

Initialized the port . doing all routing :CAN0TX +CAN0RX + SPIS5 PCS2
Configured pins for VCU Can.
Set up the CAN: Disable loopback.
Tried transmitting data.

AchrafOukheir_0-1715883887415.png

 

However, I’m not getting the expected results. Could someone guide me on how to modify the example for normal mode and troubleshoot the issue?
the CAN is always busy

AchrafOukheir_1-1715883943436.png

 

Any help would be greatly appreciated!

Thank you,


Tags (2)
0 Kudos
Reply
1 Solution
1,511 Views
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @AchrafOukheir,

Please help me confirming if your CAN analyzer instance inside the logic analyzer is set to the correct baud rate:

Julin_AragnM_0-1716404217638.png

Best regards,
Julián

View solution in original post

0 Kudos
Reply
6 Replies
988 Views
BillWen
Contributor II

Hi AchrafOukheir:

I try to do the same things with you by S32K358 device, I also use the same example code "Can_Example_S32K358", I think is the same with 344.

I also have same problem, I try to use PCAN VIEW to check the can tx message, but I got nothing, I also have "the CAN is always busy" this problem, can you give me some idea or anything, please.

 

Thanks

BR, BillWen

0 Kudos
Reply
971 Views
AchrafOukheir
Contributor III

Hi @BillWen ,

I’ve been experimenting with the S32K358, and unfortunately, it’s not working for me either. Additionally, the Can_Example_S32K358 doesn’t include any pin configuration, which poses an obstacle when trying to activate the CAN interface. In my 800V hvbms EVAL board., we need to pull up certain pins to enable CAN functionality. I recommend checking these remarks; they might help you troubleshoot. Otherwise, it seems that their example lacks the minimal configuration needed to make it work with our EVAL board.

Best regards, Achraf

0 Kudos
Reply
951 Views
BillWen
Contributor II
Hi Achraf:

Thanks a lot for your reply.
So you mean you also cannot implement can function based on s32k358?
You are right, I think the Can_Example_S32K358 is for internal can loopback test, and I had try to use logic analyzer to get signal, but got nothing.
The other hand, I already create the port configuration for can. My purpose is use VCU_CAN pin and connect to PC computer and measure can signal by software application.

**bleep**, it is so difficult...

my main code:
int main(void)
{
uint8 u8TimeOut = 100U;
CanIf_bTxFlag = FALSE;
CanIf_bRxFlag = FALSE;
/* Initialize the Mcu driver */
#if (MCU_PRECOMPILE_SUPPORT == STD_ON)
Mcu_Init(NULL_PTR);
#elif (MCU_PRECOMPILE_SUPPORT == STD_OFF)
Mcu_Init(&Mcu_Config_VS_0);
#endif /* (MCU_PRECOMPILE_SUPPORT == STD_ON) */
/* Initialize the clock tree and apply PLL as system clock */
Mcu_InitClock(McuConf_McuModeSettingConf_McuModeSettingConf_0);

/* Initialize all pins using the Port driver */
Port_Init(NULL_PTR);

/* Initialize CanIf driver */
CanIf_Init(NULL_PTR);


#if (MCU_NO_PLL == STD_OFF)
while ( MCU_PLL_LOCKED != Mcu_GetPllStatus() )
{
/* Busy wait until the System PLL is locked */
}

Mcu_DistributePllClock();
#endif

Mcu_SetMode(McuModeSettingConf_0);

/* Initialize Platform driver */
Platform_Init(NULL_PTR);
static Can_PduType Can_PduInfo;

/* Can_CreatePduInfo(id, swPduHandle,length, sdu) */
Can_PduInfo = Can_CreatePduInfo(0U, 0U, 8U, Can_au8Sdu8bytes);
/* Initilize Can driver */
#if (CAN_43_FLEXCAN_PRECOMPILE_SUPPORT == STD_ON)
Can_43_FLEXCAN_Init(NULL_PTR);
#else
Can_43_FLEXCAN_Init(&Can_43_FLEXCAN_Config_VS_0);
#endif
Can_43_FLEXCAN_SetControllerMode(CanController_0, CAN_CS_STARTED);
while(count<20)
{
if((Can_43_FLEXCAN_Write(CanHardwareObject_1, &Can_PduInfo) == E_OK))
{
/* Wait until the message is successfully sent */
//while(!CanIf_bTxFlag)
while((!CanIf_bTxFlag) && (u8TimeOut != 0U))
{
Can_43_FLEXCAN_MainFunction_Write();
Can_DummyDelay(100U); /* Optional delay */
u8TimeOut--;
}
/* Reset the flag for the next transmission */
CanIf_bTxFlag = FALSE;

count++;
}
Can_DummyDelay(1000U);
}

Can_43_FLEXCAN_SetControllerMode(CanController_0, CAN_CS_STOPPED);
Can_43_FLEXCAN_DeInit();

Exit_Example((CanIf_bTxFlag && CanIf_bRxFlag) == TRUE);

return (0U);
}

If you have other idea, please tell me generously.

Thanks
BR, BillWen

0 Kudos
Reply
1,550 Views
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @AchrafOukheir,

Could you share how you are measuring the output? Are you using an oscilloscope/logic analyzer or a CAN Analyzer? 

Keep in mind that for user/normal mode a second node (another MCU or CAN Analyzer) must be connected to the bus line. You can use Example S32K344 FlexCAN_Ip TX/RX/EnhanceRXFIFO test S32DS3.4 RTD200 as reference for configuration.

Best regards,
Julián

0 Kudos
Reply
1,521 Views
AchrafOukheir
Contributor III

Hi Julián,

Thank you for your prompt response! I appreciate your assistance.

Regarding measuring the output, I am currently using a logic analyzer. Initially, I attempted to work with the VCU CAN, but encountered issues out put always LOW. Consequently, I switched to the CMU and BJB CANs, which provided some output visible in the logic analyzer.

AchrafOukheir_0-1716382667619.png

However, I’ve noticed that the measured output consists of error messages. Do you have any insights into why this might be happening? Your guidance would be greatly appreciated.
its the same main code of the Can_example , you can see that on the zip attached

Best regards, Achraf

0 Kudos
Reply
1,512 Views
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @AchrafOukheir,

Please help me confirming if your CAN analyzer instance inside the logic analyzer is set to the correct baud rate:

Julin_AragnM_0-1716404217638.png

Best regards,
Julián

0 Kudos
Reply