Linux icsp1 4.14.98+ #1200 Tue Feb 12 20:11:02 GMT 2019 armv6l
RTS and CTS handshake is only valid with uart0, so I need to use the Alt0 pin functions. Unfortunately, raspi-config cannot change the config file at this time.
sudo systemctl list-units hciuart sudo systemctl disable hciuart sudo nano /boot/config.txt
dtoverlay=pi3-disable-bt # Alt0 pin function dtoverlay=uart0,pin_func=4 # raspi-config can set enable_uart enable_uart=1
As the R-Pi Zero W boots up the D1 green LED is dimly lit. Once the overlay is applied D1 turns off, the R-Pi pin has 1.6V at power on and does sink some current. It is acceptable for this application, but that is not how the AVR's or PIC's that I have used power up.
I did a script so that I can push the bootload button (S1) and run the make bootload rule. I run that script after setting the working folder to the location with the make rule (e.g., change directory to the folder with Makefile).
Next I have a bootload rule in the RPUno i2c-debug application's Makefile.
bootload: avrdude -v -p $(MCU) -c arduino -P $(BOOTLOAD_PORT) -b 38400 -U flash:w:$(TARGET).hex
Then ran this bootld.py script on the working folder with that Makefile.
https://github.com/epccs/Driver/tree/master/ICSP/Bootload
# build the hex file make # run script python ~/bin/bootld.py rsutherland dialout gpio spi rsutherland dialout gpio spi avrdude -v -p atmega328p -c arduino -P /dev/ttyAMA0 -b 38400 -U flash:w:I2c-debug.hex avrdude: Version 6.3-20171130 Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/ Copyright (c) 2007-2014 Joerg Wunsch System wide configuration file is "/etc/avrdude.conf" User configuration file is "/home/rsutherland/.avrduderc" User configuration file does not exist or is not a regular file, skipping Using Port : /dev/ttyAMA0 Using Programmer : arduino Overriding Baud Rate : 38400 AVR Part : ATmega328P Chip Erase delay : 9000 us PAGEL : PD7 BS2 : PC2 RESET disposition : dedicated RETRY pulse : SCK serial program mode : yes parallel program mode : yes Timeout : 200 StabDelay : 100 CmdexeDelay : 25 SyncLoops : 32 ByteDelay : 0 PollIndex : 3 PollValue : 0x53 Memory Detail : Block Poll Page Polled Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- --------- eeprom 65 20 4 0 no 1024 4 0 3600 3600 0xff 0xff flash 65 6 128 0 yes 32768 128 256 4500 4500 0xff 0xff lfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00 hfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00 efuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00 lock 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00 calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00 signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00 Programmer Type : Arduino Description : Arduino Hardware Version: 3 Firmware Version: 6.2 Vtarget : 0.3 V Varef : 0.3 V Oscillator : 28.800 kHz SCK period : 3.3 us avrdude: AVR device initialized and ready to accept instructions Reading | ################################################## | 100% 0.00s avrdude: Device signature = 0x1e950f (probably m328p) avrdude: safemode: lfuse reads as 0 avrdude: safemode: hfuse reads as 0 avrdude: safemode: efuse reads as 0 avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed To disable this feature, specify the -D option. avrdude: erasing chip avrdude: reading input file "I2c-debug.hex" avrdude: input file I2c-debug.hex auto detected as Intel Hex avrdude: writing flash (8692 bytes): Writing | ################################################## | 100% 3.28s avrdude: 8692 bytes of flash written avrdude: verifying flash memory against I2c-debug.hex: avrdude: load data flash data from input file I2c-debug.hex: avrdude: input file I2c-debug.hex auto detected as Intel Hex avrdude: input file I2c-debug.hex contains 8692 bytes avrdude: reading on-chip flash data: Reading | ################################################## | 100% 2.69s avrdude: verifying ... avrdude: 8692 bytes of flash verified avrdude: safemode: lfuse reads as 0 avrdude: safemode: hfuse reads as 0 avrdude: safemode: efuse reads as 0 avrdude: safemode: Fuses OK (E:00, H:00, L:00) avrdude done. Thank you. icsp_pin falling event occured so use_icsp_pin_to_stop flag cleared press bootload_pin again to end program make clean
I am impressed with how easy it was to automate this; the toil of tracking hex files was what I have seen and was expecting based on that experience, but going from source in the repository to binary upload all within the tool is satisfying.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.