UART for BLE Mesh Model

Hi Team,

I am working on NRF52832 based on the BLE mesh protocol

here I am using the Light_switch example of SDK - nrf5sdkformeshv500src

Here I need to send the message data that received by Light_switch - Server, to UART.
for that I am not sure but  used to take some funtions like  uart_init() and nus_data_handler from ble_app_uart_coexist example

Here my probllem is

1. what are the funtion need to intergrate from ble_app_uart_coexist example?

uint32_t err_code;
ble_nus_init_t nus_init;

err_code = nrf_ble_qwr_init(&m_qwr, &qwr_init);
APP_ERROR_CHECK(err_code);

// Initialize NUS.
memset(&nus_init, 0, sizeof(nus_init));

nus_init.data_handler = nus_data_handler;

2. where i want to pass the nus_init.data_handler because in ble_app_uart_coexist  example they passed to ble_nus_init


err_code = ble_nus_init(&m_nus, &nus_init);
APP_ERROR_CHECK(err_code);

In my case where i want to pass the &m_nus, &nus_init

3. How to pass the received data to UART?

Thanks in Advance

Best Regards,
Venkatraaman J S.
Parents
  • firstly I am trying to send a custom data to uart like

    int main(void)
    {

    initialize();
    start();
    uart_init();
    uint32_t err_code;

    do
    {
    err_code = app_uart_put('p');
    if ((err_code != NRF_SUCCESS) && (err_code != NRF_ERROR_BUSY))
    {
    __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "----- UART initiated successfully -----\n");

    //NRF_LOG_ERROR("Failed receiving NUS message. Error 0x%x. ", err_code);
    APP_ERROR_CHECK(err_code);
    }
    } while (err_code == NRF_ERROR_BUSY);

    in nrf_mesh light_switch example

    But i cant able to see any data in my terminal ( I am using tera term with 115200 baud rate)

    kindly help me

    Best regards

    venkatraaman

  • Have you tried to connect a logic analyser to look at the UART pins?

    Kenneth

  • Hai Kenneth,


    static void uart_init(void)
    {

    __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "----- UART ----------------------------\n");

    uint32_t err_code;
    app_uart_comm_params_t const comm_params =
    {
    .rx_pin_no = RX_PIN_NUMBER,
    .tx_pin_no = TX_PIN_NUMBER,
    false,
    false,
    //.rts_pin_no = RTS_PIN_NUMBER,
    //.cts_pin_no = CTS_PIN_NUMBER,
    .flow_control = UART_HWFC ,
    .use_parity = false,
    #if defined (UART_PRESENT)
    .baud_rate = NRF_UART_BAUDRATE_115200
    #else
    .baud_rate = NRF_UARTE_BAUDRATE_115200
    #endif
    };

    APP_UART_FIFO_INIT(&comm_params,
    UART_RX_BUFF_SIZE,
    UART_TX_BUFF_SIZE,
    NULL,//uart_event_handle_custom,
    APP_IRQ_PRIORITY_LOWEST,
    err_code);
    APP_ERROR_CHECK(err_code);
    __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "----- UART initiated successfully -----\n");
    }

    int main(void)
    {
    uart_init();
    //uint32_t err_code;
    app_uart_put('p');

    }

    My code executing successfully
    and while seeing the TTL LOgic Circuit terminal the data was not displaying

    Best Regards
    venkatraaman

  • You have connected ground also? Is the voltage level on RXD and TXD within the same level (<0.3V difference)?

    Kenneth

  • No, I have not connected the GND pin of the Nrf board to the GND pin of the TTL logic circuit board
    Should I need to connect?

    Venkatraaman J S

Reply Children
Related