Hello NXP Community,
I am working with the S32K312EVB-Q172 and attempting to transmit and receive CAN frames using the Periodic Interrupt Timer (PIT) for timed message transmission. However, I am facing difficulties as the CAN frames are neither being transmitted nor received.
Here are some details about my setup:
I have verified the configurations for both PIT and CAN, as well as the physical connections. Despite this, the issue persists. I am attaching the necessary code files and configurations for further reference.
Could you please help me identify any potential issues or suggest areas to investigate further?
Thank you in advance for your assistance. @nxptechsupport @nxp @nxp @nxp5
Hi @Mohmedsohel,
Could you share how are you testing your code? Are you using a CAN to USB analyzer? Keep in mind that two nodes (or one node and a CAN analyzer) are needed for CAN communication to work. Are you able to see data transfer without the PIT timer?
Most likely your issue is with priorities when entering interrupts. The Interrupt service routing should be a small non-blocking code, but you have a transfer function in your handler. I would recommend using interruption, or a flag in the handler of the interrupt to signal a new transfer.
void PitNotification(void)
{
interruptFlag = 1;
}
int main(void)
{
...
/* Infinite loop */
for (;;)
{
if(1 == interruptFlag)
{
interruptFlag = 0
// Transmit CAN message
FlexCAN_Ip_Send(INST_FLEXCAN_0, TX_MB_IDX, &tx_info, TX_MSG_ID, dummyData);
}
}
}
Best regards,
Julián
Thank you for your suggestions.@Julián_AragónM
I am using a Peak CAN analyzer for testing my code. Without the PIT, I still cannot transmit or receive any CAN data. The issue persists regardless of using the PIT timer or not. Could there be another factor I might be overlooking that's causing the transmission and reception failure?
Additionally, I would appreciate if you could guide me on whether I might be doing something wrong while using the library functions for CAN and PIT. Is there something specific I should be paying attention to when using these functions?
Best Regards : Md.Sohel
Hi @Mohmedsohel,
If CAN transmission is not working without PIT, maybe check the CAN analyzer configuration, such as baud rate, sample point, connections, etc.
You can also test the Example S32K312 CAN Transmit & Receive Using MB & FIFO DMA DS3.5 RTD300 - NXP Community demo. It configures a CAN application at 500kbps with the PIT module:
Best regards,
Julián