Issue in UART read with DA14580

⚠️
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.
13个帖子/ 0新
Last post
Dhrishi.
Offline
Last seen:3年3个月前
加入:2017-02-10 09:56
Issue in UART read with DA14580

Hi,

我们的设置有一个外部MCU,它通过UART连接到DA14580。DA14580和MCU使用我们设计的协议相互通信。
DA14580 is waiting on uart read for 5 byte header. The MCU sends the header (5 bytes) which has the data_length. DA14580 then does the uart_read with data_length bytes to be received.
Observation:
假设,MCU必须发送5个字节标题和32字节数据。
UART HW使用的内部缓冲区似乎是16个字节。因为我们所看到的是DA14580正确地接收标题,然后尝试在DA14580的UART HW缓冲区中存在的某些部分数据,然后从未调用读取回调。32个字节永远不会完全读取。
Whereas if the uart read of 32 bytes is called before the actual data is received from the MCU the entire read is successful and the read callback gets executed correctly.

在读取标题后,我们还尝试从DA14580读取一个字节。在这种情况下,会发生什么,(16 - 5)IE逐个读取11个字节。虽然,DA14580从未收到其他字节,尽管它们已被MCU发送。

似乎是DA14580 UART的问题。你能否检查和恢复。
没有te: We also enabled HW level flow control and are still seeing this issue. Can you please confirm if HW flow control is working fine and is turned on using the API uart_flow_on()

- hrishikesh.

设备:
lc_dialog.
Offline
Last seen:2 weeks 2 days ago
Staff
加入:2016-09-19 23:20
Hello Hrishikesh,

Hello Hrishikesh,

I am currently investigating this issue and will provide an update to resolve this.

Best,
LC

lc_dialog.
Offline
Last seen:2 weeks 2 days ago
Staff
加入:2016-09-19 23:20
Hello Hrishikesh,

Hello Hrishikesh,

硬件FIFO具有16个字节,并且根据标准提供1,4,8和14字节的中断。您使用的是当前的中断水平是多少?如果您在当前的中断级别遇到问题,那么您可以执行以下选项

Disable to FIFO and read the data normally from the receiver buffer. This can be achieved by monitoring the Rx Data Avaliable interrupt and Rx Timeout interrupt. This way you will be in control of how much data you are receving. Based on the lenght field in your header, you can read incrementing to that many bytes.

