用da14580读取UART中的问题

⚠️
嗨,...感谢您来论坛。令人兴奋的消息!我们现在正在迁至我们的新论坛平台,将提供更好的功能,并包含在主对话框网站中。所有帖子和帐户都已迁移。我们现在只接受新论坛上的流量 - 请发布任何新线程https://www.dialog-seminile.com/support.。我们将在未来几天修复错误/优化搜索和标记。
13 posts / 0 new
最后一篇
dhrishi
离线
最后一次露面:3 years 3 months ago
加入:2017-02-10 09:56
用da14580读取UART中的问题

你好,

Our setup has a external MCU that is connected to DA14580 over UART. DA14580 and the MCU communicate with each other using a protocol we have designed.
DA14580正在等待UART读取5个字节标题。MCU发送具有data_length的标题(5字节)。然后,DA14580将UART_RED与要接收的data_length字节进行。
观察:
Assume, MCU has to send 5 byte header and 32 byte data.
The internal buffer used by the UART HW seems to be of 16 bytes. Because what we see is that the DA14580 receives the header properly and then tries to read 32 bytes in a go then if some part of data is already present in the UART HW buffer of DA14580 then the read callback is never called ie. the 32 bytes are never read completely.
如果在从MCU接收到实际数据之前调用的UART读取32个字节的UART,则整个读取成功,则读取回调已正确执行。

我们也试着阅读从DA14580 af一对一的字节ter the header is read. In this case, what happens is, (16 - 5) ie 11 bytes are read correctly one by one. Although, the other bytes are never received by DA14580 although they are already sent by the MCU.

Seems to be an issue with DA14580 UART. Could you please check and revert.
注意:我们还启用了HW级别流量控制,并仍然看到了这个问题。可以请确认HW流控制是否正常工作,并使用API​​ UART_FLOW_ON()打开

- Hrishikesh

Device:
LC._Dialog
离线
最后一次露面:2周2天前
职员
加入:2016-09-19 23:20
Hello Hrishikesh,

Hello Hrishikesh,

我目前正在调查这个问题,并将提供更新来解决这个问题。

最好的,
LC.

LC._Dialog
离线
最后一次露面:2周2天前
职员
加入:2016-09-19 23:20
Hello Hrishikesh,

Hello Hrishikesh,

The hardware FIFO is of 16 bytes and as per the standard providing interrupts at 1, 4, 8 and 14 bytes. What is the current interrupt level are you using? If you are having a trouble with the current interrup level, then you can do the following options

禁用FIFO并正常从接收器缓冲区读取数据。这可以通过监视RX数据可移中断和RX超时中断来实现。这样你就可以控制你拍摄多少数据。基于标题中的长度字段,您可以读取多个字节的递增。

The other option would be to configure your RTL interrupt to trigger for every byte received in the FIFO that includes receiving the header (works best at lower speeds (upto say 115200). This way you will read the data much according to your needs.

Please provide some more insight into your application implementation like the current baudrate, what is your RTL interrupt etc and how you reading the first header and then next data, that will be much helpfull in finding out the actual problem. Please let me know if you have any more concerns

最好的,
LC.

dhrishi
离线
最后一次露面:3 years 3 months ago
加入:2017-02-10 09:56
UART相关问题是

解决了UART相关问题。问题是UART流控制未启用。

We were using uart_flow_on() API after the call to uart_init()
这应该在SDK标题文件中记录在UART_FLOW_ON()中:在UART_INIT()之前需要调用此API以生效。

LC._Dialog
离线
最后一次露面:2周2天前
职员
加入:2016-09-19 23:20
你好Driishi,

你好Dhrishi,

The order of theuart_flow_on()andUART_INIT()should not matter for the Hardware flow control to be enabled. There should be some other reason this might be happening.

Please confirm if the issue you were facing is completely resolved.

最好的,
LC.

dhrishi
离线
最后一次露面:3 years 3 months ago
加入:2017-02-10 09:56
是的。我们面临的问题

是的。我们面临的问题完全解决。虽然,当我互换UART_FLOW_ON()和UART_INIT()时,我可以看到流量控制没有生效。
无论如何,我会再次在一次新的观察/调查结果中再次尝试并更新。

Thanks,
Hrishikesh

LC._Dialog
离线
最后一次露面:2周2天前
职员
加入:2016-09-19 23:20
Hello Hrishikesh,

Hello Hrishikesh,

Good to hear that it is resolved. I will review it if it isn't specified and make sure it is updated in relevant places.

最好的,
LC.

kqtrinh.
离线
最后一次露面:3 years 10 months ago
加入:2016-08-24 00:17
Hi LC,

Hi LC,

I am having similar issue with UART read from an external MCU as well.

阅读此帖子后,我通过调用UART_INIT()之后调用UART_FLOW_ON()来尝试。这没有帮助我。
我拥有的是一个UART2设置,可以在57.6kbps的外部MCU通信。将数据从DA发送到外部MCU很好。它能够接收DA发送的所有内容。但是,当从外部MCU接收到DA的UART数据有每个事务的帧错误。我附上了Saleae捕获让你看看。

在捕获中,DataToQPI是从DA到外部MCU发送的数据,而DataFromQPI是从外部MCU发送到DA的数据。

谢谢,
- khai

附件:
kqtrinh.
离线
最后一次露面:3 years 10 months ago
加入:2016-08-24 00:17
Hi LC,

Hi LC,

我想出了我的问题。我必须将RX引脚配置为Pull_up以下:

GPIO_ConfigurePin( GPIO_UART2_RX_PORT, GPIO_UART2_RX_PIN, INPUT_PULLUP, PID_UART2_RX, false );
Thanks,
- khai

kqtrinh.
离线
最后一次露面:3 years 10 months ago
加入:2016-08-24 00:17
Hi LC,

Hi LC,

Now that that RX PULL_UP line is out of the way, I have a follow on issue with reading the data on the RX line into DA buffer. Below is my code in reading the RX data out of UARt2:

BOOL READFROMCIIF(字节*数据,int data_len){
bool r = true;
短IDX = 0;
int nbytes = 0,bytes_left = data_len;

while(idx < data_len) {
// wait 1ms for FPGA to load a byte in the CI UART data register
qpiSpinCounter(TICK_1MSEC);

// find out how many bytes to send to ASIC's CI output buffer
// Khai: try using CI_OUTPUT_BUFFER_SZ instead of RX_CALLBACK_SIZE
if (bytes_left > CI_OUTPUT_BUFFER_SZ)
nbytes = CI_OUTPUT_BUFFER_SZ;
别的
nbytes = bytes_left;

// remove the bytes that will be retrieved from total remaining
bytes_left - = nbytes;

// read the bytes from ASIC
UART2_READ(数据+ IDX,NBYTES,NBULL);
Idx + = nbytes;
}
返回r;
}

在rx_callback_size = 8字节时,我已经使用了CI_OUTPUT_BUFFER_SZ = 256字节。调用者对此功能请求读取140字节。我看过rx线的leaee,所有140字节都在附加的logicdata文件中的电线上。但是,当上述功能遍历循环读取时,读入缓冲区的字节与电线上的内容不同。

当我使用rx_callback_size时,前16个字节看起来很好。之后,内存中的字节丢失并跳到接下来的几个字节。然后,其余的是在时间点的所有0。使用CI_OUTPUT_BUFFER_SZ时,我只会获得前16个字节,其余的是0s。

以某种方式指定每个读取的读取缓冲区大小似乎很重要。这必须正确阅读数据吗?

Thanks,
- khai

LC._Dialog
离线
最后一次露面:2周2天前
职员
加入:2016-09-19 23:20
Hello Khai,

Hello Khai,

I am unable to reproduce that issue on my end. So I am not exactly sure what is going wrong in this case. However, I would make a couple of suggestions.

1.请检查您是否相应地分配GPIO并且连接是正确的。我认为它们是正确的,因为您可以看到逻辑分析仪上的数据。

2.我附加一个来自实际驱动程序修改的示例驱动程序,以解决RX FIFO调整。尝试使用此驱动程序代替当前的驱动程序并检查是否解决了问题。请注意,这不是官方发布驱动程序,仅用于测试目的。

最好的,
LC.

kqtrinh.
离线
最后一次露面:3 years 10 months ago
加入:2016-08-24 00:17
Hi LC,

Hi LC,

In the new modified_uart2.c file in function uart2_init(uint16_t baudr, uint8_t dlf_value, uint8_t mode), what is the setting for the second parameter dlf_value? This parameter wasn't required in my uart2.c file.

你不应该还要发给我UART2.H文件吗?
Thanks,
- khai

LC._Dialog
离线
最后一次露面:2周2天前
职员
加入:2016-09-19 23:20
Hello Khai,

Hello Khai,

Please use the attached header file here. There are few updates in the uart driver in the latest release.

最好的,
LC.

附件: