This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Regarding Python Scripts for nrf52840 to connect and transfer data.

Hi ,

What I am trying:- 

-connect the custom board with nrf52840 chip using nrf52 dongle on pc with python.

-Already set some commands on custom board so when my pc (via dongle) connects to custom board, I want to send some commands and accordingly receive the response.

For this I got my hands-on nrf dongle to give my laptop a BLE access.

And I am trying to access the board using dongle (using python script) and I am getting below error,


raise NordicSemiException('Failed to {}. Error code: {}'.format(wrapped.__name__, err_code))
pc_ble_driver_py.exceptions.NordicSemiException: Failed to open. Error code: 13.

Would anyone able to tell me how do i resolve this. 

I want to have python code that can connect and do some data transfer over BLE using Dongle connected to my pc and I have tried with hart_rate_monitor unsuccessfully. 

EDIT 1:- I am able to scan and connect my board using the nRF Connect windows app. Same I wanted to implement over python.

Thanks,

Hinesh

Parents
  • Hi,

    Can you provide the full command that you run (for starting the python script) and all output to the command line afterwards? (Both what parameters you send to the script, any debug output, and the full traceback may give clues as to what is the problem.)

    Regards,
    Terje

  • HI

    Actually I have resolved the above error.

    By going through various questions and answers here I came to know some tools.

    So When I was opening 'nrf connect' windows app , it was flashing firmware and I was having impression that this will be samefirmware will be used for scanning and connect via python. But It was not working.

    And the I have installed windows command line tools and format the board using 'nrfproject' command. And Let the python  application 'Hear rate monitor' do the flashing. Then it started working.

    It seems the mismatch on the firmware version on nrf52840 PDK Board (that I am using as dongle to connect to custom board via my pc).

    So To come on another query I have,

    Can you point me any example or script that can do the same work as 'nrf connect' does?

    Scan, connect (to particular given mac id) and explore services of connected device.


    Basically I am trying what I have explained on above question.

    This would be very help full for us as we are already on advance stage for development.

    Thanks,

    Hinesh

  • Hi,

    Nothing new, I am afraid, apart from that the team is working on pc-ble-driver-py now and there will be a release some time in the future. I do not know how much time it will take, and what changes they will do other than implement support for pc-ble-driver v4.

    Regards,
    Terje

  • Hi ,

    Thank you very much for the quick response and I agree with your point as well.

    I was digging a bit and found that., 

    In order to receive the data using above UUID, I need to select the service UUID and then Characteristics UUID (might be the normal communication) .

    here the characteristics have their own handles or descriptors ( which I am not able to write or I am not doing in code ).

    From the descriptors or handles I need to choose one and then I need to write (0x0100) to enable notification. Once the notification is  enabled the board (slave )will start transmitting data which I wanted to read. 

    Now slave has number of descriptors that I need to read and select first and according to need I will write data and enable notification. 

    This is the flow which I confirmed with other device.

    May be in python example above you can point out edits so that I can check once.

    Thanks,

  • hello,How are you doing? I have the same problem.

  • The problem with connecting your own peripherals is described in the above reply

    problem

Reply Children
Related