Hello there,
I'm having problems with a UART-communication and I'd greatly appreciate your help. :-)
So, I'm working with the pxp-reporter (SUOTA enabled) demo as the basis, and I've added UART2 (9600 baud, ad_uart) to read in Information from a different device, parse the information and send it via BLE. It's working in general, but sometimes the DA14681 crashes when reading in via UART. It never crashes when I don't connect the UART, so it's definitely related to it. I'm testing around with the configuration and stumbled upon some questions:
1) As far as I understand it, it's not good to mix the usage of the Adapters and the LLDs. However, if I try to disable hw_uart, I get Compiler Errors because of unresolved variables (e.g. " HW_UART_ID" in ad_uart.c.
Is it possible to use only the Adapter? Or doesn't it matter anyway if I never call functions from hw_uart?
2) The same is true for DMA. If I disable HW_UAR_USE_DMA_SUPPORT, I get loads of Errors from the Compiler because of missing variables.
Or is it possible/better to use DMA in my "setup" (sorry if that's a stupid question, I've only encountered Interrupt-driven UART so far)?
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) 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?
Thanks a lot in advance,
Philipp
Hi Phillipp:
I will discuss these questions internally at Dialog and post a reply.
Thanks,
TR_DIALOG
Thank you very much!
Hello again,
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.
Unfortunately, I'm bound to use this pin and no other one for ADC.
Thank you very much for your help,
Philipp
Hi,
Here is the information I gathered. I would like to post it as they are important guidelines:
1) Please note that adapters is anadditional layer on top of LLDs(low level drivers) and are not implemented as separate tasks. This is the reason whythey 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 )without interveningin UART LLDs.
Tip: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.
2) As far as the 1st part of this query is concerned the same apply and in this case (if you disable the DMA hardware peripheral you will not be able to use successfully the adapters). Now, a few things about DMAs. So far you are aware of the interrupt-driven concepts i.e. a character is arrived on the RX pin of your MCU and an interrupt is triggered so you can read that character from the receiver and all this with CPU interval. DMAs is a feature which gives you the opportunity to make all your transfers from/to a peripheralwithout CPU interval, in other words DMAs can run simultaneously with the CPU.
Tip:It is your choice if you work with DMAs or not, depending on the application you work with but, if there are many characters to be sent it will be preferable to use DMAs and not forcing the CPU to do this task, depriving the latter to execute other crucial tasks.
3) As far as thetimeoutinput parameter of thead_uart_read()function is concerned there are two options to work with. The first one is to set it equal toOS_EVENT_FOREVR这迫使应用程序斯图ck until all the amount of data (specified with the second input parameter of this function) is received. In all other cases, function can exit after timeout with less bytes than requested.This means that your application does not stuck waiting for all amount of data.
4) You must definebothdg_configUART2_SOFTWARE_FIFO_SIZEanddg_configUART_SOFTWARE_FIFOmacros. The first definition determines the amount of allocated space and the second oneenables or notthe use of the ad_uart_set_soft_fifo() function.
5) By default P1_3 and P2_3 pins are reserved by the bootloader as UART_TX and UART_RX respectively.
Although you can change the default mapping (see available configuration optionsTable 6: Scanning steps for booting from serialof datasheet) it
is not recommended as it requires bootROM changes. Instead, you can use any other available ADC pins as depicted onTable 2: Pin descriptionof DA14681-01_2v3.pdf
Thanks,
TR_DIALOG
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. :-)