i want to do simple data transfer and why blueetooth serial terminal was not be able to detect the device?

how to do simple data transfer using bluetooth serail terminal?

Parents
  • Hello,

    You could use the BLE NUS peripheral and central examples to do such a transfer between your devices.
    The examples will relay anything they receive over UART to their connected peer over BLE, and the peer will output the messages received over BLE out on its UART, and visa versa.
    Test this according to the example documentation, and let me know if you encounter any issues or questions.

    Best regards,
    Karl

  • i go through the nsu code but which api was used to transfer the data?

  • static void nus_data_handler(ble_nus_evt_t * p_evt)
    {

    if (p_evt->type == BLE_NUS_EVT_RX_DATA)
    {
    uint32_t err_code;

    NRF_LOG_DEBUG("Received data from BLE NUS. Writing data on UART.");
    NRF_LOG_HEXDUMP_DEBUG(p_evt->params.rx_data.p_data, p_evt->params.rx_data.length);

    for (uint32_t i = 0; i < p_evt->params.rx_data.length; i++)
    {
    Paint_DrawString_EN(105, 20, p_evt->params.rx_data.p_data[i]+'0', &Font12,BLACK,WHITE);
    /*err_code = app_uart_put(p_evt->params.rx_data.p_data[i]);
    if ((err_code != NRF_SUCCESS) && (err_code != NRF_ERROR_BUSY))
    {
    NRF_LOG_ERROR("Failed receiving NUS message. Error 0x%x. ", err_code);
    APP_ERROR_CHECK(err_code);
    }*/

    }
    /*
    if (p_evt->params.rx_data.p_data[p_evt->params.rx_data.length - 1] == '\r')
    {
    // while (app_uart_put('\n') == NRF_ERROR_BUSY);
    //while (Paint_DrawChar(105,20,'\n',BLACK,WHITE) == NRF_ERROR_BUSY);
    }*/
    }

    instead of sending data to uart i try to display on oled display but not displayed on the oled

  • Hello,

    venkatesha kj said:
    which function was used to receive the data?

    The data is received from the SoftDevice in the BLE_NUS_EVT_RX_DATA event.

    venkatesha kj said:
    instead of sending data to uart i try to display on oled display but not displayed on the oled
    venkatesha kj said:
    if i disable the uart and try to print on display it was not working?

    Please use the Insert -> Code option when sharing code here on DevZone.

    This sounds like an application layer logical issue. 
    Were you able to see the data on your serial terminal before you started modifying the example? Keep in mind that I do not know anything about your OLED display, or the driver you are using to operate it.
    Have you verified that the OLED performs as expected with a test sequence of bytes? For example, does it perform as expected if you pass a couple of ASCII encoded bytes to your Paint_DrawString_EN function?

    Best regards,
    Karl

  • i have checked oled was working fine ,but i have not test the serial terminal before i started modifying the example

  • my question was whenever the data transmitted through bluetooth serial terminal BLE_NUS_EVT_RX_DATA event will occur right?

  • venkatesha kj said:
    i have checked oled was working fine ,but i have not test the serial terminal before i started modifying the example

    Please test this, to verify that you are receiving the data that you think you are receiving, prior to modifying it to work with the OLED. When you have verified that each part works as expected separately, you could continue to merge the two functionalities together.

    venkatesha kj said:
    my question was whenever the data transmitted through bluetooth serial terminal BLE_NUS_EVT_RX_DATA event will occur right?

    You are correct, the BLE_NUS_EVT_RX_DATA event will be generated whenever data has been received over the NUS service in the previous connection event.

    Best regards,
    Karl

Reply
  • venkatesha kj said:
    i have checked oled was working fine ,but i have not test the serial terminal before i started modifying the example

    Please test this, to verify that you are receiving the data that you think you are receiving, prior to modifying it to work with the OLED. When you have verified that each part works as expected separately, you could continue to merge the two functionalities together.

    venkatesha kj said:
    my question was whenever the data transmitted through bluetooth serial terminal BLE_NUS_EVT_RX_DATA event will occur right?

    You are correct, the BLE_NUS_EVT_RX_DATA event will be generated whenever data has been received over the NUS service in the previous connection event.

    Best regards,
    Karl

Children
No Data
Related