Including "app_uart.h" in main program of 'simple_coap_server' example [closed]

Mclennon gravatar image

asked 2017-05-18 10:58:09 +0100

updated 2017-05-18 16:14:56 +0100

HI All,

I wonder if someone can help me out. I would like to send serial data by modifying the 'simple_coap_server' main program. I added the following header 'app_uart.h' to make use of the functions but when I compile the program using GCC ('make' command in Windows), I get No such file or directory #include "app_uart.h". What I don't understand is that the file is in the directory and that I can compile the 'UART' example using GCC successfully without any problems. Any thoughts please, maybe I'm missing something?


edit retag flag offensive reopen delete report spam

Closed as "the question is answered, right answer was accepted" by Roger at 2017-09-06 16:19:07 +0100


2 answers

Sort by » oldest newest most voted
joh2 gravatar image

answered 2017-05-18 12:22:54 +0100

updated 2017-05-18 16:18:26 +0100

Do you mean the simple_coap_server example in the Thread SDK? Have you added the path to the header file to INC_FOLDER in the Makefile?

$(SDK_ROOT)/components/libraries/uart \
edit flag offensive delete publish link more


I'm such a noob, thank you very much Jørgen, it worked. Learned something new today.

Roger ( 2017-05-18 16:16:44 +0100 )editconvert to answer

Happy to help!

Jørgen Holmefjord ( 2017-05-18 16:25:59 +0100 )editconvert to answer
Mclennon gravatar image

answered 2017-05-19 14:30:14 +0100

updated 2017-05-19 14:32:33 +0100

Hello Jørgen,

Seems like there is something still missing which I don't fully understand. The 'simple_coap_server' compiles with no error after including $(SDK_ROOT)/components/libraries/uart \ in the INC_FOLDER of the Makefile. However, after including the following code from the 'UART' example to the main of 'simple_coap_server' example':

int main(void) {

uint32_t err_code;

const app_uart_comm_params_t comm_params =



printf("\r\nStart: \r\n");

while (true)
    uint8_t cr;
    while (app_uart_get(&cr) != NRF_SUCCESS);
    while (app_uart_put(cr) != NRF_SUCCESS);

    if (cr == 'q' || cr == 'Q')
        printf(" \r\nExit!\r\n");

        while (true)
            // Do nothing.



I get the following error: image description

It seems that the functions of "app_uart.h" used in main are still undefined. In the 'UART' example, I also checked that the headers and source files in the Makefile, are also included in the 'simple_coap_server' Makefile, but I still get an undefined reference to the functions.

Are there perhaps any other files that need to be included? Any thoughts?


edit flag offensive delete publish link more


There are a few things needed to get UART working. In addition to adding the path to the header files, you need to include the source files app_uart_fifo.c, app_fifo.c, and nrf_drv_uart.c in your project/Makefile. You will also have to add the paths to the header files of these additional libraries. Then, you need to enable all the modules in sdk_config.h by setting the correct defines. Finally, if you also want to use printf() functionality for the UART interface, you need to incude the source file retarget.c, and enable this module in sdk_config.h as well. I see that these are not included in the config file for the Thread examples, so I created Makefile and sdk_config.h file that should work for you. Note that UART0 peripheral is owned by OpenThread stack and cannot be used by the application. You are therefore required to ...(more)

Jørgen Holmefjord ( 2017-05-19 15:41:49 +0100 )editconvert to answer

Thanks again. Very helpful.

Roger ( 2017-09-06 14:58:36 +0100 )editconvert to answer

User menu

    or sign up

Recent questions

Question Tools

1 follower


Asked: 2017-05-18 10:58:09 +0100

Seen: 160 times

Last updated: mai 19 '17