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

NRF52 ble_app_uart example Android getting wrong data

Hi,

nrf52 using  from ble-peripheral->  ble_app_uart examle

In that ble_app_uart example receive the data from the android is ok.

But,i want transmit array type of data to Android using ble_nus_data_send. In that android side, we receive wrong data.

Kindly give the solution.

For Example,

uint8_t string1[10]={9,10,12,13,14,15,16,17,18,19};

uint8_t length =10;

err_code = ble_nus_data_send(&m_nus, string1, &length, m_conn_handle);

Output:

In the Android receives - > ^I^J^^L^M^N^O^P^Q^R^S

  • Hello,

    From your description I suspect that your Android is interpreting the received characters as a different encoding then what they are.
    Could you elaborate on what you intended to have the phone receive? - Did you want the phone to receive the 9th character of the ASCII table(which is TAB), the number 9, or something else?

    Furthermore, what application are you using on your Android for receiving the data, is it a custom application or are you using our nRF Connect application?
    Could you have the phone output the raw value of the bytes/binary representation of what it receives, and see if this does not match the numbers you've sent from your device?

    Best regards,
    Karl

  • Hi,

    The problem is solved, When using nRF UART App.

    Before, I tested with Serial Bluetooth Terminal Android App.

    It gives the undefined data.

    Okay Thanks for repy.

     

  • Hello,

    Ask313 said:
    The problem is solved, When using nRF UART App.

    I am happy to hear that!
    I would think the difference lies in what data types the two application converts the received BLE data into.

    Ask313 said:
    Thanks for repy.

     No problem at all, I am happy to help!

    Best regards,
    Karl

  • hi,

    i need example program for magnetic sensor (TLV493) interface using i2c.

    intialize process ok. after that, try to read data i can't get actual data.

    it shows the error ERROR 33281 [NRF_ERROR_DRV_TWI_ERR_ANACK].

    Then,i disable the "APP_ERROR_CHECK(err_code);" function after it doesn't show that error.

    it will communicate sometime only. Continuous read operation i have not receive the data.

    reagrds

    senthilkumar

  • Hello senthilkumar,

    Ask313 said:
    Then,i disable the "APP_ERROR_CHECK(err_code);" function after it doesn't show that error.

    By doing this you have only removed the symptom of the error, not the underlying cause.
    NRF_ERROR_DRV_TWI_ERR_ANACK error is caused by the slave not acknowledging the targeted address.
    Could you attempt to run the TWI Sensor example, to see if you may find the address?
    There could be many reasons for the slave not acknowledging the address, but a common pitfall is an erroneous hardware connection. Do you have access to a logic analyzer?

    Best regards,
    Karl

Related