I'm trying to setup an interrupt driven UART comm system over UART1 on a TWR-K64F120M. I'm running into trouble getting the generated code to execute properly. It's likely I've missed something but I'm obviously not sure what.
Here's what I've setup:
1) Created a new KDS project for the TWR-K64F120M
2) Added an fsl_uart component
3) Set the RxD and TxD to the proper pins.
4) Configured baud rate for 115200bps
5) Enabled a callback (currently empty)
6) Enabled the RX_TX IRQ
7) Built and run the program.
8) Runs properly (just blinking an LED) until I transmit a character, at which point the IRQ fires (checked with a breakpoint), and calls the default peripheral driver IRQ handler (UART_DRV_IRQHandler). At this point, my LED stops blinking and if I pause the debugger, I'm sitting at the start of the Default_Handler section of the startup.MK64F12.S file. I'm also not getting to my callback function which should toggle a second LED each time it fires.
I know my UART is configured to the correct clock/baud settings because I was able to successfully implement a polling receiver by just looping and looking for data in the RxD register.
If I comment out the autogenerated function then the program doesn't crash. It does just spin in the IRQ though because the flag is never being cleared with a read. Specifically, the issue seems to be with the call to UART_HAL_Getchar which is responsible for reading the register and clearing the flag. If I comment out solely that line (and the while loop around it, as this chip supports a UART FIFO), then again, I just spin with repeated IRQ fires but at least I'm not apparently resetting.
Update (1/19/15): I replaced the call to the UART_DV_IRQHandler with a while loop that just reads UART1's data register while the RDRF flag is set and this works just fine for receiving characters. So it seems like there's something misconfigured with my UART HAL Driver. Not sure what though...
Message was edited by: Drew Kelley