BLE POC Tracking System – Implementation Notes – Creating System Files and Flashing

I’ve recently completed an Honours Degree in Software Development and as part of this I spent a few months off and on working on a proof of concept tracking system utilising Bluetooth Low Energy (BLE) in order to track small asset tags. I believe this system could quite easily be scaled up to an industrial scale with further work but don’t personally plan to follow this up in the near future due to working on other projects. As such I figured I’d release a lot of what I have and hopefully it can help somebody else.

If you do something cool with this then please get in touch, otherwise do with it all as you wish.

This post is one of eight scheduled to be released over the next few weeks, all posts in this series may be found by selecting the tag below.


Next, we will flash the NRF51822 with the custom firmware.

Start OpenOCD and Connect

To start OpenOCD, run the following command –

sudo openocd -f interface/raspberrypi4-native.cfg -c "transport select swd; set WORKAREASIZE 0" -f target/nrf51.cfg

If everything has been set up correctly, we should see the same result as in the image below. This means that it is now possible to connect to the device using a telnet connection.

Figure 10 shows OpenOCD starting to listen for connection requests
Figure 10 shows OpenOCD starting to listen for connection requests

Programming the NRF51822

This chip is programmed using the mbed online compiler which outputs a hex file which we can flash the chip with.

  1. Log onto https://os.mbed.com/
  2. Import this project which will take in any BLE data and convert it to serial UART where it is sent to the WiFi chip. – https://os.mbed.com/users/electronichamsters/code/BLE_Gateway/
  3. Once imported click Compile to download the hex files.
  4. These exported files must then be moved to the Raspberry PI and the location noted.

Flashing the NRF51822

In a console, type –

sudo openocd -f interface/raspberrypi4-native.cfg -c "transport select swd; set WORKAREASIZE 0" -f target/nrf51.cfg

This will allow us to connect to the chip via SSH.

In a separate console, create a telnet session to 127.0.0.1 on port 4444 to connect to the NRF51 chip. This may be done by typing –

telnet localhost 4444

Then type the following to flash the device, replacing the /media/xxx part with the location of the hex file generated above.

halt
nrf51 mass_erase
flash write_image erase /media/xxxx.hex 0
reset

Once complete the NRF51822 chip has been flashed with the given firmware and can be tested or disconnected for now.

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.