AnsweredAssumed Answered

s32k144 UART Callback

Question asked by Altamash Abdul Rahim on Mar 25, 2018
Latest reply on Sep 25, 2018 by Kasun Dinesh

Hello i'm using Uart communication in s32k144 in interrupt mode with the sdk generated by Processor Expert. I'm trying to use the Callback function for receiving data and send data continuously in while loop. The code stops transmitting after 4 bytes and niether does it receives. Code snippet below:

 void ThisIsMyRXCallback(void *driverState, uart_event_t event, void *userData)
{
    PINS_DRV_TogglePins(PTD,(LED15));
}

int main(void)
{
CLOCK_SYS_Init(g_clockManConfigsArr,CLOCK_MANAGER_CONFIG_CNT,g_clockManCallbacksArr,CLOCK_MANAGER_CALLBACK_CNT);
    CLOCK_SYS_UpdateConfiguration(0U, CLOCK_MANAGER_POLICY_FORCIBLE);
    INT_SYS_InstallHandler(LPIT0_Ch0_IRQn,&LPIT_ISR,(isr_t *)0);
    LPUART_DRV_Init(INST_LPUART1, &lpuart1_State, &lpuart1_InitConfig0);
    LPUART_DRV_ReceiveData(INST_LPUART1,(uint8_t *)&datas,1);
    LPUART_DRV_InstallRxCallback(INST_LPUART1,ThisIsMyRXCallback,NULL);
    LPIT_DRV_Init(INST_LPIT1, &lpit1_InitConfig);
    LPIT_DRV_InitChannel(INST_LPIT1, 0, &lpit1_ChnConfig0);
    LPIT_DRV_StartTimerChannels(INST_LPIT1,(1<<0));
    PINS_DRV_Init(NUM_OF_CONFIGURED_PINS,g_pin_mux_InitConfigArr);
    PINS_DRV_SetPinsDirection(PTD,(LED15));
    PINS_DRV_SetPins(PTD,LED15);
  /* For example: for(;;) { } */
    for(;;)
    {
        uint8_t data[20] = "Hello World\r\n";
        LPUART_DRV_SendData(INST_LPUART1,(const uint8_t *)&data,strlen(data));
        Delay(500);
    }

}

Outcomes