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,

    I am sorry, but I cannot think of much more that might be the issue. Make sure that you have gotten the endianness correct (i.e. byte order in the UUIDs) and that you are using the correct UUIDs. Other than that, there is no reason left why it should not work...

    Regards,
    Terje

  • Hi ,

    I have took the endianness correctly that I have checked. But not able to success. If there is no other reason left then I have to take another approach here.

    I have took windows native ble libs for connecting to nrf board. As of now I am able to connect and explore services UUID's from board (pairing is also done). For this I am using the same UUID's as above for reading characteristics. ( If you have experience in that you can point to me correct way if I am wrong. I am coding in C# and open for java as well for example code).

    But While sending read command I am not able to receive data. To debug this issue,I request to point me for any example that utilizes the same libs(windows app for BLE libs) for communication. so that I can compare and make changes accordingly in my application.

    Thanks,

    Hinesh

  • Hi,

    I am sorry for the delays, I have been out-of-office for the holidays and returned today.

    We do not have anything in C# or Java. What we do have is pc-ble-driver-py and pc-ble-driver-js, which is Python and JavaScript respectively. For pc-ble-driver-py we do not have any example that does what you want, so I still refer to what I have written previously in this thread. We also have the base pc-ble-driver, which is written in c/c++.

    Regards,
    Terje

  • Hi

    Is there any update on the python version for scripts which you have mentioned in the thread here?

    Thanks,

  • 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

Reply Children
Related