Giter Club home page Giter Club logo

cc2531's Introduction

flash_cc2531

flash CC2531 USB dongle from your Raspberry, without Arduino nor CC Debugger.

prerequisites

You need a Raspberry or an Odroid-c2.
WiringPi must be installed (if it is not preinstalled, you can usually install it with sudo apt-install install wiringpi).
I have designed flash_cc2531 on a Raspberry Pi 3 with raspbian, but successful flashes have been reported on pi 1 and pi 2 : see sections use other pins and what to try if it doesn't work.

Getting Started

Download flash_cc2531 on your raspberry:

git clone https://github.com/jmichault/flash_cc2531.git

Connect the following pins of the debug port to the GPIO port :

  1. pin 1 (GND) --> pin 39 (GND)
  2. pin 7 (reset) --> pin 35 (wPi 24, BCM19)
  3. pin 3 (DC) --> pin 36 (wPi 27, BCM16)
  4. pin 4 (DD) --> pin 38 (wPi 28, BCM20)

and insert the usb dongle in a port.

A downloader cable CC and 4 Dupont line Female to Female are perfect for this purpose :

test by running :

cd flash_cc2531
./cc_chipid

it should return :

  ID = b524.

If you see 0000 or ffff, something is wrong and you should probably check your wiring.

Usage

To save the content of the flash to save.hex file :

./cc_read save.hex

(takes around 1 minute).

To erase the flash :

./cc_erase

Note : You must erase before writing.

To flash file to cc2531 :

./cc_write CC2531ZNP-Prod.hex

(takes around 3 minutes).

Use other pins

all commands accept following arguments :

        -c pin : change pin_DC (default 27)
	-d pin : change pin_DD (default 28)
	-r pin : change reset pin (default 24)
  	-m : change multiplier for time delay (default auto)

the pin numbering used is that of wiringPi. Use "gpio readall" to have the layout on your pi (wPi column).

example, if you want to use pins 3, 11 and 13 : Connect the following pins of the debug port to the GPIO port :

  1. pin 1 (GND) --> pin 14 (GND)
  2. pin 7 (reset) --> pin 3 (wPi 8, BCM2)
  3. pin 3 (DC) --> pin 11 (wPi 0, BCM17)
  4. pin 4 (DD) --> pin 13 (wPi 2, BCM27)

and now you can read chip id, save flash content, erase flash, and write flash with following commands :

./cc_chipid -r 8 -c 0 -d 2
./cc_read -r 8 -c 0 -d 2 save.hex
./cc_erase -r 8 -c 0 -d 2
./cc_write -r 8 -c 0 -d 2 CC2531ZNP-Prod.hex

You can also change default values in CCDebugger.h and recompile executables with make.

what to try if it doesn't work?

  1. stop all other programs before flash.
  2. fix the cpu speed before flash. Example :
sudo bash
echo performance >/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
exit
  1. use the -m option to increase time delays used. Example :
./cc_write -m 300 CC2531ZNP-Prod.hex
  1. executables are compiled on my raspbian distribution, you can try to recompile for your distribution with make.

License

This project is licensed under the GPL v3 license (see COPYING).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.