IMXRT1024 LPUART Handler Passing Parameter Fail

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

IMXRT1024 LPUART Handler Passing Parameter Fail

Jump to solution
774 Views
Lukas_Frank
Senior Contributor I

Hi Dear Authorized,

I am just trying to pass my own pointer struct as parameter to the "EXAMPLE_LPUART_IRQHandler" method.

 

In default SDK example of LPUART EDMA Ring Buffer :

...
..
.
#define EXAMPLE_LPUART_IRQHandler      LPUART1_IRQHandler
#define EXAMPLE_LPUART_IRQn            LPUART1_IRQn
.
..
...
void EXAMPLE_LPUART_IRQHandler(void)
{
    uint32_t status            = LPUART_GetStatusFlags(EXAMPLE_LPUART);
    uint32_t enabledInterrupts = LPUART_GetEnabledInterrupts(EXAMPLE_LPUART);

    /* If new data arrived. */
    if ((0U != ((uint32_t)kLPUART_IdleLineFlag & status)) &&
        (0U != ((uint32_t)kLPUART_IdleLineInterruptEnable & enabledInterrupts)))
    {
        (void)LPUART_ClearStatusFlags(EXAMPLE_LPUART, kLPUART_IdleLineFlag);
        isIdleLineDetected = true;
        receivedBytes      = EXAMPLE_RING_BUFFER_SIZE -
                        EDMA_GetRemainingMajorLoopCount(EXAMPLE_LPUART_DMA_BASEADDR, LPUART_RX_DMA_CHANNEL);
        receivedBytes += (EXAMPLE_RING_BUFFER_SIZE * ringBufferFlag) - ringBufferIndex;

        if (receivedBytes > 32U)
        {
            __NOP();
        }
    }
    LPUART_TransferEdmaHandleIRQ(EXAMPLE_LPUART, &g_lpuartEdmaHandle);
    SDK_ISR_EXIT_BARRIER;
}

 

What I am trying to do:

 

void EXAMPLE_LPUART_IRQHandler(myStruct* myStruct_param)
{
        ...
        ..
        .   
        myStruct_param->isIdleLineDetected = true;
        myStruct_param->receivedBytes      = EXAMPLE_RING_BUFFER_SIZE - EDMA_GetRemainingMajorLoopCount(EXAMPLE_LPUART_DMA_BASEADDR, LPUART_RX_DMA_CHANNEL);
        myStruct_param->receivedBytes += (EXAMPLE_RING_BUFFER_SIZE * ringBufferFlag) - myStruct_param->ringBufferIndex;

        if (myStruct_param->receivedBytes > 32U)
        {
            __NOP();
        }
    }
    LPUART_TransferEdmaHandleIRQ(EXAMPLE_LPUART, &g_lpuartEdmaHandle);
    SDK_ISR_EXIT_BARRIER;
}

 

I just manupulate "WEAK LPUART1_IRQHandler" with parameters but it didn't work. Comments says it can be only override. How do we overload this method as stated above?

 

Thanks and Regards.

0 Kudos
1 Solution
725 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi

No parameters can be explicitly passed to an interrupt handler because it is designed to be called by the hardware.

 

Regards

Daniel

View solution in original post

2 Replies
726 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi

No parameters can be explicitly passed to an interrupt handler because it is designed to be called by the hardware.

 

Regards

Daniel

685 Views
Lukas_Frank
Senior Contributor I

Thank you @danielchen 

0 Kudos