This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Use libuarte example with GPIO

Good afternoon everyone,

I am facing problems using libuarte example (SDK 17 and NRF52 DK. Using SES and S132, PCA 10040)
It works well with puTTY or other software, but I want to use it to read data from an Arduino.

What I do is the following : 
I connect the RX pin to pin 8 and TX pin to pin 6 as described in the pca10040.h.
Rx is connected to the Tx pin of my Arduino (which is sending data, I can see it with the blinking LED), but I do not see any LED on with the NRF52 DK nor any response ... 

From what I've understood, whenever the nrf52 receives data, it must echo it, but it does not echo neither in Arduino, neither in puTTY. (I've understood that I need to use NRF_LOG_INFO to print using puTTY because UART was used with GPIO)

I've also tried the uart project, using flow Control, but I've been unable to receive data as well ...

Is there something that need to be changed in the example to read data with UART using the RX pin and libuarte example ?

Thanks a lot for your answer,

Roduss

  • Hi,
    Thanks a lot for your answer, I'll have a look at it this week and tell you more about it soon, but it sounds good !
    Best regards

  • No problem, just let me know when you have more questions Slight smile

  • Hellooo,
    I tried your solution, copied a brand new example, changed my libuarte config, connected it to the Arduino and it finally worked !
    It was that simple finally ....
    I still had some transmission issues with baudrate at 115200 and 38400, it works really good at 9600, but I think it might more be an echo problem from the Arduino and the AltSoftSerial/SoftwareSerial libraries, so my issue is solved !

    Do you confirm that you have perfect transmission using 2 nRF kits at 115200 bps ?

    One last thing I would like to be sure about, is libuarte  supposed to be more accurate than the UART example without Flow control ? (I ended up using the UART example withtout using the flow control and I didn't get any transmissions errors)

  • Hi

    One thing you can try if you're having transmission problems is to enable the external HF clock constantly from your application. 

    Using external HF clock means you will have much more accurate baudrate generation for the UART. Without it you could have as much as +/- 5% drift on the clock, which could lead to bit errors over the UART. 

    If you're not using a SoftDevice then enabling external HF clock can be done as easy as this:

    NRF_CLOCK->TASKS_HFCLKSTART = 1;

    roduss said:
    Do you confirm that you have perfect transmission using 2 nRF kits at 115200 bps ?

    Yes, if you're using external HF clock like I mentioned above. 

    roduss said:
    One last thing I would like to be sure about, is libuarte  supposed to be more accurate than the UART example without Flow control ? (I ended up using the UART example withtout using the flow control and I didn't get any transmissions errors)

    I won't say libuarte is more accurate, but it is more flexible if you have a UART application where you are receiving data at random times, and where you don't know how much data you will receive ahead of time. 

    With the older UART driver you have to wait until the RX buffer fills up before you receive any data, which can take a lot of time if you have a large buffer. 

    With the libuarte driver you can define a timeout period, and if no more data is received for this long you will get whatever data is currently in the buffer. 

    Best regards
    Torbjørn

Related