Skip to content

Instantly share code, notes, and snippets.

@giuliano108
Last active July 6, 2023 09:50
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save giuliano108/49c530dc9af6fa2bd3c57447efddce57 to your computer and use it in GitHub Desktop.
Save giuliano108/49c530dc9af6fa2bd3c57447efddce57 to your computer and use it in GitHub Desktop.
Flashing a CC2531 USB dongle using a Raspberry Pi 1

Flashing a CC2531 USB dongle using a Raspberry Pi 1

The examples I've seen ( 1, 2 ) all assume a "modern" Raspberry Pi with a 40-pin GPIO connector.

If you want to use a Raspberry Pi 1 (26-pin GPIO), you need to pass -r, -c and -d to the flash_cc2531 tools, based on how you want to wire things (I'm using GPIO.3->Reset, GPIO.4->DC, GPIO.5->DD).

Check the example/pictures below.

root@octopi:~# gpio readall
 +-----+-----+---------+------+---+-Model B1-+---+------+---------+-----+-----+
 | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
 |     |     |    3.3v |      |   |  1 || 2  |   |      | 5v      |     |     |
 |   0 |   8 |   SDA.1 |   IN | 1 |  3 || 4  |   |      | 5v      |     |     |
 |   1 |   9 |   SCL.1 |   IN | 1 |  5 || 6  |   |      | 0v      |     |     |
 |   4 |   7 | GPIO. 7 |   IN | 1 |  7 || 8  | 1 | ALT0 | TxD     | 15  | 14  |
 |     |     |      0v |      |   |  9 || 10 | 1 | ALT0 | RxD     | 16  | 15  |
 |  17 |   0 | GPIO. 0 |   IN | 0 | 11 || 12 | 0 | IN   | GPIO. 1 | 1   | 18  |
 |  21 |   2 | GPIO. 2 |   IN | 0 | 13 || 14 |   |      | 0v      |     |     |
 |  22 |   3 | GPIO. 3 |   IN | 0 | 15 || 16 | 0 | IN   | GPIO. 4 | 4   | 23  |
 |     |     |    3.3v |      |   | 17 || 18 | 0 | IN   | GPIO. 5 | 5   | 24  |
 |  10 |  12 |    MOSI |   IN | 0 | 19 || 20 |   |      | 0v      |     |     |
 |   9 |  13 |    MISO |   IN | 0 | 21 || 22 | 0 | IN   | GPIO. 6 | 6   | 25  |
 |  11 |  14 |    SCLK |   IN | 0 | 23 || 24 | 1 | IN   | CE0     | 10  | 8   |
 |     |     |      0v |      |   | 25 || 26 | 1 | IN   | CE1     | 11  | 7   |
 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
 | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
 +-----+-----+---------+------+---+-Model B1-+---+------+---------+-----+-----+

root@octopi:/opt/flash_cc2531# ./cc_chipid -r 3 -c 4 -d 5
  ID = b524.

root@octopi:/opt/flash_cc2531# ./cc_erase -r 3 -c 4 -d 5
  ID = b524.
  erase result = 00a2.

root@octopi:/opt/flash_cc2531# echo performance >/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

root@octopi:/opt/flash_cc2531# ./cc_write -r 3 -c 4 -d 5 CC2531ZNP-Prod.hex
  ID = b524.
  reading line 15490.
  file loaded (15497 lines read).
writing page 128/128.
verifying page 128/128.
 flash OK.
root@octopi:/opt/flash_cc2531#
@j0schka
Copy link

j0schka commented Apr 2, 2021

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment