UART not working with ble_app_hrs_c

Hello Nordic Team!

I'm working with the ble_app_hrs_c and a UART code I developed following the peripheral/uart example. 

On the peripheral/uart example we have the following includes:

#include "app_uart.h"
#include "app_error.h"
#include "nrf_delay.h"
#include "nrf.h"
#include "bsp.h"

When I "copy/paste" these includes on the ble_app_hrs_c and build it, it says "app_uart.h no such file or directory".

I know this is due to ble_app_hrs_c not using these files, but since I used the peripheral/uart example as base code, I don't know how to add them ;) 

I really appreciate all your help and thanks in advance!

  • Hi Marte, thanks a lot for your answer!

    I changed the NRF_LOG_BACKEND_UART_TX_PIN to 0 but didn't work :( 

    My main code, the other code is the same as in the examples from Nordic

    int main(void)
    {
        bool erase_bonds;
    
        // Initialize.
        log_init();
        timer_init();
        power_management_init();
        buttons_leds_init(&erase_bonds);
        ble_stack_init();
        gatt_init();
        peer_manager_init();
        db_discovery_init();
        hrs_c_init();
        bas_c_init();
        scan_init();
    
        //uart code
        const app_uart_comm_params_t com_params = {
        
        RX_PIN_NUMBER,
        TX_PIN_NUMBER,
        RTS_PIN_NUMBER,
        CTS_PIN_NUMBER,
        UART_HWFC,
        false,
        NRF_UART_BAUDRATE_115200
      };  
      
        uint32_t err_code;
    
        APP_UART_FIFO_INIT(&com_params, UART_RX_BUFF_SIZE, UART_RX_BUFF_SIZE, uart_err_handler, APP_IRQ_PRIORITY_LOWEST, err_code);
        
        APP_ERROR_CHECK(err_code);
        
        
        //Start execution.
     
      while(true){
        
        uint8_t cr;
    
        while(app_uart_get(&cr) != NRF_SUCCESS){
          
          if(cr == '1'){
            printf("connected");
            scanning_start(&erase_bonds);
    
            for (;;){
            idle_state_handle();
              }
          }
    
          else if(cr == '2'){
            
            bsp_board_leds_off();
            printf("Off");
    
          }
          else if(cr == '3'){
            
            bsp_board_leds_on();
            printf("32");
          }
          else if(cr == '4'){
            
            bsp_board_leds_off();
            printf((uint8_t*)"OTA");
          }
    
          cr = 0;
        }
      }
    
    }

    I tested my uart code both before and after the //initialize. If I use j-link to download the code, it won't work, and if I use debug mode, it prints to the debug console from SES.

    I tend to think is something in the sdk.h, but don't know where to look.

    Thanks a lot for the help!

Related