This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

basic UART sample for nRF Connect SDK

Hi,

I am struggling to find a basic sample for UART communication in NCS. As an experienced Nrf5 SDK programmer, I find it very hard to convert my firmware to nRF Connect and Zephyr. There is no small and simple example in the NCS, the Zephyr website just lists of bunch of declarations, and searching the internet and devzone yields a bewildering amount of different solutions, dead links, with or without FIFO, UART or UARTE, incomprehensible config settings and lots of code that is documented as "not running", "unreliable" etc. I just need 2 UARTs to transmit commands  to sensors and receive data from them, preferably under interrupt.

thx,

Henk

Parents
  • found a sample in Zephyr/tests/drivers/uart/uart_basic_api but it does not run. Initially device_get_binding failed although all config settings were added, but after hours of searching it turned out to be the non-standard baudrate I needed (125000). Took me another hour of so to discover how to change the baudrate after binding, since the baudrate formula is not in the datasheet of the nRF9160 (?why?).

    Next, and still a problem, is the CONFIG_UART_INTERRUPT_DRIVEN flag that is set to "y" in prj.conf, but is off when I debug drivers/uart.h.  Apparantly, somewhere in the spaghetti heap of include files this flag turns off, and I cannot find where.

    The piece of code might work, since, if I patch uart.h and define the flag, data is transmitted from the UART. But patching library code is no sustainable solution in frequently updating IDEs.

    Please do not let me struggle for another 5 days or so......

    thx, Henk.

  • I see the same problem with your sample code, and the standard board definition "nrf9160dk_nrf9160". Looking into uart.h, the code following #ifdef CONFIG_UART_INTERRUPT_DRIVEN is disabled.

    I checked .conf and autoconf.h in the sample build: both flags are set.

  • That is strange. The same code works just fine here using NCS version 1.6.0. I'm compiling for the nrf9160dk_nrf9160ns target though.

    Can you please zip the project including the build directory and post it here? Thanks.

Reply Children
No Data
Related