6 years, 6 months ago.

BLE_UART - onDataWritten() not called - SOLVED!


I am trying to get the BLE_UART code to work using the mbed nrf 518422 and Nordic’s iOS uart app. I am able to connect the iphone to the mbed, but am not sure how to get data to and from the two devices. When I send text via the iphone, the onDataWritten() callback is not called. What am I missing? Sorry if this is really basic – I am new to mbed and very rusty with C++.

Thank you, Ken


I got it working!

Tried with Android phone — it worked fine.

Looked at iOS code for the nRF UART app. It would link up, but not do anything. In the debugger saw that there was “no write property on tx characteristic” so it was not sending anything. Turns out that it would not be able to find the uart service. The iPhone had cached a previous GATT service - 0x180d — heart rate monitor. After powering off the iPhone and turning it back on… it worked!

The first program I downloaded on the mbed board was the heart rate monitor example. When I moved on to the UART example, it was strange because other bluetooth tools on my iPhone recognised the mbed as the heart rate monitor. Therefore I was focused on the firmware code. Turns out it was the iPhone.

Question relating to:

use UART Service to loopback anything received on the TX characteristic onto the RX. BLE, nRF UART

Hi Ken, I also got a similar issue that onDataWritten() was missing. I found it was because I tried to send more data than the length of the characteristic (8 bytes). How many bytes did you send ? You can have a look at this thread: https://mbed.org/forum/team-63-Bluetooth-Low-Energy-community/topic/5082/?page=1#comment-25228

posted by Hung Bui 01 Sep 2014

Thank you for your reply. I am not trying to send more than 8 bytes. I just downloaded the most recent BLE_UART. Again, it connects to the nRF UART iOS app and I am monitoring the nRF from the terminal. When I send text through the app, onDataWritten() is not called. When I disconnect from the app, disconnectionCallback() is not called either. I have not made any modifications to the mbed code beyond adding some DEBUG lines.

posted by ken ihara 04 Sep 2014

1 Answer

6 years, 6 months ago.

Hi there,

Any chance you can capture a trace using the free Nordic sniffer (you will need a second Nordic radio) and post it?


Thank you for your reply. I do not have a sniffer yet. Will get one and revert back with trace.

posted by ken ihara 04 Sep 2014