Issue with CAN Frame Transmission and Reception Using PIT on S32K312EVB-Q172 board

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

Issue with CAN Frame Transmission and Reception Using PIT on S32K312EVB-Q172 board

160 Views
Mohmedsohel
Contributor II

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:

  • Board: S32K312EVB-Q172
  • Peripheral: CAN, utilizing PIT for periodic transmission
  • PIT clock frequency: 30 MHz
  • Desired PIT period: 1 second (I calculated a load value of 30,000,000 for this)
  • System clock: 120 MHz
  • No errors are shown during build or transmission, but frames are not appearing on the CAN bus

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 

 

Tags (1)
0 Kudos
Reply
3 Replies

142 Views
Julián_AragónM
NXP TechSupport
NXP TechSupport

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

0 Kudos
Reply

137 Views
Mohmedsohel
Contributor II

 

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

Tags (1)
0 Kudos
Reply

117 Views
Julián_AragónM
NXP TechSupport
NXP TechSupport

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:

Julin_AragnM_0-1728074436056.png

Best regards,
Julián

0 Kudos
Reply