AnsweredAssumed Answered

FRDM-K82F PIT triggering hardfault when used with FLEXIO Uart

Question asked by Lalit Kumar on Jul 16, 2016
Latest reply on Jul 16, 2016 by Lalit Kumar

Hi,

I'm implementing flexio uart with pit, but the board is going into hard fault at the first call of enable interrupt or setting timer. I am initializing PIT in my main:

void pit_init(void)
{
    pit_config_t        pitConfig;

    PIT_GetDefaultConfig(&pitConfig);
    PIT_Init(PIT, &pitConfig);
}

 

Then in a library file I'm initializing Flexio UART and PIT interrupts.

uart_init();

    PORT_SetPinMux(PORTB, SIM808_PWR, kPORT_MuxAsGpio);

    PIT_SetTimerPeriod(PIT, kPIT_Chnl_0, MSEC_TO_COUNT(1000000U, PIT_SOURCE_CLOCK));

    PIT_EnableInterrupts(PIT, kPIT_Chnl_0, kPIT_TimerInterruptEnable);

    EnableIRQ(PIT0_IRQn);

 

Here is my uart_init:

void uart_init(void)
{
    flexio_uart_config_t        uart_config;
    FLEXIO_UART_GetDefaultConfig(&uart_config);

    uart_dev.flexioBase            = BOARD_FLEXIO_BASE;
    uart_dev.RxPinIndex            = SIM808_RX;
    uart_dev.TxPinIndex            = SIM808_TX;
    uart_dev.shifterIndex[0]    = 2U;
    uart_dev.shifterIndex[1]    = 3U;
    uart_dev.timerIndex[0]        = 2U;
    uart_dev.timerIndex[1]        = 3U;

    FLEXIO_UART_Init(&uart_dev, &uart_config, FLEXIO_CLOCK_FREQUENCY);
    FLEXIO_UART_TransferCreateHandle(&uart_dev, &g_uart_handle, gsm_uart_event_handler, NULL);
}



 

The exact code where hard fault triggers is "base->CHANNEL[channel].LDVAL = count;".  Also is there any example for Parallel Transmit on FLEXIO Bus, please point me to that.

Thanks in advance for help

Outcomes