RPI PROG

From ElectroDragon
Jump to navigation Jump to search

Setup

  • $sudo apt-get install openocd
  • $sudo apt-get install avrdude
  • $sudo apt-get install flashrom


OPENOCD

  • Read more information here: OpenOCD

AVR

2019-06-04 141936.png

env.sh configure chip type probe.sh detect the chip and connections flash_dump.sh read flash flash_write.sh flash flash

Modify avrdude.conf for RPI

  1. Linux GPIO configuration for avrdude.
  2. Change the lines below to the GPIO pins connected to the AVR.
programmer
  id    = "linuxgpio";
  desc  = "Use the Linux sysfs interface to bitbang GPIO lines";
  type  = "linuxgpio";
  reset = 12;
  sck   = 24;
  mosi  = 23;
  miso  = 18;
;


SWD - STM32

  • env.sh Configure the platform to which the chip belongs, such as stm32f1x, stm32f2x, etc. When calling other scripts, you need to execute source ./env.sh first to initialize the environment variables, the same below.
  • probe.sh is used to detect the existence of the chip
  • attach.sh attach to the chip, then another window can call $telnet localhost 4444 for single step debugging
  • flash_dump.sh dumps the flash data from the chip
  • flash_erase.sh erase flash data in the chip
  • flash_write.sh Flash inside the chip
  • lock.sh stm32 series chip provides flash write protection. After the write protection is turned on, the chip cannot be debugged. The flash data is read. The product commercial recommendation is to open the write protection function.
  • unlock.sh cancels write protection.

I2C and SPI

Flash

  • probe.sh detect the flash type
  • flash_dump.sh read flash
  • flash_write.sh write flash

EEPROM

Please notice V1 version use I2C0, V2 version add selection to I2C1

  • env.sh Configure the chip model, you can call avrdude -p ? to view the currently supported chips.
  • probe.sh probes the i2c bus
  • flash_dump.sh read flash
  • flash_write.sh flashing flash

OR use I2CDetect to direct dump, write, and read

Other Programmer Functions

  • LED = IO27
  • Button = IO22
  • Buzzer = IO23


Demo Code