另一个选项是配置RTL中断以触发FIFO中收到的每个字节,包括接收标题(以较低的速度工作最佳(最佳)。这样,您将根据您的需求读取数据。

请提供一些更有洞察力,如当前的波特率,即RTL中断等,以及如何阅读第一个标题,然后是下一个数据,这将在找出实际问题时得到很多帮助。如果您有任何疑虑,请告诉我

Best,
LC

Dhrishi.
Offline
Last seen:3年3个月前
加入:2017-02-10 09:56
The uart related issue is

The uart related issue is solved. The problem was that the uart flow control was not getting enabled.

我们使用UART_FLOW_ON()API调用UART_INIT()后
This should be documented in the SDK header file for uart_flow_on() : This API needs to be called before uart_init() to take effect.

lc_dialog.
Offline
Last seen:2 weeks 2 days ago
Staff
加入:2016-09-19 23:20
Hello drishi,

Hello dhrishi,

的顺序UART_FLOW_ON()uart_init()无论要启用硬件流控件是否有关。应该有一些可能发生的原因。

请确认您面临的问题是否完全解决。

Best,
LC

Dhrishi.
Offline
Last seen:3年3个月前
加入:2017-02-10 09:56
Yes. The issue we were facing

Yes. The issue we were facing is completely resolved. Although, when I interchange the sequence of uart_flow_on() and uart_init() I could see that the flow control does not come into effect.
Anyway, I will give it a try once again and update in case of any new observations/findings.

谢谢,
hrishikesh.

lc_dialog.
Offline
Last seen:2 weeks 2 days ago
Staff
加入:2016-09-19 23:20
Hello Hrishikesh,

Hello Hrishikesh,

很高兴听到它被解决了。如果未指定并确保在相关地点更新,我将审核它。

Best,
LC

kqtrinh
Offline
Last seen:3年10个月前
加入:2016-08-24 00:17
嗨LC,

嗨LC,

我也是从外部MCU读取的UART的类似问题。

After reading this post, I tried per the suggestion by calling uart_flow_on() after uart_init(). That didn't help me.
What I have is a UART2 setup to communicate with an external MCU at 57.6Kbps. Sending data from DA to external MCU is fine. it was able to receive everything the DA sends. However, when receiving UART data from the external MCU back into the DA has frame error for every transaction. I have attached the Saleae capture for you to look at.

In the capture, DataToQPI is data sent from DA to external MCU while DataFromQPI is data sent from external MCU to DA.

Thank you,
--Khai

Attachment:
kqtrinh
Offline
Last seen:3年10个月前
加入:2016-08-24 00:17
嗨LC,

嗨LC,

I figured out my problem. I had to configure the RX pin as PULL_UP below:

gpio_configurepin(gpio_uart2_rx_port,gpio_uart2_rx_pin,input_pullup,pid_uart2_rx,false);
谢谢,
--Khai

kqtrinh
Offline
Last seen:3年10个月前
加入:2016-08-24 00:17
嗨LC,

嗨LC,

既然RX Pull_up线路脱离了路,我就会在问题上读取RX行上的数据进入DA缓冲区。下面是我在UART2中读取RX数据的代码:

bool readFromCIIf(BYTE* data, int data_len) {
bool r = true;
short idx = 0;
int nbytes = 0, bytes_left = data_len;

而(idx //等待1ms for FPGA以在CI UART数据寄存器中加载字节
qpispincounter(tick_1msec);

//了解要发送到ASIC的CI输出缓冲区的字节数
// khai:尝试使用ci_output_buffer_sz而不是rx_callback_size
if(bytes_left> ci_output_buffer_sz)
nbytes = ci_output_buffer_sz;
else
nbytes = bytes_left;

//删除将从剩余总量检索的字节
bytes_left -= nbytes;

//读取ASIC的字节
uart2_read(data+idx, nbytes, NULL);
idx += nbytes;
}
return r;
}

I have played with both CI_OUTPUT_BUFFER_SZ = 256 bytes while RX_CALLBACK_SIZE = 8 bytes. The caller to this function requests to read 140 bytes. I have looked in the RX line with Saleae and all 140 bytes were were on the wire in the attached logicdata file. However, when the above function walked through the loop to read, the bytes read into the buffer wasn't the same as what's on the wire.

When I used RX_CALLBACK_SIZE, the first 16 bytes looked good. After that, the bytes in memory are missing and being skipped to the next several bytes. Then, the rest are then all 0s at time point. When using CI_OUTPUT_BUFFER_SZ, I would only get maybe the first 16 bytes and the rest are 0s.

Somehow specifying the read buffer size for each read seems to matter. What does this have to be to read the data correctly?

谢谢,
--Khai

Attachment:
lc_dialog.
Offline
Last seen:2 weeks 2 days ago
Staff
加入:2016-09-19 23:20
凯瑟你好,

凯瑟你好,

我无法在我最后重现这个问题。所以我并不完全确定在这种情况下出错了。但是,我会提出几个建议。

1. Please check if you GPIO are assigned accordingly and the connections are right. I think they are alligned properly since you can see the data on the Logic Analyzer.

2. I am attaching a sample driver that was modified from the actual driver to address RX FIFO adjustment. Try using this driver in place of the current one and check if that solves the issue. Note that this is not a official release driver and only for testing purposes.

Best,
LC

Attachment:
kqtrinh
Offline
Last seen:3年10个月前
加入:2016-08-24 00:17
嗨LC,

嗨LC,

在函数UART2_INIT中的新修改_uart2.c文件中(uint16_t baudr,uint8_t dlf_value,uint8_t模式),第二个参数dlf_value的设置是什么?我的UART2.c文件中不需要此参数。

Shouldn't you then have to also send me the uart2.h file too?
谢谢,
--Khai

lc_dialog.
Offline
Last seen:2 weeks 2 days ago
Staff
加入:2016-09-19 23:20
凯瑟你好,

凯瑟你好,

请在此处使用附加的头文件。最新版本中的UART驱动程序中几乎没有更新。

Best,
LC

Attachment: