⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.xmece.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
3 posts / 0 new
Last post
Eric Scammell
Offline
Last seen:2 years 11 months ago
Joined:2017-03-15 13:28
UART2 handler loop

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:
MT_dialog
Offline
Last seen:2 months 2 days ago
Staff
Joined:2015-06-08 11:34
Hi Eric,

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

Eric Scammell
Offline
Last seen:2 years 11 months ago
Joined:2017-03-15 13:28
Hi MT,

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.