Problems with UART

⚠️
嗨,...感谢您来论坛。令人兴奋的消息!我们现在正在迁至我们的新论坛平台,将提供更好的功能,并包含在主对话框网站中。所有帖子和帐户都已迁移。我们现在只接受新论坛上的流量 - 请发布任何新线程https://www.dialog-seminile.com/support.。我们将在未来几天修复错误/优化搜索和标记。
6个帖子/ 0新
最后一篇
dsandbue
离线
最后一次露面:1年9个月前
加入:2017-02-15 14:09
Problems with UART

你好呀,

我遇到了uart-沟通问题,我非常感谢你的帮助。:-)
因此,我正在使用PXP-Reporter(Suota)的演示作为基础,并且我添加了UART2(9600波特,AD_UART)来从不同的设备中读取信息,解析信息并通过BLE发送。它一般工作,但有时DA14681在通过UART阅读时崩溃。当我没有连接UART时,它永远不会崩溃,所以它绝对与它有关。我正在使用配置测试并扼杀一些问题:

1)据我所知,混合适配器和LLD的使用并不好。但是,如果我尝试禁用HW_UART,我会因为未解决的变量而获得编译器错误(例如,AD_UART.C中的“HW_UART_ID”。
是否可以仅使用适配器?如果我从未从HW_UART呼叫函数,则无论如何都不重要?

2)DMA也是如此。如果我禁用HW_UAR_USE_DMA_SUPPORT,则由于丢失的变量,我会收到编译器中的错误。
或者可以/更好地使用DMA在我的“设置”(抱歉,如果这是一个愚蠢的问题,我迄今为止遇到中断驱动的UART)?

4) As per the datasheet, the FIFO buffer for UART2 is 16 Bytes long. If I wanted to use a Software FIFO with say 100 Bytes, do I need to call "ad_uart_set_soft_fifo" or is it enough to set "dg_configUART2_SOFTWARE_FIFO_SIZE" to 100?

3) I'm reading in the Information byte-by-byte, via the ad_uart_read (sync) and with a timeout of 50 ms. If the timeout occurs, does it reset the device or simply move on with the code?

5)是否可以使用针1_3的ADC?因为在启动时,DA14681使用PIN用于UART通信(发送“DA14681”几次“)。
Is there some configuration to do, so this pin is entirely used for ADC?

提前非常感谢,
菲利普

Device:
tr_dialog.
离线
最后一次露面:2个月3周前
职员
加入:2014-06-30 23:52
菲尼普普:

菲尼普普:

我将在对话框内部讨论这些问题并发布回复。

Thanks,

tr_dialog.

dsandbue
离线
最后一次露面:1年9个月前
加入:2017-02-15 14:09
非常感谢你!

非常感谢你!

dsandbue
离线
最后一次露面:1年9个月前
加入:2017-02-15 14:09
再次问好,

再次问好,

I found a pretty nasty bug in my code, UART works like a charm now. :-)

What is still bothering me is question 5:
Is it possible to use Pin 1_3 for ADC? Because at startup, the DA14681 is using the pin for UART-Communication (sending out "DA14681" a few times).
Is there some configuration to do, so this pin is entirely used for ADC?

Some additional info: The AD conversion works as expected when I measure a voltage under ~2 V. However, if I plug in a voltage over 2 V and unplug it, the voltage on Pin 1_3 is rising to nearly 3 V. When I ground the pin, it stays at ground, but otherwise it stays at around 3 V.
不幸的是,我必然会使用这个PIN,没有其他一个用于ADC。

非常感谢您的帮助,
菲利普

tr_dialog.
离线
最后一次露面:2个月3周前
职员
加入:2014-06-30 23:52
你好,

你好,

这是我收集的信息。我想发布它,因为它们是重要的指导方针:

1)请注意,适配器是一个additional layer on top of LLDs(低级别驱动程序),并且不作为单独的任务实现。这就是为什么的原因they can't work properly if you disable or disrupt the normal operation of the corresponding peripheral module。所以,要么你将直接使用UART lld (descripted in hw_uart.h file) or UART adapters (descripted in ad_uart.h file )没有介入in UART LLDs.

小费:我们建议使用适配器来访问硬件外围设备,因为不仅提供对外设的访问权限,还可以确保当前访问它的其他任务,暂停其操作,直到外围设备再次发布。因此,如果另一个任务在同一时间访问相同的外围设备,则不必担心。

2)据此查询的第1部分涉及相同的应用和在这种情况下(如果禁用DMA硬件外围设备,则无法成功使用适配器)。现在,关于DMA的一些事情。到目前为止,您了解中断驱动的概念即,即在MCU的RX引脚上到达字符,触发中断,以便从接收器和CPU间隔读取该字符。DMA是一个功能,使您有机会将所有传输从/到外围设备没有CPU间隔,换句话说,DMA可以与CPU同时运行。

小费:如果您与DMA合作,则是您的选择,根据您使用的应用程序,但如果要发送许多字符,则优选使用DMA,而不是强制CPU执行此任务,剥夺后者执行其他至关重要的任务。

3)就timeoutinput parameter of thead_uart_read()函数涉及有两个选项可以使用。第一个是设置它等于os_event_forevr.它强制您的应用程序卡住,直到收到所有数据量(使用此函数的第二个输入参数)。在所有其他情况下,函数可以在超时后退出,而不是请求的字节更少。这意味着您的应用程序不会陷入困境的所有数据量。

4)你必须定义bothdg_configuart2_software_fifo_size.anddg_configUART_SOFTWARE_FIFO宏。第一个定义确定分配空间和第二个定义的数量enables or notthe use of the ad_uart_set_soft_fifo() function.

5)默认情况下,P1_3和P2_3引脚分别由BootLoader保留为UART_TX和UART_RX。
Although you can change the default mapping (see available configuration options表6:从串行启动的扫描步骤数据表)
不推荐,因为它需要Bootrom更改。相反,您可以使用任何其他可用的ADC引脚所示表2:引脚描述da14681-01_2v3.pdf

Thanks,

tr_dialog.

dsandbue
离线
最后一次露面:1年9个月前
加入:2017-02-15 14:09
Thank you very much for your

Thank you very much for your time and effort, the answers are excellent and very informative.

Just as an Addition to my last question about Pin 1_3 as an ADC: it now works flawlessly, solution was to remove J15 (on the pro-board), some peripherie was messing around with the pin, now it's good. :-)