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

Adding UART to ble_blinky_c

Hello,

I want to add control over UART to ble_app_blink_c project.

SDK is version 16,I copied <SDK>/examples/ble_central/ble_app_blinky_c folder and made <SDK>/examples/ble_central/ble_app_blinky_c_uart folder from it, the project is attached, you can unzip it to <SDK>/examples/ble_central/ folder to try it out.

I copied uart_init() from ble_app_uart_c project and I added the required files from libraries/fifo and libraries/uart and I added required lines to sdk_config.h :

      /* Universal Asynchronous Receiver-Transmitter */
      #define UART_PRESENT
      #define UART_COUNT 1

      /* Universal Asynchronous Receiver-Transmitter with DMA */
      #define UARTE_PRESENT
      #define UARTE_COUNT 1

      #define UARTE0_EASYDMA_MAXCNT_SIZE 8

      //==========================================================
      // <q> APP_FIFO_ENABLED  - app_fifo - Software FIFO implementation
 

      #ifndef APP_FIFO_ENABLED
      #define APP_FIFO_ENABLED 1
      #endif


      // <e> APP_UART_ENABLED - app_uart - UART driver
      //==========================================================
      #ifndef APP_UART_ENABLED
      #define APP_UART_ENABLED 1
      #endif
      // <o> APP_UART_DRIVER_INSTANCE  - UART instance used
 
      // <0=> 0

      #ifndef APP_UART_DRIVER_INSTANCE
      #define APP_UART_DRIVER_INSTANCE 0
      #endif

Everything compiles fine but I can't make UART work with ble_blinky_c.

printf("text\r\n); doesn't output text to serial monitor (Putty).

Please can you help me with providing code lines for reading from and writing to UART in the ble_blinky_c project and tell me what is the right way to add UART support to a ble app?

Thanks in advance,

Tom

ble_app_blinky_c_uart.zip

  • Hi Tom

    Generally, we suggest starting with the ble_app_uart example, as most functionalities are easier to implement in that project, than the other way around. Most of our example projects use the UART backend for debugging in our SDK, but not the UART examples. It might be that the backend and the UART in your application are having some conflict, so please make sure the NRF_LOG_BACKEND_UART_ENABLED is set to 0 and that the NRF_LOG_BACKEND_RTT_ENABLED is set to 1.

    Best regards,

    Simon

Related