<?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>nRF Dongle as UART client python</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/29043/nrf-dongle-as-uart-client-python</link><description>Hi,
I&amp;#39;m trying to write a simple python application on Windows 7 that communicates with a BLE peripheral running Nordic UART Service. I&amp;#39;m using the nRF dongle and pyserial and can get prints from the dongle when it is connecting to the peripheral (e</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 17 Oct 2022 07:31:28 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/29043/nrf-dongle-as-uart-client-python" /><item><title>RE: nRF Dongle as UART client python</title><link>https://devzone.nordicsemi.com/thread/390905?ContentTypeID=1</link><pubDate>Mon, 17 Oct 2022 07:31:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8d7786d4-4c4d-4918-ab04-7bd37d23cf70</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Please post a new ticket regarding your problem. This is a very old post,&amp;nbsp;pc-ble-driver-py might have changed and causing the problems your are experiencing.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF Dongle as UART client python</title><link>https://devzone.nordicsemi.com/thread/390873?ContentTypeID=1</link><pubDate>Sun, 16 Oct 2022 03:14:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:468898ac-864d-45cb-ac43-0c93f5fd03ba</guid><dc:creator>Alvin_99</dc:creator><description>&lt;p&gt;Hi Jagen,&lt;/p&gt;
&lt;p&gt;I&amp;#39;m currently working on sending command with the python script with the method that you suggested but seems like I&amp;#39;m still getting the error code. I had been struggling with this issue for quite sometime so your help will be greatly appreciated.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Below are my error code.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;  File &amp;quot;Command.py&amp;quot;, line 244, in main
    collector.write_word_characteristic(conn)
  File &amp;quot;Command.py&amp;quot;, line 226, in write_word_characteristic
    self.adapter.write_req(conn_handle, NusCollector.CUS_WR_UUID, byte_array)
  File &amp;quot;C:\Python38\lib\site-packages\pc_ble_driver_py\ble_driver.py&amp;quot;, line 104, in wrapper
    err_code = wrapped(*args, **kwargs)
  File &amp;quot;C:\Python38\lib\site-packages\pc_ble_driver_py\ble_adapter.py&amp;quot;, line 487, in write_req
    raise NordicSemiException(&amp;quot;Characteristic value handler not found&amp;quot;)
pc_ble_driver_py.exceptions.NordicSemiException: Characteristic value handler not found&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF Dongle as UART client python</title><link>https://devzone.nordicsemi.com/thread/115041?ContentTypeID=1</link><pubDate>Thu, 18 Jan 2018 12:15:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1a48eeb0-cebc-4b09-9ddc-f7e5f20439f9</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Note that this instructions was written for an older version of pc-ble-driver-py, they might not work with the current latest version. Please create a new question where you post what you have tried, and we will help you get it working.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF Dongle as UART client python</title><link>https://devzone.nordicsemi.com/thread/115042?ContentTypeID=1</link><pubDate>Wed, 17 Jan 2018 15:04:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:436fee38-45fe-45f0-839b-58379f174b09</guid><dc:creator>Sebastien Monat</dc:creator><description>&lt;p&gt;Hi. So gannerud do you succeded to do what you want on your original POST ?
I want to do exactly the same thing and I follow the advices of Jorgen but I still have the error
pc_ble_driver_py.exceptions.NordicSemiException: Characteristic value handler not found&lt;/p&gt;
&lt;p&gt;Should I add my BLE BASE_UUID or should I add the one you write on the post Jorgen ?
I&amp;#39;m a bit confused ...&lt;/p&gt;
&lt;p&gt;Could you give me some help ?&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF Dongle as UART client python</title><link>https://devzone.nordicsemi.com/thread/115040?ContentTypeID=1</link><pubDate>Tue, 27 Sep 2016 11:35:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:221aeca2-a660-45e8-b1a9-f8f15db20d4d</guid><dc:creator>gannerud</dc:creator><description>&lt;p&gt;Thank you! This helped me alot!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF Dongle as UART client python</title><link>https://devzone.nordicsemi.com/thread/115039?ContentTypeID=1</link><pubDate>Tue, 27 Sep 2016 11:21:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0fc2a3f5-e294-43f1-aa0c-fd37f1705f5e</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;I updated my answer above with the description of enabling NUS.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF Dongle as UART client python</title><link>https://devzone.nordicsemi.com/thread/115038?ContentTypeID=1</link><pubDate>Tue, 27 Sep 2016 06:06:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5993f2eb-ff91-4304-af26-d96a5e6baafa</guid><dc:creator>gannerud</dc:creator><description>&lt;p&gt;Hi thanks for your response. I&amp;#39;m have looked at the heart_rate_collector example and I get connected to my peripheral but when i try to write to it with write to a custom uuid (Nordic UART Service, 6E400002B5A3F393E0A9E50E24DCCA9E) I get an exception
File &amp;quot;C:\Python27\lib\site-packages\pc_ble_driver_py\ble_adapter.py&amp;quot;, line 282, in write_cmd
raise NordicSemiException(&amp;#39;Characteristic value handler not found&amp;#39;)
What shall a custom write_cmd look like?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF Dongle as UART client python</title><link>https://devzone.nordicsemi.com/thread/115037?ContentTypeID=1</link><pubDate>Mon, 26 Sep 2016 13:03:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f83e2c2e-cf9f-4f12-85df-9fd5f65a1a1c</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;You can use &lt;a href="https://github.com/NordicSemiconductor/pc-ble-driver-py"&gt;pc-ble-driver-py&lt;/a&gt; to communicate with peripherals from your python program. See the examples in python/pc_ble_driver_py/examples for help getting started.&lt;/p&gt;
&lt;p&gt;[EDIT:]&lt;/p&gt;
&lt;p&gt;To use the Nordic UART service to read and write data, you have to add the UUIDs to your driver. An example of how this is done can be seen in the source of the &lt;a href="https://github.com/NordicSemiconductor/pc-nrfutil/blob/79620fd1998ab9769da590aab0b191235c641666/nordicsemi/dfu/dfu_transport_ble.py"&gt;BLE transport layer for the DFU service in nrfutil&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Based on the HRS example code, adding the corresponding UUIDs for NUS will then be as follows.&lt;/p&gt;
&lt;p&gt;Define the UUIDs inside the HRCollector class:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    BASE_UUID     = BLEUUIDBase([0x6E, 0x40, 0x00, 0x00, 0xB5, 0xA3, 0xF3, 0x93, 
                                 0xE0, 0xA9, 0xE5, 0x0E, 0x24, 0xDC, 0xCA, 0x9E])
	NUS_TX_UUID   = BLEUUID(0x0003, BASE_UUID)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Add your BASE_UUID to the driver (in HRCollector.open()):&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;self.adapter.driver.ble_vs_uuid_add(HRCollector.BASE_UUID)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Enable notification (in HRCollector.connect_and_discover()):&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;self.adapter.enable_notification(conn_handle=new_conn, uuid=HRCollector.NUS_TX_UUID)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>