Can connect to uart_peripheral by UUID, but can't connect to a non-Zephyr product

I have managed to get, somehow, a central_uart talking to a peripheral_uart on a pair of  52840 DKs.

I've changed the UUIDs of what I'm trying to connect to, to be those of a different device that has BLE in it.

I've previously connected to this using an RPi and its UART, getting data in and out of it. So I went PC UART <-> Rpi BLE <-> Other Unit

Am trying to repeat that but using the 52840 DK

I've taken the central UART project and changed the code  do to this:

#define XLRT_SERVICE_UUID_VAL \
BT_UUID_128_ENCODE(0x2a1f963c, 0x143a, 0x4f7d, 0x9107, 0x6315196a02a6)

/** @brief UUID of the TX Characteristic. **/
#define XLRT_TX_UUID_VAL \
BT_UUID_128_ENCODE(0x651135b0, 0xdfe9, 0x45a2, 0x95c1, 0x46552a8a77e2)


/** @brief UUID of the RX Characteristic. **/
#define XLRT_RX_UUID_VAL \
BT_UUID_128_ENCODE(0xe7d6274e, 0xb765, 0x11e9, 0xa2a3, 0x2a2ae2dbcce4)


#define BT_UUID_XLRT_SERVICE BT_UUID_DECLARE_128(XLRT_SERVICE_UUID_VAL)
#define BT_UUID_XLRT_RX BT_UUID_DECLARE_128(XLRT_RX_UUID_VAL)
#define BT_UUID_XLRT_TX BT_UUID_DECLARE_128(XLRT_TX_UUID_VAL)

Previously this worked fine connecting to the peripheral_uart example project running on the second 52840DK. The only thing I have done is change the UUIDs of the service I want to connect to and the the UUIDs of the two characteristics that I want to read from  and write to.

Can you think of any reason why it would connect to the DK running peripheral_unit and not this other unit? The other unit has an older chip in, using SES and has   the same types od read/write characteristics.

I would expect it to simply connect to the unit because the service UUID matches, even if the BLE data might not get to/from at first due to some other bug in the code. I'm nevere getting the call to function:

static void connected(struct bt_conn *conn, uint8_t conn_err)

Which I do if I try to connect to peripheral_uart.

Thanks
  • Unfortunately, it seems that all your attachments failed to upload for some reason. I was also unable to open the download link. Since I couldn’t access your attachments, I used the original peripheral and central NUS samples from SDK v2.8.0 and modified them to include the UUID declarations you provided. Could you please test these and let me know if you encounter the same issue? 

    DiBosco said:
    Things like getting rid of mallocs, unnecessary queues and generally trying to make it read more like embedded code rather than desktop code (and better comments long term

    I agree with you on this. I believe the data stream handling from the UART should be simplified, and I have already shared this feedback internally. If the BLE link cannot keep up with the incoming data from the UART, the receive buffer will eventually overflow regardless of how it is implemented.

    Attachment:

    custom_service.zip

  • Uch, I don't know what's going on with that project you generated, but trying to build it, it just sits in a loop saying it's compiling but doesn't. Goes round and round and round repeating the same messages like generating dts.something.

    Apparently there is an SSL issue with my hosting, which is why you're having issues getting that link I suspect. Can you get this:

    www.dropbox.com/.../src.zip

    Last night, after I logged off, I thought I had a moment of clarity, where I realised I'd renamed the service from

    nus_svc
    to
    xlrt_svc
    in that hideous
    BT_GATT_SERVICE_DEFINE

    macro (I believe that macro somehow generates a
    load of links to other files), so I started from scratch again
    this morning,
    copying nus.c and nus.h across to my local source directory
    and renaming,
    but it's still the same, just won't connect.

    Maybe I just need to create it yet again and modify the UUIDs
    in nus.h, see if that works.
    Edit: your project finally gives up and says:

    ninja: error: manifest 'build.ninja' still dirty after 100 tries

    The Internet shows other people with similar problems for things
    like Qt and other desktop style issues, none of which seem relevant
    to my situation.
  • Did you try to build my project with SDK v2.8.0? Also forgot to ask earlier, but which version are you currently on?

    The BT_GATT_SERVICE_DEFINE populates the Service and characteristics in the attribute table.

  • Nope, even doing this in nus.h:

    #ifdef NORDIC_UUIDs
    /** @brief UUID of the NUS Service. **/
    #define BT_UUID_NUS_VAL \
    BT_UUID_128_ENCODE(0x6e400001, 0xb5a3, 0xf393, 0xe0a9, 0xe50e24dcca9e)

    /** @brief UUID of the TX Characteristic. **/
    #define BT_UUID_NUS_TX_VAL \
    BT_UUID_128_ENCODE(0x6e400003, 0xb5a3, 0xf393, 0xe0a9, 0xe50e24dcca9e)

    /** @brief UUID of the RX Characteristic. **/
    #define BT_UUID_NUS_RX_VAL \
    BT_UUID_128_ENCODE(0x6e400002, 0xb5a3, 0xf393, 0xe0a9, 0xe50e24dcca9e)
    #else
    /** @brief UUID of the NUS Service. **/
    #define BT_UUID_NUS_VAL \
    BT_UUID_128_ENCODE(0x2a1f963c, 0x143a, 0x4f7d, 0x9107, 0x6315196a02a6)

    /** @brief UUID of the TX Characteristic. **/
    #define BT_UUID_NUS_TX_VAL \
    BT_UUID_128_ENCODE(0x651135b0, 0xdfe9, 0x45a2, 0x95c1, 0x46552a8a77e2)

    /** @brief UUID of the RX Characteristic. **/
    #define BT_UUID_NUS_RX_VAL \
    BT_UUID_128_ENCODE(0xe7d6274e, 0xb765, 0x11e9, 0xa2a3, 0x2a2ae2dbcce4)

    #endif



    and starting central_uart  from scratch doesn't work.

    [00:00:00.022,644] <0x1b>[0m<inf> central_uart: Scan module initialized<0x1b>[0m␍␊

    [00:00:00.022,644] <0x1b>[0m<inf> central_uart: NUS Client module initialized<0x1b>[0m␍␊

    [00:00:00.027,587] <0x1b>[0m<inf> central_uart: Scanning successfully started<0x1b>[0m␍␊


    Then nothing.


  • Thin I've finally worked out how to upload an image. This is nrf connect showing the device I'm trying to connect to. 

Related