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

PCA10040 - UART + SoftDevice

Hi,

SDK: v11.0.0.2-alpha DK: PCA10040 (NRF52)

I am trying to build a peripheral application that communicates with an external device via UART (h/w flow disabled). For this, I am using the "ble_peripheral/experimental_ble_app_blink" and "peripheral/uart" examples as reference. The problem I am facing is strange - I am trying print a simple string via UART so I can check if it is received on TeraTerm. While I can see the entire string being printed with the "peripheral/uart" project, using the same UART code in the "ble_peripheral/experimental_ble_app_blink" project - only the first character of the string gets printed. The problematic main function is below. I have tried different baud rates and enabling/disabling h/w flow rate. Any ideas?

int main(void)
{
    // Initialize.

    leds_init();
    timers_init();
    buttons_init();
    ble_stack_init();
    gap_params_init();
    services_init();
    advertising_init();
    conn_params_init();

	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_Baud38400
      };

    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);
	
		printf("Start\r\n");	
			
    // Start execution.
    //advertising_start();

    // Enter main loop.
    /*for (;;)
    {
        power_manage();
    }*/
}

I can see only "S" in the TeraTerm console with the BLE peripheral project, whereas the same UART related code in "peripherals/uart" project returns the entire string "Start".

  • What files and drivers are you using in your examples? There were made some changes in the uart modules in one of the latest SDKs and maybe your projects use different modules. The uart libraries are now using the nrf_drv_uart drivers. Relevant thread. The ble_peripheral/experimental_ble_app_blinky example with these files and with this code worked for me:

    image description

    Paths to files:

    SDK_11.0.0\components\libraries\fifo\app_fifo.c

    SDK_11.0.0\components\libraries\uart\app_uart_fifo.c

    SDK_11.0.0\components\drivers_nrf\uart\nrf_drv_uart.c

Related