Closed pb66 closed 10 years ago
gpio programming seems to cause all sorts of problems, "gpio" is not a valid port, so that explains the error message, i assume that's what the hacked avrdude works around. its also not a hardware isp which explains the instructions.
are you sure you're using the modified avrdude - is there another one in your $path?
can you post a log of your arduinio-mk output? as it may be the modified programmers.txt, boards.txt, avrdude.conf or all the various files that gertuino replaces.
as an aside - does "make reset" work, as i know with gertduino you have to use gordon's reset script not just twiddling the serial port like normal arduino's. you'd have to set RESET_CMD=/path/to/gertduino/reset
apparently serial upload works: http://www.raspberrypi.org/forum/viewtopic.php?f=96&t=62026&start=25
After a closer look at Gordon's site I believe there are 2 possible set-ups and I believe I have the NON gertuino flavour. I started out with the latest wheezy packages for arduino which installs avrdude as a dependency and then I followed the instructions on this page https://projects.drogon.net/raspberry-pi/gertboard/arduino-ide-installation-isp/ and NOT this page https://projects.drogon.net/raspberry-pi/gertduino/atmega-setup/. I am unable to find any gertduino files or folders or reference to reset. I do have the avrsetup script from this page https://projects.drogon.net/raspberry-pi/gertboard/initial-setup-of-the-atmega/ this functions correctly as i have changed the default fuse settings as I not using a gertbord or gertduino. make reset with RESET_CMD = /usr/local/bin/avrsetup has the same result as from the command line
Resetting Arduino...
/usr/local/bin/avrsetup
Initialising a new ATmega microcontroller for use with the Gertboard.
Make sure there is a new ATmega chip plugged in, and press
.. 1 for an ATmega328p or 2 for an ATmega168: 1
Initialising an ATmega328p ...
Looks all OK - Happy ATmega programming!
(Prior to settting RESET_CMD in the makefile i ran make reset and got this error
make reset/usr/share/arduino/Arduino.mk:1143: *** Arduino port not found!. Stop.)
So yes I believe i am using the modified avrdude as I am able to use the gpio programmer via the arduinoIDE and manually through avrdude. also the current stable wheezy package I previously had installed did not have the gpio programmer lines in the avrdude.conf. I have three 328p's connected to a raspberry pi via miso,mosi & sclk with independent reset lines to gpio 22, 23 & 24. I am able to upload to any avr without problem using ide but I wish to ssh in with putty and use the command line. I currently use MK to compile and then upload using avrdude independently. When I manually upload I omit the -C port details but when using MK around line 1009 of ardino-mk -C gets added with a empty value. In hind sight I now believe that my current workaround is maybe a simpler arrangement for me than using MK to upload. this is because I can upload the same sketch to multiple avrs by just editing the avrdude command line or to use MK I will need to have multiple board types to reference multiple programmer types and edit the makefile between uploads or is there a way to overide default settings in the MK command line? I will try and post some logs of MKs successful make and failed ispload, along with a succesfull avrdude upload. Many thanks Paul..
LOG (sorry about formatting, I just cut and pasted !)
pi@RPi-B2D ~/EmonPi/plate/EmonPi/examples/emonpi_plate $ make ispload
-------------------------
Arduino.mk Configuration:
- [AUTODETECTED] CURRENT_OS = LINUX
- [COMPUTED] ARDMK_DIR = /usr/share/arduino (relative to Common.mk)
- [AUTODETECTED] ARDUINO_DIR = /usr/share/arduino
- [AUTODETECTED] ARDUINO_VERSION = 101
- [AUTODETECTED] ARDUINO_PREFERENCES_PATH = /home/pi/.arduino/preferences.txt
- [AUTODETECTED] ARDUINO_SKETCHBOOK = /home/pi/sketchbook (from arduino preferences file)
- [BUNDLED] AVR_TOOLS_DIR = (in Arduino distribution)
- [COMPUTED] ARDUINO_LIB_PATH = /usr/share/arduino/libraries (from ARDUINO_DIR)
- [DEFAULT] ARDUINO_CORE_PATH = /usr/share/arduino/hardware/arduino/cores/arduino
- [COMPUTED] ARDUINO_VAR_PATH = /usr/share/arduino/hardware/arduino/variants (from ARDUINO_DIR)
- [COMPUTED] BOARDS_TXT = /usr/share/arduino/hardware/arduino/boards.txt (from ARDUINO_DIR)
- [DEFAULT] USER_LIB_PATH = /home/pi/sketchbook/libraries (in user sketchbook)
- [USER] BOARD_TAG = ep_isp
- [COMPUTED] OBJDIR = build-ep_isp (from BOARD_TAG)
- [DETECTED] MONITOR_BAUDRATE = 9600 (in sketch)
- [DEFAULT] OPTIMIZATION_LEVEL = s
- [DEFAULT] MCU_FLAG_NAME = mmcu
- [DEFAULT] CFLAGS_STD = -std=gnu99
- [AUTODETECTED] Size utility: AVR-aware for enhanced output
-
- ARDUINO_LIBS =
- [SYSTEM] Wire
- [SYSTEM] Wire/utility
- [COMPUTED] BOOTLOADER_PARENT = /usr/share/arduino/hardware/arduino/bootloaders (from ARDUINO_DIR)
-------------------------
mkdir -p build-ep_isp
/usr/bin/avr-g++ -x c++ -include Arduino.h -MMD -c -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=101 -I. -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/hardware/arduino/variants/standard -I/usr/share/arduino/libraries/Wire -I/usr/share/arduino/libraries/Wire/utility -Wall -ffunction-sections -fdata-sections -Os -fno-exceptions emonpi_plate.ino -o build-ep_isp/emonpi_plate.o
/usr/bin/avr-gcc -MMD -c -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=101 -I. -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/hardware/arduino/variants/standard -I/usr/share/arduino/libraries/Wire -I/usr/share/arduino/libraries/Wire/utility -Wall -ffunction-sections -fdata-sections -Os /usr/share/arduino/hardware/arduino/cores/arduino/WInterrupts.c -o build-ep_isp/WInterrupts.o
/usr/bin/avr-gcc -MMD -c -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=101 -I. -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/hardware/arduino/variants/standard -I/usr/share/arduino/libraries/Wire -I/usr/share/arduino/libraries/Wire/utility -Wall -ffunction-sections -fdata-sections -Os /usr/share/arduino/hardware/arduino/cores/arduino/wiring_analog.c -o build-ep_isp/wiring_analog.o
/usr/bin/avr-gcc -MMD -c -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=101 -I. -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/hardware/arduino/variants/standard -I/usr/share/arduino/libraries/Wire -I/usr/share/arduino/libraries/Wire/utility -Wall -ffunction-sections -fdata-sections -Os /usr/share/arduino/hardware/arduino/cores/arduino/wiring.c -o build-ep_isp/wiring.o
/usr/bin/avr-gcc -MMD -c -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=101 -I. -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/hardware/arduino/variants/standard -I/usr/share/arduino/libraries/Wire -I/usr/share/arduino/libraries/Wire/utility -Wall -ffunction-sections -fdata-sections -Os /usr/share/arduino/hardware/arduino/cores/arduino/wiring_digital.c -o build-ep_isp/wiring_digital.o
/usr/bin/avr-gcc -MMD -c -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=101 -I. -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/hardware/arduino/variants/standard -I/usr/share/arduino/libraries/Wire -I/usr/share/arduino/libraries/Wire/utility -Wall -ffunction-sections -fdata-sections -Os /usr/share/arduino/hardware/arduino/cores/arduino/wiring_pulse.c -o build-ep_isp/wiring_pulse.o
/usr/bin/avr-gcc -MMD -c -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=101 -I. -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/hardware/arduino/variants/standard -I/usr/share/arduino/libraries/Wire -I/usr/share/arduino/libraries/Wire/utility -Wall -ffunction-sections -fdata-sections -Os /usr/share/arduino/hardware/arduino/cores/arduino/wiring_shift.c -o build-ep_isp/wiring_shift.o
/usr/bin/avr-g++ -MMD -c -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=101 -I. -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/hardware/arduino/variants/standard -I/usr/share/arduino/libraries/Wire -I/usr/share/arduino/libraries/Wire/utility -Wall -ffunction-sections -fdata-sections -Os -fno-exceptions /usr/share/arduino/hardware/arduino/cores/arduino/CDC.cpp -o build-ep_isp/CDC.o
/usr/bin/avr-g++ -MMD -c -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=101 -I. -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/hardware/arduino/variants/standard -I/usr/share/arduino/libraries/Wire -I/usr/share/arduino/libraries/Wire/utility -Wall -ffunction-sections -fdata-sections -Os -fno-exceptions /usr/share/arduino/hardware/arduino/cores/arduino/HardwareSerial.cpp -o build-ep_isp/HardwareSerial.o
/usr/share/arduino/hardware/arduino/cores/arduino/HardwareSerial.cpp: In function ‘void store_char(unsigned char, ring_buffer*)’:
/usr/share/arduino/hardware/arduino/cores/arduino/HardwareSerial.cpp:84:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
/usr/share/arduino/hardware/arduino/cores/arduino/HardwareSerial.cpp: In member function ‘virtual size_t HardwareSerial::write(uint8_t)’:
/usr/share/arduino/hardware/arduino/cores/arduino/HardwareSerial.cpp:392:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
/usr/bin/avr-g++ -MMD -c -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=101 -I. -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/hardware/arduino/variants/standard -I/usr/share/arduino/libraries/Wire -I/usr/share/arduino/libraries/Wire/utility -Wall -ffunction-sections -fdata-sections -Os -fno-exceptions /usr/share/arduino/hardware/arduino/cores/arduino/HID.cpp -o build-ep_isp/HID.o
/usr/bin/avr-g++ -MMD -c -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=101 -I. -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/hardware/arduino/variants/standard -I/usr/share/arduino/libraries/Wire -I/usr/share/arduino/libraries/Wire/utility -Wall -ffunction-sections -fdata-sections -Os -fno-exceptions /usr/share/arduino/hardware/arduino/cores/arduino/IPAddress.cpp -o build-ep_isp/IPAddress.o
/usr/bin/avr-g++ -MMD -c -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=101 -I. -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/hardware/arduino/variants/standard -I/usr/share/arduino/libraries/Wire -I/usr/share/arduino/libraries/Wire/utility -Wall -ffunction-sections -fdata-sections -Os -fno-exceptions /usr/share/arduino/hardware/arduino/cores/arduino/main.cpp -o build-ep_isp/main.o
/usr/bin/avr-g++ -MMD -c -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=101 -I. -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/hardware/arduino/variants/standard -I/usr/share/arduino/libraries/Wire -I/usr/share/arduino/libraries/Wire/utility -Wall -ffunction-sections -fdata-sections -Os -fno-exceptions /usr/share/arduino/hardware/arduino/cores/arduino/new.cpp -o build-ep_isp/new.o
/usr/bin/avr-g++ -MMD -c -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=101 -I. -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/hardware/arduino/variants/standard -I/usr/share/arduino/libraries/Wire -I/usr/share/arduino/libraries/Wire/utility -Wall -ffunction-sections -fdata-sections -Os -fno-exceptions /usr/share/arduino/hardware/arduino/cores/arduino/Print.cpp -o build-ep_isp/Print.o
/usr/bin/avr-g++ -MMD -c -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=101 -I. -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/hardware/arduino/variants/standard -I/usr/share/arduino/libraries/Wire -I/usr/share/arduino/libraries/Wire/utility -Wall -ffunction-sections -fdata-sections -Os -fno-exceptions /usr/share/arduino/hardware/arduino/cores/arduino/Stream.cpp -o build-ep_isp/Stream.o
/usr/bin/avr-g++ -MMD -c -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=101 -I. -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/hardware/arduino/variants/standard -I/usr/share/arduino/libraries/Wire -I/usr/share/arduino/libraries/Wire/utility -Wall -ffunction-sections -fdata-sections -Os -fno-exceptions /usr/share/arduino/hardware/arduino/cores/arduino/Tone.cpp -o build-ep_isp/Tone.o
/usr/bin/avr-g++ -MMD -c -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=101 -I. -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/hardware/arduino/variants/standard -I/usr/share/arduino/libraries/Wire -I/usr/share/arduino/libraries/Wire/utility -Wall -ffunction-sections -fdata-sections -Os -fno-exceptions /usr/share/arduino/hardware/arduino/cores/arduino/USBCore.cpp -o build-ep_isp/USBCore.o
/usr/bin/avr-g++ -MMD -c -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=101 -I. -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/hardware/arduino/variants/standard -I/usr/share/arduino/libraries/Wire -I/usr/share/arduino/libraries/Wire/utility -Wall -ffunction-sections -fdata-sections -Os -fno-exceptions /usr/share/arduino/hardware/arduino/cores/arduino/WMath.cpp -o build-ep_isp/WMath.o
/usr/bin/avr-g++ -MMD -c -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=101 -I. -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/hardware/arduino/variants/standard -I/usr/share/arduino/libraries/Wire -I/usr/share/arduino/libraries/Wire/utility -Wall -ffunction-sections -fdata-sections -Os -fno-exceptions /usr/share/arduino/hardware/arduino/cores/arduino/WString.cpp -o build-ep_isp/WString.o
/usr/bin/avr-gcc -MMD -c -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=101 -I. -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/hardware/arduino/variants/standard -I/usr/share/arduino/libraries/Wire -I/usr/share/arduino/libraries/Wire/utility -Wall -ffunction-sections -fdata-sections -Os /usr/share/arduino/libraries/Wire/utility/twi.c -o build-ep_isp/libs/Wire/utility/twi.o
/usr/bin/avr-gcc -MMD -c -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=101 -I. -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/hardware/arduino/variants/standard -I/usr/share/arduino/libraries/Wire -I/usr/share/arduino/libraries/Wire/utility -Wall -ffunction-sections -fdata-sections -Os -fno-exceptions /usr/share/arduino/libraries/Wire/Wire.cpp -o build-ep_isp/libs/Wire/Wire.o
/usr/bin/avr-ar rcs build-ep_isp/libcore.a build-ep_isp/WInterrupts.o build-ep_isp/wiring_analog.o build-ep_isp/wiring.o build-ep_isp/wiring_digital.o build-ep_isp/wiring_pulse.o build-ep_isp/wiring_shift.o build-ep_isp/CDC.o build-ep_isp/HardwareSerial.o build-ep_isp/HID.o build-ep_isp/IPAddress.o build-ep_isp/main.o build-ep_isp/new.o build-ep_isp/Print.o build-ep_isp/Stream.o build-ep_isp/Tone.o build-ep_isp/USBCore.o build-ep_isp/WMath.o build-ep_isp/WString.o build-ep_isp/libs/Wire/utility/twi.o build-ep_isp/libs/Wire/Wire.o
/usr/bin/avr-gcc -mmcu=atmega328p -Wl,--gc-sections -Os -o build-ep_isp/emonpi_plate.elf build-ep_isp/emonpi_plate.o build-ep_isp/libcore.a -lc -lm
/usr/bin/avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" \
--change-section-lma .eeprom=0 -O ihex build-ep_isp/emonpi_plate.elf build-ep_isp/emonpi_plate.eep
/usr/bin/avr-objcopy: --change-section-lma .eeprom=0x00000000 never used
/usr/bin/avr-objcopy -O ihex -R .eeprom build-ep_isp/emonpi_plate.elf build-ep_isp/emonpi_plate.hex
/usr/bin/avr-size --mcu=atmega328p -C --format=avr build-ep_isp/emonpi_plate.elf
AVR Memory Usage
----------------
Device: atmega328p
Program: 5034 bytes (15.4% Full)
(.text + .data + .bootloader)
Data: 656 bytes (32.0% Full)
(.data + .bss + .noinit)
/usr/share/arduino/Arduino.mk:1158: *** ISP port not found!. Stop.
pi@RPi-B2D ~/EmonPi/plate/EmonPi/examples/emonpi_plate $ avrdude flash:w:emonpi_plate.hex -p atmega328p -c ep_isp2
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.00s
avrdude: Device signature = 0x1e950f
avrdude: safemode: Fuses OK
avrdude done. Thank you.
pi@RPi-B2D ~/EmonPi/plate/EmonPi/examples/emonpi_plate $ avrdude flash:w:emonpi_plate.hex -p atmega328p -c ep_isp1
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.00s
avrdude: Device signature = 0x1e950f
avrdude: safemode: Fuses OK
avrdude done. Thank you.
pi@RPi-B2D ~/EmonPi/plate/EmonPi/examples/emonpi_plate $ avrdude flash:w:emonpi_plate.hex -p atmega328p -c ep_isp3
avrdude: AVR device not responding
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.
avrdude done. Thank you.
NOTE - I disconnected avr #3 to get a different output message just to show the 3 channels are all working. Cheers Paul
i'm a bit lost now, so you don't have a gerboard or gertuino, you're just trying to use the gpio pins as an isp using the modified avrdude?
the reset script, avrdude.conf etc. can be found at: http://project-downloads.drogon.net/gertduino/gertduino.tgz
RESET_CMD=/usr/local/bin/avrsetup won't work, avrsetup just calls avrdude to set the fuses.
are you defining ISP_PORT=gpio in your Makefile perhaps, as ardunio-mk won't be able to find that as its not a device, you'll get the error if you define a port that doesn't exist like that.
you should be able to pass different avrdude parameters for each board type by overriding some of the variables here
i might have a go at this myself as is sounds interesting, but the easy route is just to get a usbasp, i don't like the way the gpio stuff mucks with avrdude.
@pb66 Like @sej7278 suggested, you have to override your avrdude settings.
By default the makefile tries to use the avrdude bundled inside Arduino directory. The following line in the log you pasted confirms it.
[BUNDLED] AVR_TOOLS_DIR = (in Arduino distribution)
But when you call avrdude
from commandline it refers to the patched avrdude.
To make it work with the makefile, you need to override the avrdude executable and point it to the one which is patched.
You can find the path the patched avrdude by executing the command which avrdude
@sej7278, If your lost..there's no hope for me! ;-) Yes you are right I am not using gerboard or gertuino, I am just using the gpio to program AVRs using a modified version avrdude. I have tried defining ISP_PORT=gpio in makefile same result but with "gpio" in the error message (output in original post), What I can't get my head around is if I can upload using avrdude by not specifying a port why does MK fail when I do not specify a port? what is different? It has taken some time to get this far and it is as clear but a bit of background. I have multiple avrs (currently 3 maybe more in the future) connected to a Raspberry Pi and i want to access them totally remotely ie no swapping leads or pluging in programmers etc. having done a little research I would of prefered use proper spi rather than bitbanging but as far as I can make out only one person has done this https://github.com/kcuzner/avrdude and this method is is not as straightforward and has no installation package as yet, I believe it may be included in avrdude in the future http://savannah.nongnu.org/patch/?8228, I also believe this method is restricted to 2 AVRs on a RPi unless an additional controller is used to increase the ss lines, all this is beyond me so here I am with the gpio solution and as much as I dislike the principle (based only on occasional expert comments) it seems to work and is somewhat more documented than spi, although still sparse. A linuxgpio programmer has also been included in avrdude 6 but that has not reached stable status at debian yet and due to other dependencies to avoid a messy(er) install I would need to upgrade wheezy to jessie and risk non-stable software. So that's the story so far in a nutshell. So what I have works to a fashion but it requires tidying up and streamlining.
@sudar, I have checked thoroughly for another avrdude and can find no evidence of that. which avrdude only returns the one i am using. I have since manually specified all paths and locations via makefile to eliminate that possibility.
So looking closer at aurduino-mk I found these lines which to me where unclear but I could tell this was the wall I was hitting
# Returns the ISP port (first wildcard expansion) if it exists, otherwise it errors.
get_isp_port = $(if $(wildcard $(ISP_PORT)),$(firstword $(wildcard $(ISP_PORT))),$(error ISP port $(ISP_PORT) not found!))
so I decided to try a port i knew existed to see what effect it had so I added ISP_PORT = /dev/ttyAMA0 because this exists but is not physically connected to anything and hey presto! It didn't fail at the usual port not found hurdle but went on to programme the avr
AVR Memory Usage
----------------
Device: atmega328p
Program: 1158 bytes (3.5% Full)
(.text + .data + .bootloader)
Data: 11 bytes (0.5% Full)
(.data + .bss + .noinit)
/usr/bin/avrdude -q -V -D -p atmega328p -C /etc/avrdude.conf -c ep_isp2 -b 57600 -P /dev/ttyAMA0 \
-U flash:w:build-ep_isp/Blink3.hex:i
avrdude: AVR device initialized and ready to accept instructions
avrdude: Device signature = 0x1e950f
avrdude: reading input file "build-ep_isp/Blink3.hex"
avrdude: writing flash (1158 bytes):
avrdude: 1158 bytes of flash written
avrdude: safemode: Fuses OK
avrdude done. Thank you.
This suggested all was well! but unfortunately the blink sketch was not running on the avr so all was not well. not only had it not loaded but it had stopped the previously running sketch and was now lifeless. so I tried and successfully loaded the the same hex file to the same avr using this string from the command-line
avrdude -U flash:w:build-ep_isp/Blink3.hex:i -D -p atmega328p -c ep_isp2
comparing this string with the one MK compiled, I worked through the differences 1 by 1 and found the only differences were made by the -q -V -D switches, although removing neither -q or -V resulted in a succesful upload removing -D does!
Adding -D to my own command line string also fails if not over writing with the exact same code, likewise make upload also works if overwriting with the same sketch but lock the avr up if sketch is different.
Since commenting out the AVRDUDE_OPTS = -q -V -D line in aruino-mk I can now successfully make upload.
Apologies for the long long posts but just to summarize 1) avr tools and avrdude locations were all over the place but that may well be due to overwriting the official 5.11 version with a modified 5.10 version. 2) a ISP_PORT MUST be nominated even though it isn't used 3) -D option results in a corrupted AVR
Whilst I can't be sure whether these problems are unique to my application or set-up, Should you want further info I can produce the problems at will now.
I'd also like to add despite the battle to resolve these issues I think MK is great, it's a very versatile and capable tool. Many Thanks Paul
What I can't get my head around is if I can upload using avrdude by not specifying a port why does MK fail when I do not specify a port? what is different?
perhaps the modified avrdude defaults to gpio as its port, whereas the regular one defaults to null. it has to have some sort of workaround for it not being a real device, so i suspect that's the case, i'd have to look at gordon's patches to check.
you can specify AVRDUDE_OPTS=-v to get rid of the qVD options in your Makefile, you don't need to edit Arduino.mk, i found that i need to remove -D if i'm not burning a bootloader and am just programming the 328p directly, which is what the gertuino avrsetup script is doing - it just sets fuses, without an arduino bootloader - i suspect a gertuino-programmed 328p wouldn't work if plugged into an uno for example.
ISP_PORT doesn't need to be specified if you're using a real hardware isp like usbasp or usbtiny, the gpio method with modified avrdude is a software ISP like ArduinoISP, which does require a port to be specified, you'd also need ISP_PROG=gpio. i guess because its using sysfs and not an actual device, setting a non-existant port just works around it!
could you try a Makefile such as:
BOARD_TAG=ep_isp
ISP_PROG=gpio
ISP_PORT=/dev/ttyACM0
AVRDUDE_OPTS=-v
include /usr/share/arduino/Arduino.mk
if that works, we can probably change line 1078 to include "gpio" in the list of hardware programmers, even though it isn't really, so that it doesn't require an ISP_PORT, like:
ifneq ($(strip $(ISP_PROG)),$(filter $(ISP_PROG), usbasp usbtiny gpio))
AVRDUDE_ISP_OPTS += -P $(call get_isp_port)
endif
i'm not sure what you're doing with the ep_isp thing, is that a custom programmer you've defined perhaps? i'm not entirely sure we parse programmers.txt
Tried the AVR_OPTS =-v that cancels the qVD options ok,
The "ep_isp" is just a ref I'm using for my custom board and programmers currently I have 3 programmers in #./.avrduderc ep_isp1, 2 & 3 these are copies of the gpio programmer profile but with different reset pins (could just as easily been gpio12&3). These 3 programmers have matching entries in aurduinos programmers.txt so that they are accessible via Tools > Programmer in IDE and I have since added a board type ep_isp profile in boards.txt for MK to use. (no MK doesn't use the programmers.txt)
Now that I'm aware, I am ok with leaving the bogus ISP_PORT setting in makefile if needed. Although adding gpio to line 1078 would help if someone is using the single default gpio programmer but as I am using 3 gpio programmers each one would need to be listed or maybe extenting "gpio" with a wildcard character would work. (fyi I tried adding "ep_isp2" to line 1078 and it worked ok without naming a port).
What I need to tackle now is accessing the 3 programmers easily. ie from the command-line I put the -p programmer at the end of the avrdude command string and when it completes the first upload I just change the last character of the command-line string and program the second then third, its a small niggle but using MK involves changing the makefile inbetween uploads, maybe a small script to automate by overwriting makefile from templates makefile 1,2 or3. anyways...... Thanks again for the help Paul
ah - we don't parse programmers.txt as that's for avrdude not arduino as such, you can't have a local copy in your ~/sketchbook/hardware directory.
in the short-term, adding gpio to line 1078 as you say, does solve the issue of having to define a fake ISP_PORT for people who are just using one regular gpio programmer. you couldn't use a wildcard.
maybe long-term we need to change get_isp_port() to only add the -P if it succeeds in finding the variable and the device, and just warn instead of error. so you'd define ISP_PORT and ISP_PROG and it would only add -P device if that path existed. if you didn't specify ISP_PORT it would assume you don't need one and not add -P blank
maybe long-term we need to change get_isp_port() to only add the -P if it succeeds in finding the variable and the device, and just warn instead of error. so you'd define ISP_PORT and ISP_PROG and it would only add -P device if that path existed. if you didn't specify ISP_PORT it would assume you don't need one and not add -P blank
Created issue #167 to track this.
When using a direct connection between Raspberry Pi gpio and AVR I am unable to "ispload" sketches to AVR. the following error message is given.
Instructions in arduino-mk state ISP_PORT is not needed for hardware ISP's and arduino-mk-vars.md states this variable is optional. but it seems a default null value is being used along with the -C option flag. If a value is given in the Makefile this is also included in an error message eg ISP_PORT = gpio results in
ArduinoIDE compiles and uploads no problem and Arduino-Makefile compiles ok. the .hex file compiled by make can be successfully uploaded by moving into the folder created by make and manually running the command "avrdude -p atmega328p -c gpio flash:w:mysketch.hex. I have extensively checked all paths and settings and tried to find the source of the problem but I am not a programmer and may well of overlooked something. The custom programmer and board settings in Aurduino and avrdude.conf do work independently. I'm using recent build of MK from git rather than the older debian package and a modified avrdude which can be found at https://projects.drogon.net/raspberry-pi/gertboard/arduino-ide-installation-isp/. Many thanks Paul