<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Sending commands from nRF52 acting as central to peripheral OBD II BLE Device</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/114705/sending-commands-from-nrf52-acting-as-central-to-peripheral-obd-ii-ble-device</link><description>I am currently trying to use my nRF52 as a BLE central to connect to a OBD II BLE Device. I am able to use the name scan filters and connect here 
 
 
 After connecting, I assign the handle here 
 
 I then try and write some initialization commands using</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 18 Sep 2024 10:26:36 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/114705/sending-commands-from-nrf52-acting-as-central-to-peripheral-obd-ii-ble-device" /><item><title>RE: Sending commands from nRF52 acting as central to peripheral OBD II BLE Device</title><link>https://devzone.nordicsemi.com/thread/502907?ContentTypeID=1</link><pubDate>Wed, 18 Sep 2024 10:26:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1ea3a41a-809c-472a-aea9-97bd18bb9caf</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;yes, but it is not a vendor specific UUID (if it is only 16 bit long). So you can look at the ble_hrs_c_init() function for reference:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;uint32_t ble_hrs_c_init(ble_hrs_c_t * p_ble_hrs_c, ble_hrs_c_init_t * p_ble_hrs_c_init)
{
    VERIFY_PARAM_NOT_NULL(p_ble_hrs_c);
    VERIFY_PARAM_NOT_NULL(p_ble_hrs_c_init);

    ble_uuid_t hrs_uuid;

    hrs_uuid.type = BLE_UUID_TYPE_BLE;
    hrs_uuid.uuid = BLE_UUID_HEART_RATE_SERVICE;

    p_ble_hrs_c-&amp;gt;evt_handler                 = p_ble_hrs_c_init-&amp;gt;evt_handler;
    p_ble_hrs_c-&amp;gt;error_handler               = p_ble_hrs_c_init-&amp;gt;error_handler;
    p_ble_hrs_c-&amp;gt;p_gatt_queue                = p_ble_hrs_c_init-&amp;gt;p_gatt_queue;
    p_ble_hrs_c-&amp;gt;conn_handle                 = BLE_CONN_HANDLE_INVALID;
    p_ble_hrs_c-&amp;gt;peer_hrs_db.hrm_cccd_handle = BLE_GATT_HANDLE_INVALID;
    p_ble_hrs_c-&amp;gt;peer_hrs_db.hrm_handle      = BLE_GATT_HANDLE_INVALID;

    return ble_db_discovery_evt_register(&amp;amp;hrs_uuid);
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;As you can see, it is mostly the same, but you don&amp;#39;t need the sd_ble_uuid_vs_add() (softdevice_bluetooth low energy_uuid_vendor specific_add())&lt;/p&gt;
&lt;p&gt;Vendor specific refers to 128-bit UUIDs, as the are specified by the vendor. 16 bit uuids are &amp;quot;standard&amp;quot; UUIDs. Look at the ble_app_hrs_c example for reference.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;BR,&lt;br /&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sending commands from nRF52 acting as central to peripheral OBD II BLE Device</title><link>https://devzone.nordicsemi.com/thread/502809?ContentTypeID=1</link><pubDate>Tue, 17 Sep 2024 16:16:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:318cab38-e001-4465-a45e-efe455d82663</guid><dc:creator>inspiringdev123</dc:creator><description>&lt;p&gt;So do I need to add the service UUID here?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;uint32_t ble_obd_c_init(ble_obd_c_t * p_ble_obd_c, ble_obd_c_init_t * p_ble_obd_c_init)
{
    uint32_t      err_code;
    ble_uuid_t    obd_uuid;
    ble_uuid128_t obd_base_uuid = OBD_BASE_UUID;

    VERIFY_PARAM_NOT_NULL(p_ble_obd_c);
    VERIFY_PARAM_NOT_NULL(p_ble_obd_c_init);
    VERIFY_PARAM_NOT_NULL(p_ble_obd_c_init-&amp;gt;p_gatt_queue);

    err_code = sd_ble_uuid_vs_add(&amp;amp;obd_base_uuid, &amp;amp;p_ble_obd_c-&amp;gt;uuid_type);
    VERIFY_SUCCESS(err_code);

    obd_uuid.type = p_ble_obd_c-&amp;gt;uuid_type;
    obd_uuid.uuid = BLE_UUID_OBD_SERVICE;

    p_ble_obd_c-&amp;gt;conn_handle           = BLE_CONN_HANDLE_INVALID;
    p_ble_obd_c-&amp;gt;evt_handler           = p_ble_obd_c_init-&amp;gt;evt_handler;
    p_ble_obd_c-&amp;gt;error_handler         = p_ble_obd_c_init-&amp;gt;error_handler;
    p_ble_obd_c-&amp;gt;handles.obd_tx_handle = BLE_GATT_HANDLE_INVALID;
    p_ble_obd_c-&amp;gt;handles.obd_rx_handle = BLE_GATT_HANDLE_INVALID;
    p_ble_obd_c-&amp;gt;p_gatt_queue          = p_ble_obd_c_init-&amp;gt;p_gatt_queue;

    return ble_db_discovery_evt_register(&amp;amp;obd_uuid);
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I have the base UUID, service UUID and characteristic defined as follows:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;#define BASE_UUID {0xFB, 0x34, 0x9B, 0x5F, 0x80, 0x00, 0x00, 0x80, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}&lt;/p&gt;
&lt;p&gt;#define BLE_UUID_OBD_SERVICE 0xFFE0&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /**&amp;lt; The UUID of the OBD Service. */&lt;br /&gt;#define BLE_UUID_OBD_CHARACTERISTIC 0xFFE1&amp;nbsp; /**&amp;lt; The UUID of the RX and TX Characteristic. */&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sending commands from nRF52 acting as central to peripheral OBD II BLE Device</title><link>https://devzone.nordicsemi.com/thread/502756?ContentTypeID=1</link><pubDate>Tue, 17 Sep 2024 12:13:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5f58e0c4-9050-466a-a0dd-6d8424620a6e</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Strange. It looks like it uses a short UUID (16 bit), but it is not registered with Bluetooth:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Assigned_Numbers/out/en/Assigned_Numbers.pdf?v=1726574177481"&gt;https://www.bluetooth.com/wp-content/uploads/Files/Specification/HTML/Assigned_Numbers/out/en/Assigned_Numbers.pdf?v=1726574177481&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;(page 76)&lt;/p&gt;
&lt;p&gt;Perhaps it is possible to purchase a 16-bit UUID and not publish it&amp;#39;s use. I don&amp;#39;t remember.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;But yes, it looks like the service you are looking for is 0xFFE0, and the characteristics are 0xFFE1 and 0xFFEE. In this case, when it is a 16 bit UUID, I suggest you look into the ble_app_hrs_c example, as this uses a 16 bit UUID.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I can&amp;#39;t tell from your screenshot, but it looks like the 0xFFE1 is a characteristic on which you would want to enable notifications, and the 0xFFEE is probably one you would want to write to (the arrows in the app will tell you).&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;However, on what format the OBDBLE device expects it&amp;#39;s data, I don&amp;#39;t know. You will have to check with the producer of this device.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;But your steps should be: Look at the ble_app_hrs_c example on how to do discovery on a 16 bit (short) UUID. Then you can look at the ble_app_uart_c example for how to enable notifications, and write to a characteristic. I suspect it is quite similar to the ble_app_uart/ble_app_uart_c application, apart from the 16-bit UUID.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sending commands from nRF52 acting as central to peripheral OBD II BLE Device</title><link>https://devzone.nordicsemi.com/thread/502640?ContentTypeID=1</link><pubDate>Mon, 16 Sep 2024 15:50:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ba891110-c067-4128-95df-cd8f27ff9c0f</guid><dc:creator>inspiringdev123</dc:creator><description>&lt;p&gt;So basically, I should start here and edit the UUID to use my custom UUID&amp;#39;s I am looking for?&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;uint32_t ble_nus_c_init(ble_nus_c_t * p_ble_nus_c, ble_nus_c_init_t * p_ble_nus_c_init)
{
    uint32_t      err_code;
    ble_uuid_t    uart_uuid;
    ble_uuid128_t nus_base_uuid = NUS_BASE_UUID;

    VERIFY_PARAM_NOT_NULL(p_ble_nus_c);
    VERIFY_PARAM_NOT_NULL(p_ble_nus_c_init);
    VERIFY_PARAM_NOT_NULL(p_ble_nus_c_init-&amp;gt;p_gatt_queue);

    err_code = sd_ble_uuid_vs_add(&amp;amp;nus_base_uuid, &amp;amp;p_ble_nus_c-&amp;gt;uuid_type);
    VERIFY_SUCCESS(err_code);

    uart_uuid.type = p_ble_nus_c-&amp;gt;uuid_type;
    uart_uuid.uuid = BLE_UUID_NUS_SERVICE;

    p_ble_nus_c-&amp;gt;conn_handle           = BLE_CONN_HANDLE_INVALID;
    p_ble_nus_c-&amp;gt;evt_handler           = p_ble_nus_c_init-&amp;gt;evt_handler;
    p_ble_nus_c-&amp;gt;error_handler         = p_ble_nus_c_init-&amp;gt;error_handler;
    p_ble_nus_c-&amp;gt;handles.nus_tx_handle = BLE_GATT_HANDLE_INVALID;
    p_ble_nus_c-&amp;gt;handles.nus_rx_handle = BLE_GATT_HANDLE_INVALID;
    p_ble_nus_c-&amp;gt;p_gatt_queue          = p_ble_nus_c_init-&amp;gt;p_gatt_queue;

    return ble_db_discovery_evt_register(&amp;amp;uart_uuid);
}
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I scanned for the device on the nrf connect app and this is what I got.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/thumbnail_5F00_Screenshot-2024_2D00_09_2D00_12-at-09.05.12.jpg" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The service I am interested in is the FFE0 and the characteristic used to read and write is FFE1&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sending commands from nRF52 acting as central to peripheral OBD II BLE Device</title><link>https://devzone.nordicsemi.com/thread/502487?ContentTypeID=1</link><pubDate>Fri, 13 Sep 2024 13:11:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:da663132-6638-422d-96ec-f51e7ad478c8</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Do you have any information indicating that the OBD II uses the Nordic UART Service (NUS)?&lt;/p&gt;
&lt;p&gt;Also, the API that you are pointing to, bt_nus_data_send() is the API intended for the peripheral, not the central. For a central_uart application, you should use:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;bt_nus_client_send()&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;like it is done in the central_uart sample application (ncs\nrf\samples\bluetooth\central_uart).&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;So the reason it fails using bt_nus_data_send() is that it assumes that the connected device has enabled notifications to the nRF&amp;#39;s Nordic UART service, which is not the case. Typically central&amp;#39;s don&amp;#39;t have services and characteristics that the peripheral will enable notifications on (subscribe to).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;So if you want to connect to, and use the OBD II device over BLE, you need to connect to it using e.g. nRF Connect for Desktop -&amp;gt; Bluetooth Low Energy, and look at what Services and Characteristics it has. Then you need to implement a central application (like the central_uart application) that uses those services and characteristics. You can look at the central_uart sample to see how it does service discovery, and how it uses the characteristics that is present in the peripheral_uart sample, and apply this to the services and characteristics that you find on your OBD II.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>