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

Printf only sends first byte and with an odd problem (52832)

    I am using example->peripheral->uart(KEIL version MDK 5) in SDK11.0 . Because my 52832 board is a new one I made, I changed RX_PIN_NUMBER and TX_PIN_NUMBER to 9 and 8. CTS_PIN and RTS_PIN are not connected, so I changed FLOW_CONCTROL to APP_UART_FLOW_CONTROL_DISABLED.
   To test uart, I used a loop to send "Start: \r\n" with 200ms delay. But in terminal, only 'S' received, very fast and endless.

image description

In this project ,app_uart_fifo.c was used, and Use MicroLIB was checked.

image description

int main(void)
{
    LEDS_CONFIGURE(LEDS_MASK);
    LEDS_OFF(LEDS_MASK);
    uint32_t err_code;
    const app_uart_comm_params_t comm_params =
    {
        RX_PIN_NUMBER,
        TX_PIN_NUMBER,
        RTS_PIN_NUMBER,
        CTS_PIN_NUMBER,
        APP_UART_FLOW_CONTROL_DISABLED,
        false,
        UART_BAUDRATE_BAUDRATE_Baud115200
    };

    APP_UART_FIFO_INIT(&comm_params,
                       UART_RX_BUF_SIZE,
                       UART_TX_BUF_SIZE,
                       uart_error_handle,
                       APP_IRQ_PRIORITY_LOW,
                       err_code);

    APP_ERROR_CHECK(err_code);

#ifndef ENABLE_LOOPBACK_TEST
    while(true)
    {
        printf("Start: \n\r");
        nrf_delay_ms(200);
    }

//    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(" \n\rExit!\n\r");

//            while (true)
//            {
//                // Do nothing.
//            }
//        }
//    }
#else

    // This part of the example is just for testing the loopback .
    while (true)
    {
        uart_loopback_test();
    }
#endif
}
Related