Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

Changing ble_app-uart base UUID to custom stops data getting to the event handler

I've used ble_app_uart as the template for my app (nRF52DK S112 SDK17.1), then I use nRF Connect  on my Android phone to write to it.

Works fine, except if I change the base UUID it changes to unknown service (this is not a problem. The phone app this is to work with looks for a specific UUID) but more importantly the on_connect() handler no longer receives any data  Frowning2 If I put a debug line in there it says length is zero)

Are there are some extra steps defining the service when using a custom 128bit  UUID? I have to use a specific UUID to match another product.

To check the problem after a day of head scratching I simply used the ble_app_uart example from the SDK and changed the base UUID by one byte 9E > 9F

  • Hi Nick, 

    After you changed the UUID, have you used the nRF Connect app to discover and write/read to the characteristic ? Did it disconnect after you try to read/write ? 

    Could you give more information about the on_connect() function ?

    Where it's defined and which data you expect to receive in the on_connect ? 


    You can try to do "Refresh device cache" in the three dots menu on the right hand side in nRF connect after you connect to the device. 

  • Ah sorry that's a typo. I meamt on_write() which is in ble_nus.c.

    Simply I'm using nRF Connect to send data and have Terraterm open to watch the log data come through. The nus_data_handler(ble_nus_evt_t * p_evt) is invoked, but the data length is zero.

    Try running your own ble_app_uart  and changing the UUID, you'll see what I mean.

    I haven't tried clearing the cache but I have turned Bluetooth off/on and even restarted the phone. But I don't think that's the issue as the phone is finding & writing to the RX characteristic, it's getting lost in the SoftDevice somehow.

  • Hi Nick, 
    It may have something to do with how you write data to the NUS service after you change UUID. 

    Please how you write to it. Note that when it's the original NUS UUID the nRF Connect will write to it as text. But when it's unknown UUID you need to select how you want to write. Just simply select TEXT would work (Byte or Byte array would also work but you need to use ASCII in hex) 

    I just tested here and it worked fine. 

  • Please how you write to it. Note that when it's the original NUS UUID the nRF Connect will write to it as text. But when it's unknown UUID you need to select how you want to write. Just simply select TEXT would work (Byte or Byte array would also work but you need to use ASCII in hex)

    That's exactly it, thanks! I was looking so hard at my code I didn't even think about what nRF connect was doing...

Related