This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Why is UUID in wrong order?

Hi,

This time I am trying to work out the UART example.

I got it to the point where it is advertising, but the advertisement is wrong.

When I check with an Android phone, the advertisement data is all the way around. This should be the advertised one: 6E400001-B5A3-F393-E0A9-E50E24DCCA9E And the received one: 9eca0001-0ee5-a9e0-93f3-a3b50100406e

I followed this thread but it did not help.

I tried modifying the advertisement data in the ble_nus_init:

ble_uuid128_t nus_base_uuid = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};

ble_uuid128_t nus_base_uuid = {0x9E, 0xCA, 0xDC, 0x24, 0x0E, 0xE5, 0xA9, 0xE0, 0x93, 0xF3, 0xA3, 0xB5, 0x00, 0x00, 0x40, 0x6E};

ble_uuid128_t nus_base_uuid = {0x6E, 0x40, 0x00, 0x00, 0xB5, 0xA3, 0xF3, 0x93, 0xE0, 0xA9, 0xE5, 0x0E, 0x24, 0xDC, 0xCA, 0x9E};

But the received advertisement data always stayed the same. The ble_nus functions are coming from this site. The main function is a modified of that (removed all the parts, only kept the service_init and the advertisement_init).

Thanks for the help!

  • Is your UUID being sent out in Big Endian format? I believe the Android app is looking for it in that format. I had a similar problem with the Company ID not being recognized, being "backwards", in reality, I was sending it out as Little Endian and not Big.

  • That was my first thought too that is why I tried to modify the order of the UUID but it did not help. How do you change the Endian? Even when i set the UUID to 0s only, I received the wrong ID. No idea what is going on...

  • This is how the uuid is encoded

    // UUID : 00000000-59a4-4d2b-8479-8bbdbcf77fcd
    #define BLINKY_UUID_BASE {0xcd, 0x7f, 0xf7, 0xbc, 0xbd, 0x8b, 0x79, 0x84, 0x2b, 0x4d, 0xa4, 0x59, 0x0, 0x0, 0x0, 0x0}
    #define BLINKY_UUID_SERVICE			1
    #define BLINKY_UUID_CHAR			2
    

    The service uuid would become 10000000-59a4-4d2b-8479-8bbdbcf77fcd

    The characteristic uuid would become 20000000-59a4-4d2b-8479-8bbdbcf77fcd

    The last 32bits of the base uuid will be replace by the one from the service or characteristic

  • This sounds very strange. If you modify the nus_base_uuid you should definitely see a change in the master control panel on your phone. Also, if all you have in the main function is service_init and advertisement_init, you shouldnt even be able to see the device at all. Are you sure you are flashing the correct file, and that the project compiles? (If it doesn't compile, it will flash the old hex file with the old UUID)

  • I am sure I am flashing the correct file and the project compiles. Since then I started again from the UART example and checked every copied line and now it works just fine. I will try to search which line was causing the problem and post it later on. Thanks!

Related