I'm trying to enable serial output in my project using the CFG_PRINTF define, but it's causing my program to go into what appears to be an infinite loop in the UART2_Handler function.
Stepping through the code I can see the 'idd' value read from the UART2_IIR_FCR_REG register is 0x7, which the datasheet tells me is a reserved value. The switch statement doesn't have a handler for that value, and the function is called again as soon as it returns. This continues until the watchdog expires, and it happens during initialisation every time I run my program with CFG_PRINTF defined (specifically, it happens at line 295 of uart2.c in the uart2_init function).
Can you give me any insight into what I might have done to generate this error?
Keywords:
Device:
Hi Eric,
Can you please let me know on which example your project is based ? and apart from defining the CFG_PRINTF, did you have any other configuration on the UART part of the project ?
I am trying to replicate this on the ble_app_peripheral example by printing some data (have the CFG_PRINTF defined and the invoke the arch_printf() function by including the arch_console.h file in my project) and i am not able to get what you are mentioning. The 0x07 IID is not reserved, is an interrupt that indicates the busy detect, that means that the UART is operating and you are trying to configure it by changing the values of the LCR register.
Thanks MT_dialog
Hi MT,
我认为我的项目是基于empty_peripheral_template, but that was a while ago now.
I haven't done anything else with the UART system. I'm not even printing anything.
My mistake concerning the meaning of the IID, I don't know where I got that idea from.
In the course of typing this comment I've found the solution, however.
It turns out the UART was being configured twice because periph_init was being called directly by system_init as well as by my own app_on_init handler.
Thank you for your help.