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

nrf52 DK: UART problems

Hello,

I integrated the relevant code from the "uart" example into the "ble_app_uart" example(this is all the code in the main routine):

uint8_t cr;        
uart_init();
	printf("\r\nUART Start!\r\n");

  while (true){
		        
    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.
        }
    }
}

Now have the problem that the program is stuck in this line:

while (app_uart_get(&cr) != NRF_SUCCESS);

The return value of the function is not "NRF_SUCCESS".

The echo function in the "uart" example was working fine.

The only difference between the uart_inits of both is uart_error_handle and uart_event_handle and the Flow Control. But even if I set this to enable it won't work:

UART: UART example

BLE_APP_UART: BLE_APP_UART example

Also if I flash the code, I can't download the softdevice to the board. Maybe there are conflicts but I have no clue.

Thanks in advance Hannes

Parents
  • Hi Kristin, I integrated the new SDK and the example's project file and adapted the links to the header files but I still get this error: Error List

    Update: Here is my project folder content: I CANT UPLOAD THE FILE FROM MY COMPUTER :(

  • Alright, the missing softdevice was the cause. The memorysettings didn't have to be adapted, because I took the project file right out of the example folder. However the frequency setting was at 12MHz instead of 64 like in your image. But with debug running now I still don't get a "NRF_SUCCESS". Weird. For "got_character" and "cr" I get a "not in scope" in my Watch1. How do you upload pictures here in the comments? I wanted to share my screenshot.

    Update: OK, they were "not in scope" because they get optimized away. I set the optimization level to 0. But the errorcode in "app_uart_get" is still 5.

Reply
  • Alright, the missing softdevice was the cause. The memorysettings didn't have to be adapted, because I took the project file right out of the example folder. However the frequency setting was at 12MHz instead of 64 like in your image. But with debug running now I still don't get a "NRF_SUCCESS". Weird. For "got_character" and "cr" I get a "not in scope" in my Watch1. How do you upload pictures here in the comments? I wanted to share my screenshot.

    Update: OK, they were "not in scope" because they get optimized away. I set the optimization level to 0. But the errorcode in "app_uart_get" is still 5.

Children
No Data
Related