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

Data sending of ble_app_uart question in ble_central

I example test ble_central and ble_peripheral of ble_app_uart. Radio TX and RX test is OK. It confirmed the data communications relating to uart_event_handler function.

if ((data_array[index - 1] == '\n') || (index >= (BLE_NUS_MAX_DATA_LEN)))
{
    err_code = ble_nus_string_send(&m_nus, data_array, index);
}   

when '\n' or length, should call the function ble_nus_string_send. But I have an arduino download wirelessly(nrf51822). arduino download data without the epilogue to '\n', length also is not fixed. I want to spend as data is coming. So, modified ble_app_uart. uart_event_handle function of ble_pripheral and ble_central as below.

switch (p_event->evt_type)
    {
        case APP_UART_DATA_READY:
            UNUSED_VARIABLE(app_uart_get(&data_array[index]));
            index++;
            ble_nus_string_send(&m_nus, data_array, index);
            index = 0;
       break;
....

ble_pripheral is OK. ble_central is not OK. ble_central When you send the data 10 received only one front. Where parts need to modify? Or is the source code for the modem type?

Parents
  • Hi,

    I think I do understand what is your goal and what you have done. Let me know if I am wrong:

    You want to transfer binary data over UART over BLE. You use the Nordic UART Service examples from the SDK (found in examples\ble_peripheral\ble_app_uart and examples\ble_central\ble_app_uart_c folders of the SDK). The problem is that the newline character \n is not handled correctly. This corresponds to hexadecimal value 0x0A, or 10 in decimal. You have changed the uart event handler to relay data at once, where the old behaviour was to wait for a string of maximal length or the newline character. Was this correctly understood?

    If I understand you correctly the problem arises when you send the newline character, and you experience that the data stream stops at that character, and anything beyond that character is lost. Is this a correct problem description?

    The Nordic UART Service examples can be used this way, when you are using both peripheral and central: [A]<--Regular UART--> [nRF peripheral] <--NUS--> [nRF central] <--Regular UART--> [B]. Is this the setup you are using, and what are the devices [A] and [B]? If not, where does the UART communication come from and where does it go to?

    Regards, Terje

Reply
  • Hi,

    I think I do understand what is your goal and what you have done. Let me know if I am wrong:

    You want to transfer binary data over UART over BLE. You use the Nordic UART Service examples from the SDK (found in examples\ble_peripheral\ble_app_uart and examples\ble_central\ble_app_uart_c folders of the SDK). The problem is that the newline character \n is not handled correctly. This corresponds to hexadecimal value 0x0A, or 10 in decimal. You have changed the uart event handler to relay data at once, where the old behaviour was to wait for a string of maximal length or the newline character. Was this correctly understood?

    If I understand you correctly the problem arises when you send the newline character, and you experience that the data stream stops at that character, and anything beyond that character is lost. Is this a correct problem description?

    The Nordic UART Service examples can be used this way, when you are using both peripheral and central: [A]<--Regular UART--> [nRF peripheral] <--NUS--> [nRF central] <--Regular UART--> [B]. Is this the setup you are using, and what are the devices [A] and [B]? If not, where does the UART communication come from and where does it go to?

    Regards, Terje

Children
No Data
Related