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

Programming my Thingy52 with pc-ble-driver-py, Error code: 13

Hello,

I am trying to ultimately make a script which will compile the code for my Thingy52 and also automatically program it through the development kit.

As a part of this I want to use this pc-ble-driver-py script nus_collector.py I found here.

I have made sure that I am using pc-ble-driver-py v0.11.3 as recommended in the thread linked above.

This is now the output I get when I run the nus_collector script:

robban@:pca20020_s132$ python2.7 nus_collector.py NRF52
	0 : /dev/ttyACM0: 000682995637
 
Enter your choice: 0
Serial port used: /dev/ttyACM0
Traceback (most recent call last):
  File "nus_collector.py", line 196, in <module>
    main(serial_port)
  File "nus_collector.py", line 158, in main
    collector.open()
  File "nus_collector.py", line 73, in open
    self.adapter.driver.open()
  File "/usr/local/lib/python2.7/dist-packages/pc_ble_driver_py/ble_driver.py", line 126, in wrapper
    raise NordicSemiException('Failed to {}. Error code: {}'.format(wrapped.__name__, err_code))
pc_ble_driver_py.exceptions.NordicSemiException: Failed to open. Error code: 13

I also tried running the command with sudo, with the following (different) result:

robban@:pca20020_s132$ sudo python2.7 nus_collector.py NRF52
	0 : /dev/ttyACM0: 000682995637
 
Enter your choice: 0
Serial port used: /dev/ttyACM0
No handlers could be found for logger "pc_ble_driver_py.ble_driver"
Traceback (most recent call last):
  File "nus_collector.py", line 196, in <module>
    main(serial_port)
  File "nus_collector.py", line 155, in main
    driver    = BLEDriver(serial_port=serial_port, auto_flash=True)
  File "/usr/local/lib/python2.7/dist-packages/pc_ble_driver_py/ble_driver.py", line 927, in __init__
    flasher = Flasher(serial_port=serial_port)
  File "/usr/local/lib/python2.7/dist-packages/pc_ble_driver_py/ble_driver.py", line 856, in __init__
    raise NordicSemiException('nrfjprog not installed')
pc_ble_driver_py.exceptions.NordicSemiException: nrfjprog not installed

Which is strange, because I have certainly added the ../nrfjprog directory to my PATH, see here:

robban@:pca20020_s132$ echo $PATH
/home/robban/bin:/home/robban/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/nRF-Command-Line-Tools_9_8_1_Linux-x86_64/nrfjprog

I don't quite understand what is going on here, could anybody help?

Another related question is how the script actually finds the correct HEX-files to program the Thingy52 with? I can't seem to find any code in the script which determines the path to the files, which confuses me.

Parents
  • Hi,

    I'm not sure I understand what you are trying to do here. pc-ble-driver-py is a serialization driver for controlling a nRF5x device through a serial interface, from a Python application. The Thingy:52 does not have a serial interface to the PC, and the connectivity FW used in pc-ble-driver do not have correct pin mappings to use it with Thingy:52.

    Can you describe in more detail what you are trying to achieve? This would help us to understand your problem better and provide you with the best support!

    Best regards,
    Jørgen

  • Hehe while looking for something else I actually ran into this very helpful command on this page.

    nrfjprog -f NRF52 --program file.hex –-chiperase

    Which was almost what I was looking for, but it also erased some of the memory I didn't want it to erase.

    This is the script I ended up with in the end, and it works just fine!

    make -C "$(dirname "$0")/armgcc" clean &&
    make -j -C "$(dirname "$0")/armgcc" &&
    nrfjprog -f NRF52 --program "$(dirname "$0")/armgcc/_build/nrf52832_xxaa_s132.hex" --sectorerase &&
    nrfjprog --run

Reply Children
No Data
Related