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.

Related