Using UART adapters for TX and RX at the same time.

⚠️
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.
4 posts / 0 new
Last post
UnicycleBloke
Offline
Last seen:2weeks 5 days ago
加入:2015-10-26 13:43
Using UART adapters for TX and RX at the same time.

I am new to using the Dialog SDK, and have been reading about adapters. I can see a simple solution for me to queue pending writes and handle them with ad_uart_write() all within a single thread context, so that no other threads are blocked. I'm not so sure about reads...

Is it possible to call ad_uart_read() and ad_uart_write() at the same time (from different threads) without interfering with each other? I had in mind a UART RX thread which simple reads a block or times out, passes RX data on to the application, and repeats. I guess this would have power implications, with keeping the RX enabled, but it is only for debug purposes.

Device:
PM_Dialog
Offline
Last seen:4 hours 50 min ago
工作人员
加入:2018-02-08 11:03
Hi UnicycleBloke,

Hi UnicycleBloke,

Since you are using adapters you could not call ad_uart_read() and ad_uart_write() at the same time from different threads. This is the adapters’ concept. Please note that adapters is an additional layer on top of LLDs(low level drivers) and are not implemented as separate tasks. So, either you will directly use UART LLDs (descripted in hw_uart.h file) or UART adapters (descripted in ad_uart.h file ) without intervening in UART LLDs. We recommend the usage of adapters for accessing hardware peripherals because not only provide access to the peripheral, but also make sure that other tasks which are currently accessing it, suspend their operation until the peripheral is once again released. So you don't have to worry if another task tries accessing the same peripheral at the same time. I strongly suggest you have a look at chapter 12.3.1 The UART adapter example of theUM-B-044 User Manual: DA1468x Software Platform Reference (HTML)from our support portal.

Thanks, PM_Dialog

UnicycleBloke
Offline
Last seen:2weeks 5 days ago
加入:2015-10-26 13:43
Thanks for your response. To

Thanks for your response. To be honest, I would prefer to write my own bare metal drivers (this is what I have done with Nordic, STM32, EFM32 and other parts) but am too unfamiliar with the Dialog parts to do this at the moment, with my primary concern being to properly manage power. It seems to me very strange that the UART is forced to be a half duplex device by the adapter: that seems undesirable.

I will have a look through the example.

Thanks.

PM_Dialog
Offline
Last seen:4 hours 50 min ago
工作人员
加入:2018-02-08 11:03
Hi UnicycleBloke,

Hi UnicycleBloke,

As it has already been mentioned in the previous post, we strongly recommend the usage of adapters for accessing hardware peripherals. If you don’t prefer to use the adapters, the second option is to use the LLD. These are the two option that we can provide support. In your case, if you would like to implement your own drivers, we won’t be able to provide any support. Yes please, have a look through the recommend example of how to use UART adapters.

Thanks, PM_Dialog