FRDM-K82F PIT triggering hardfault when used with FLEXIO Uart

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

FRDM-K82F PIT triggering hardfault when used with FLEXIO Uart

677 次查看
lalit0611
Contributor II

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 Smiley Happy

标签 (1)
标记 (2)
0 项奖励
1 回复

460 次查看
lalit0611
Contributor II

I feel so stupid right now, I didn't call pit_init inside my main :smileysad:, everything works fine now . If anyone has link for an example for parallel transmit/receive, please post the link.

0 项奖励