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

UART example does not work.

Hello.

What do I need to run this example called uart?

As far as I understand this should be simple echo program meaning what comes in goes out but I can not see anything on terminal. I tried to enable NRF_LOG_ENABLED with CMSIS but after that I got bunch of linkage errors:

1> "C:/tools/SEGGER/SEGGER Embedded Studio for ARM 3.50/gcc/arm-none-eabi/bin/ld" -X --omagic -eReset_Handler --defsym=__vfprintf=__vfprintf_long --defsym=__vfscanf=__vfscanf_int -EL --gc-sections "-TC:/nordic/nRF5_SDK_15.0.0_a53641a/examples/peripheral/uart/pca10040/blank/ses/Output/uart_pca10040 Release/Obj/uart_pca10040.ld" -Map Output/Release/Exe/uart_pca10040.map -u_vectors -o Output/Release/Exe/uart_pca10040.elf --emit-relocs "@C:/nordic/nRF5_SDK_15.0.0_a53641a/examples/peripheral/uart/pca10040/blank/ses/Output/uart_pca10040 Release/Obj/uart_pca10040.ind"
1> Output/uart_pca10040 Release/Obj/app_error_weak.o: In function `app_error_fault_handler':
1> C:\nordic\nRF5_SDK_15.0.0_a53641a\components\libraries\util/app_error_weak.c:58: undefined reference to `nrf_log_panic'
1> C:\nordic\nRF5_SDK_15.0.0_a53641a\components\libraries\util/app_error_weak.c:58: undefined reference to `nrf_log_frontend_dequeue'
1> C:\nordic\nRF5_SDK_15.0.0_a53641a\components\libraries\util/app_error_weak.c:61: undefined reference to `nrf_log_frontend_std_0'
1> C:\nordic\nRF5_SDK_15.0.0_a53641a\components\libraries\util/app_error_weak.c:103: undefined reference to `nrf_log_frontend_std_0'
1> Output/uart_pca10040 Release/Obj/app_error_weak.o: In function `__NOP':
1> C:\nordic\nRF5_SDK_15.0.0_a53641a\examples\peripheral\uart\pca10040\blank\ses/../../../../../../components/toolchain/cmsis/include/cmsis_gcc.h:375: undefined reference to `m_nrf_log_app_logs_data_dynamic'
Build failed

When I tried to add source file containing those definition (nrf_log_frontend.c) to the project I got another missing references. Is there any simple solution to fix this?

btw I've built this project with SES.

Best regards.

Parents Reply Children
  • Hi.

    Have you check for "Local echo", "Receive: AUTO", and "Transmit: LF" under Setup --> Terminal..., like this:

    When you type either "q" or "Q" the program terminates into a while-loop, as shown at the bottom of the main-loop in the code:

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

    Here you can see I typed "q":

    - Andreas

  • Yeah, just checked those options and nothing has changed, I even change program logic to this:

    while (true)
    {
    uint8_t cr='t';
    while (app_uart_put(cr) != NRF_SUCCESS);
    nrf_delay_ms(100);
    }

    so it sends lower case letter t every 100ms but I can not see anything on my terminal unless I start debugging.

    when I flash the board in "normal" way nothing shows up on terminal.

    Yet another edit:

    It turned out that there is something wrong with terminal configuration on my pc, on other computer it works fine.

    Thank you for help and best regards.

  • Hi.

    It should work as intended with these configurations. I suggest you start from scratch with an unmodified version of this example.

    Download and unzip the nRF5_SDK_15.0.0_a53641a\examples\peripheral\uart example, compile it without doing any modfications and without any debugging, and use the configurations I suggested for Tera Term, and see if this works.

    If this doesn't work, could you please attach this project in a .zip file so I can have a look at it?

    - Andreas

  • Hello.

    I will do that later but meantime I connected this board with some stm32 discovery board like this picture shows

     

    as described here http://infocenter.nordicsemi.com/pdf/nRF52_DK_User_Guide_v1.2.pdf pins 06 and 08 and it seems there's no communication. When nrf52 is connected with pc via usb cable I can send and receive data without any problems. Do I need  short some pins or something similar? Usb cable is disconnected during uart connection and board is powered with battery if this change something.

    Do you know where can be a problem?

  • Hi.

    If you only connected RX and TX pins, this will not work, because the flowcontrol is enabled in the application.

    If you want to use this setup with flowcontrol you also have to connect the CTS and RTS pins (CTS = pin 7, and RTS = pin 5). You can also disable the flowcontrol by editing the #define HWFC found in the file pca10040.h. The same place you configurate the pins.

    Like this (edit line 93 to false):

    #define RX_PIN_NUMBER  8
    #define TX_PIN_NUMBER  6
    #define CTS_PIN_NUMBER 7
    #define RTS_PIN_NUMBER 5
    #define HWFC           false //THIS MUST BE FALSE TO DISABLE FLOWCONTROL

    - Andreas

Related