Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Using pc-ble-driver-py on Raspberry Pi

This is a duplicate of this issue of pc-ble-driver-py repository.

While using pc-ble-driver-py on MacBook without problem, I face Error 13 when opening device on Raspberry Pi.
[OS]
latest stock RASPBIAN STRETCH LITE Version:June 2018
setup wifi & ssh

[DK]
PCA10028 V 1.1.0
PCA10040 V 0.9.0

[Command Line History]
--- on PC ---
scp -pr ~/Downloads/JLink_Linux_V632h_arm/ [email protected]:/home/pi
--- on Raspberry Pi ---
sudo cp /home/pi/JLink_Linux_V632h_arm/99-jlink.rules /etc/udev/rules.d/
sudo apt-get update
sudo apt-get dist-upgrade
mkdir /home/pi/boost
cd /home/pi/boost
wget https://dl.bintray.com/boostorg/release/1.65.1/source/boost_1_65_1.tar.bz2
tar jxvf boost_1_65_1.tar.bz2
sudo apt install cmake swig git make gcc g++ libudev-dev python python-dev python-pip
export BOOST_ROOT=/home/pi/boost/boost_1_65_1/
cd $BOOST_ROOT
./bootstrap.sh
./b2 toolset=gcc cxxflags=-fPIC cflags=-fPIC address-model=32 link=static --with-thread --with-system --with-regex --with-date_time --with-chrono
cd /home/pi
git clone https://github.com/NordicSemiconductor/pc-ble-driver-py.git
cd pc-ble-driver-py/
git submodule init
git submodule update
cd build/
cmake -G "Unix Makefiles" ..
make
pip install wrapt
cd ../python/
cp pc_ble_driver_py/examples/advertising.py .
nano advertising.py # turn off auto flasher
python ./advertising.py NRF52 /dev/ttyACM0

[Result]
pi@raspberrypi:~/pc-ble-driver-py/python $ python ./advertising.py NRF52 /dev/ttyACM0
Serial port used: /dev/ttyACM0
Traceback (most recent call last):
File "./advertising.py", line 79, in
main(sys.argv[2])
File "./advertising.py", line 55, in main
driver.open()
File "/home/pi/pc-ble-driver-py/python/pc_ble_driver_py/ble_driver.py", line 127, 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

Parents Reply
  • Key points to run examples on RPI (w/ DK):


    1. no need JLink software
    --- DK flashing ---
    2. flash nRF on DK by PC, I just tried the 115200 version
    --- pc-ble-driver-py ---
    3. compile boost from source, version <= 1.65.1
    4. install pc-ble-driver-py from source
    --- HW part ---
    5. cut solder bridges on DK to isolate nRF UART pins from interface MCU
    6. wire connect nRF UART to RPI GPIOs
    --- RPI part ---
    7. enable RPI UART w/ HWFC
    --- Python part ---
    8. turn off auto flashing if you with to try examples
    9. make sure UART setting matches connectivity FW that was already flashed in step 2
    10. run examples by explicitly assign UART that is enabled in previous step 

    to flash / erase afterward :

    1. cut solder bridges on DK to isolate SWD pins from interface MCU
    2. wire connect nRF SWD pins (TPs on DK) to RPI GPIO
    3. bitbang SWD on RPI & do your job with it

    Hope this helps

Children
No Data
Related