UART Interpup(UART_IIR_FCR_REG&0x0F => 7为“保留”)

⚠️
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个帖子/ 0新
Last post
Jarirenejensen.
Offline
Last seen:2个月前1年
Joined:2017-02-05 14:44
UART Interpup(UART_IIR_FCR_REG&0x0F => 7为“保留”)

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.

为什么会发生这种情况?
我应该做什么关于中断ID的“保留”状态?

void user_uart_init(uint16_t baudr, uint8_t dlf_value, uint8_t mode)
{
setBits16(CLK_PER_REG,UART1_ENABLE,1);//启用时钟 - 始终@ 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

设备:
PM_Dialog
Offline
Last seen:13小时23分钟前
Staff
Joined:2018-02-08 11:03
Hi jarirenejensen,

Hi jarirenejensen,

我无法理解连接图,所以请为我提供一些有关它的信息。让我问你一些问题要了解设备与DA1585之间的连接。请澄清2个设备如何连接到UART?您只使用UART1或UART1和UART2吗?你提到uart2停止工作。

Thanks, PM_Dialog

jarirejenensen
Offline
Last seen:3 weeks 3 days 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)//设置GPIO端口函数模式
{
// 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);
//启用设备auart connectaction
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);
或:user_uart_init(uart_baudrate_115k2,uart_frac_baudrate_115k2,uart_charformat_8);
取决于设备A或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:13小时23分钟前
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:2个月前1年
Joined:2017-02-05 14:44
Hi I am getting an UART

嗨,我得到了保留的UART Interfup。我不知道如何处理。我目前忽略了它。(UART_IIR_FCR_REG&0x0f => 7,它是“保留”)
Should this interrupt be ignored?

Datasheet Revision 3.2 04-APR-2018
Table 37: UART Interrupt Priorities
中断ID位[3-0] = 0111:优先级最低:保留

Rene

Jarirenejensen.
Offline
Last seen:2个月前1年
Joined:2017-02-05 14:44
我已经离开了

我已经忽略这个中断。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?

仁茹

PM_Dialog
Offline
Last seen:13小时23分钟前
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:2个月前1年
Joined:2017-02-05 14:44
问题是我不能

问题是我不能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.
因此,我
1禁用UART。
2进入睡眠
3从睡梦中醒来
4 Configure the UART other usage.

我真的不想通过睡眠模式来通过睡眠模式,因为它增加了复杂性并且使事情变长。更糟,它可能不是节省我的睡眠,也许a如果睡眠周期太短,那就没有。
我猜睡眠修复了问题,因为UART在睡眠期间关闭,因此硬件复位 - 但我不知道。

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

布鲁尼茹

PM_Dialog
Offline
Last seen:13小时23分钟前
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