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

How to turn on the BSP UART

Hello,

I am altering this project: nRF51_SDK_8.0.0_5fc2c3a\examples\ble_peripheral\ble_app_hrs\pca10028

I am trying to turn on the BSP UART. I main.c the project uses bsp_init() to enable the buttons and leds.

I just want to use the UART so I modified the bsp_init() to this:

err_code = bsp_init(BSP_INIT_UART,
                    APP_TIMER_TICKS(100, APP_TIMER_PRESCALER),
                    NULL);	
APP_ERROR_CHECK(err_code);

Then I have an output message using this function:

  err_code = bsp_indication_text_set(BSP_INDICATE_SENT_OK, "Test UART Output\n\r");
  APP_ERROR_CHECK(err_code);

Putting a breakpoint inside the bsp_indication_text_set() function on the printf statment, I am not able to get it to stop on the printf statement.

uint32_t bsp_indication_text_set(bsp_indication_t indicate, char const * p_text)
{
    uint32_t err_code = bsp_indication_set(indicate);

#ifdef BSP_UART_SUPPORT
    printf("%s", p_text);                            // Set breakpoint here
#endif // BSP_UART_SUPPORT

    return err_code; 
}

I am guessing BSP_UART_SUPPORT is not set properly to execute the printf statement.

Am I not turning on the BSP UART correctly?

I added #define BSP_UART_SUPPORT 1

#ifdef BSP_UART_SUPPORT
    printf("%s", p_text);
#endif // BSP_UART_SUPPORT

return err_code;

I put a breakpoint on the printf statement and the return statement. The debugger stops at t the printf. I take the next step in the code and it does not stop on the return statement. I believe there is some issue with the uart and the printf statement is not executing properly.

Thanks, Glenn

Related