(this guide can work with other boards and/or linux distros with some minor modifications. Might even work with some arduino things)
Pre-req:
- Terminal access to the RPi and Internet access (for downloading first time, not required later on).
run these commands in following order:
Update your packet list:
Code: Select all
sudo apt-get update
Code: Select all
sudo apt-get install git autoconf libtool make pkg-config libusb-1.0-0 libusb-1.0-0-dev
Code: Select all
git clone http://openocd.zylin.com/openocd
Code: Select all
cd openocd-code
Code: Select all
./bootstrap
Code: Select all
./configure --enable-sysfsgpio --enable-bcm2835gpio
Code: Select all
Run make
Code: Select all
sudo make install
Go back to your home directory:
Code: Select all
cd ~
Code: Select all
mkdir scooterflash
Code: Select all
cd bootloader
Code: Select all
nano openocd.cfg
Code: Select all
source [find interface/raspberrypi2-native.cfg]
bcm2835gpio_swd_nums 25 24
transport select swd
# target
set WORKAREASIZE 0
set CHIPNAME nrf51802
source [find target/nrf51.cfg]
init
targets
Notice the CHIPNAME, this is is the number you'll find on the chip if you look closely.
Now download the full_BLE.bin file that you will flash onto the dashboard:
Code: Select all
wget https://files.scooterhacking.org/esx/fw/ble/full_BLE.bin
Hardware vise it's just like with the ST-Link v2, removing the C15 resistor and just hooking up cables:
RPi:
Dashboard:
Im using cable clamps so I dont have to solder, and just pressing the 3.3V cable onto the T6 square:
Open up another terminal on the RPi (same way as you connected to it or open another terminal if using a monitor).
When cables are hoocked upp / soldered (dont forget the 3.3v cable), you should now run OpenOCD and flash.
In the first terminal, run OpenOCD (it will start with your config automagically
Code: Select all
openocd
Code: Select all
openocd -f openocd.cfg
Open up the other terminal and telnet to your OpenOCD telnet service:
Code: Select all
telnet localhost 4444
You should now be connected. If not, check your cables again! Cable connection is E V E R Y T H I N G!
- TO FLASH CLONE -
Now flash your dashboard:to flash a clone dashboard add these steps
Open Telnet using this command in this new window: telnet 127.0.0.1 4444
type
init
reset halt
nrf51 mass_erase
program full_ble.bin
and done
Code: Select all
program full_BLE.bin
Code: Select all
> program full_BLE.bin
target halted due to debug-request, current mode: Thread
xPSR: 0xc1000000 pc: 0x000006d0 msp: 0x000007c0
Programming Started
Unknown device (HWID 0x00000114)
not enough working area available(requested 32)
no working area available, falling back to slow memory writes
Programming Finished
IF YOU GET SOMETHING LIKE THIS, CHECK YOUR SOLDERING / CABLE CONNECTIONS
Code: Select all
> program full_BLE.bin
target halted due to debug-request, current mode: Thread
xPSR: 0xc1000000 pc: 0x000006d0 msp: 0x000007c0
Programming Started
Unknown device (HWID 0x00000114)
not enough working area available(requested 32)
no working area available, falling back to slow memory writes
SWD DPIDR 0x0bb11477
Failed to read memory at 0x00022fd0
Couldn't read NVMC_READY register
Failed to write to nrf5 flash
error writing to flash at address 0x00000000 at offset 0x00000000
embedded:startup.tcl:449: Error: Programming Failed
in procedure 'program'
in procedure 'program_error' called at file "embedded:startup.tcl", line 508
at file "embedded:startup.tcl", line 449
https://learn.adafruit.com/programming- ... ng-openocd