UART Interrup (UART_IIR_FCR_REG&0x0F => 7 which is "reserved")

⚠️
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.wsdof.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
9 posts / 0 new
Last post
jarirenejensen
Offline
Last seen:1 year 2 months ago
Joined:2017-02-05 14:44
UART Interrup (UART_IIR_FCR_REG&0x0F => 7 which is "reserved")

I am using UART1 for communication with 2 different devices (2 sets of Rx and Tx wires) connected to separate pins. I first read some data from one device. Then I reconfigure the pins so that UART1 Rx and TX connects to a different set of GPIOs. Then I reconfigure the baud rate and attempts to communicate with the next device but the uart init routine I get an UART interrupt with the Interrupt ID Bits [3-0] = 0111.
If I set a break point in the UART1 ISR and just press GO! as soon as I hit the break point it continues OK, but UART2 stops working.

Why does that happen?
What am I supposed to do about this "reserved" state of the Interrupt ID?

void user_uart_init(uint16_t baudr, uint8_t dlf_value, uint8_t mode)
{
SetBits16(CLK_PER_REG, UART1_ENABLE, 1); // enable clock - always @16MHz
SetBits16(UART_LCR_REG, UART_DLAB, 0);
SetWord16(UART_IIR_FCR_REG,0x87); // Rx FIFO trigger level set to 1/2 FULL, which is 16/2 = 8 bytes
SetWord16(UART_IER_DLH_REG, 0);
SetBits16(UART_LCR_REG, UART_DLAB, 1);
SetWord16(UART_IER_DLH_REG, (baudr >> 8) & 0xFF);
SetWord16(UART_RBR_THR_DLL_REG, baudr & 0xFF);
SetWord16(UART_LCR_REG,mode);
SetWord16(UART_DLF_REG,dlf_value);
//ENABLE TX INTERRUPTS, REGISTER IER IF UART_LCR_REG.DLAB=0
SetBits16(UART_LCR_REG, UART_DLAB, 0); -----------> Interrupt with UART_IIR_FCR_REG&0x0F == 7

Device:
PM_Dialog
Offline
Last seen:3 days 3 hours ago
Staff
Joined:2018-02-08 11:03
Hi jarirenejensen,

Hi jarirenejensen,

我不能够理解的连接图, so please provide me little more information about it. Let me ask you some question to understand the connection between the devices and the DA1585. Could you please clarify how the 2 devices are connected to UART? Are you using only the UART1 or both UART1 and UART2? You mentioned that the UART2 stops working.

Thanks, PM_Dialog

jarirejenensen
Offline
Last seen:2 weeks 1 day ago
Joined:2014-03-28 09:03
I use UART2 for debug out.

I use UART2 for debug out. UART2 stopping may actually be caused by a sleep arising from SW flow stopping.

Please see attached schematics.

When switching between communication with device A and device B I reroute the GPIOs like so:

void set_pad_fn_uart_deviceA(void) // set gpio port function mode
{
// Disable deviceB UART connection
GPIO_ConfigurePin(DEVB_RX_GPIO_PORT, DEVB_RX_GPIO_PIN, INPUT, PID_GPIO, false);
GPIO_ConfigurePin(DEVB_TX_GPIO_PORT, DEVB_TX_GPIO_PIN, INPUT, PID_GPIO, false);
// Enable Device A UART connaction
GPIO_ConfigurePin(DEVA_RX_GPIO_PORT, DEVA_RX_GPIO_PIN, OUTPUT, PID_UART1_TX, false);
GPIO_ConfigurePin(DEVA_TX_GPIO_PORT, DEVA_TX_GPIO_PIN, INPUT, PID_UART1_RX, false);
}

void set_pad_fn_uart_deviceB(void) // set gpio port function mode
{
// Disable deviceA connection
GPIO_ConfigurePin(DEVA_RX_GPIO_PORT, DEVA_RX_GPIO_PIN, INPUT, PID_GPIO, false);
GPIO_ConfigurePin(DEVA_TX_GPIO_PORT, DEVA_TX_GPIO_PIN, INPUT, PID_GPIO, false);
// Enable deviceB UART connection
GPIO_ConfigurePin(DEVB_RX_GPIO_PORT, DEVB_RX_GPIO_PIN, OUTPUT, PID_UART1_TX, false);
GPIO_ConfigurePin(DEVB_TX_GPIO_PORT, DEVB_TX_GPIO_PIN, INPUT, PID_UART1_RX, false);
}

After the pad re-route fn is called I re-init the uart:
Either: user_uart_init(UART_BAUDRATE_9K6, UART_FRAC_BAUDRATE_9K6, UART_CHARFORMAT_8);
Or: user_uart_init(UART_BAUDRATE_115K2, UART_FRAC_BAUDRATE_115K2, UART_CHARFORMAT_8);
Depending on device A or B.
And it is in the init function as soon as IRQ is enabled I see the issue.

Rene

Attachment:
PM_Dialog
Offline
Last seen:3 days 3 hours ago
Staff
Joined:2018-02-08 11:03
Hi jarirejenensen,

Hi jarirejenensen,

Thanks for uploading the schematic that you are using. But could you please clear out which your problem is in order to try to replicate it? As I am able to understand from your description, the problem is that the UART2 stops working? Also, when switching UART between device A and device B and you reroute the GPIOs, which is the problem?

Thanks, PM_Dialog

jarirenejensen
Offline
Last seen:1 year 2 months ago
Joined:2017-02-05 14:44
Hi I am getting an UART

Hi I am getting an UART Interrup that is reserved. I do not know how to handle. I am currently ignoring it. (UART_IIR_FCR_REG&0x0F => 7 which is "reserved")
Should this interrupt be ignored?

Datasheet Revision 3.2 04-Apr-2018
Table 37: UART Interrupt Priorities
Interrupt ID Bits [3-0] = 0111 : Priority Lowest : Reserved

Rene

jarirenejensen
Offline
Last seen:1 year 2 months ago
Joined:2017-02-05 14:44
I have gotten away with

我已经忽略这个中断。But I am now in a situation where I am getting it constantly making everything else grind to a halt.
Inserting a sleep period seems to mediate the problem.

Can I reset the UART some how to avoid the sleep?

René

PM_Dialog
Offline
Last seen:3 days 3 hours ago
Staff
Joined:2018-02-08 11:03
Hi jarirenejensen,

Hi jarirenejensen,

I am not able to understand which your problem is. When the device enters the sleeps mode, the UART does not working? So, you want to not entering the sleep mode? Did I understand correctly? Please, clarify which is your problem.

Thanks, PM_Dialog

jarirenejensen
Offline
Last seen:1 year 2 months ago
Joined:2017-02-05 14:44
The problem is that I cannot

The problem is that I cannot switch usage of the UART - it gets stuck in an never ending reception of this interrupt.
If I sleep between usage 1 and reconfiguration for usage 2 it works.
Thus I
1 disable the UART.
2 Enters sleep
3 Wakes up from sleep
4 Configure the UART other usage.

I really do not want to have to go via the sleep mode as it adds complexity and makes things take longer.And worse it might not be the sleep that saves me, maybe a If the sleep period is too short it does not.
I guess the sleep fixes the problem because the UART is switched off during sleep and is thus hardware reset - but I do not know that.

Is it the change in baud rate that is the problem?
Is it the change in GPIO usage that is the problem?

BR René

PM_Dialog
Offline
Last seen:3 days 3 hours ago
Staff
Joined:2018-02-08 11:03
Hi jarirenejensen,

Hi jarirenejensen,

Sorry for the delay, I am trying to replicate your issue and I will get back to you as soon as possible. Without any sleep mode, are you able to reconfigure the UART? I assume that it is not a baud rate or a GPIO usage issue.

Thanks, PM_Dialog