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

SDK 14 printf() Issue

Building for a PCA10040 dev board (nrf52832) in SDK 14.0.0 with the S132SD v5.0.0

I'm an encountering an issue where calls to printf() are only displaying a single byte in the terminal emulator.

I am using app_uart_fifo.c and retargeting printf():

image description

.../components/libraries/fifo is in my include paths and everything is building just fine.

My uart_init() is as such:

static void uart_init(void)
{
    uint32_t	err_code;
		app_uart_comm_params_t const comm_params =
    {
        .rx_pin_no    = RX_PIN_NUMBER,
        .tx_pin_no    = TX_PIN_NUMBER,
        .rts_pin_no   = RTS_PIN_NUMBER,
        .cts_pin_no   = CTS_PIN_NUMBER,
        .flow_control = APP_UART_FLOW_CONTROL_DISABLED,
        .use_parity   = false,
        .baud_rate    = UART_BAUDRATE_BAUDRATE_Baud115200
    };

    APP_UART_FIFO_INIT(&comm_params,
                       UART_RX_BUF_SIZE,
                       UART_TX_BUF_SIZE,
                       uart_event_handle,
                       APP_IRQ_PRIORITY_LOWEST,
                       err_code);
    APP_ERROR_CHECK(err_code);
}

NRF_LOG_USES_RTT and NRF_LOG_INFO are set to 0

RETARGET_ENABLED and APP_FIFO_ENABLED are set to 1

UART_ENABLED is set to 1 and configured as such:

image description

The interesting thing is that an arbitrary number of calls to printf() from outside the loop within main() work as expected, i.e.:

printf("APP STARTED!\r\n");
printf("More text!\r\n");
printf("Even more text!\r\n");
printf("Some more text!\r\n");

// Enter main loop.
for (;;)
{
    if (NRF_LOG_PROCESS() == false)
    {
        power_manage();
    }
}

However, calls to printf() from within a handler function or any subsequent function will print only the first byte, i.e.:

static void some_write_handler(uint16_t conn_handle, ble_whatever_t * p_whatever, uint8_t data)
{
    printf("This will fail...");
    if (data)
		{
				doSomething(data);
		}
}

Prints only T, at which point no other characters will be printed, even with subsequent calls.

Any input would be greatly appreciated.

Parents Reply Children
No Data
Related