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:
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
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.
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