avrdude running on Pi does not work

Go To Last Post
5 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello experts,
I connected an ATmega328p to my Raspberry and tried to program it.

Directly connected using Raspberry pins GND, 3.3V, 9,10,11 and 22 for Reset.

What works:

avrdude -p m328p -c linuxspi –b 14400 -P /dev/spidev0.0
Shows ATmega and fails correctly when I remove one of the wires.
The ATmega itself works perfectly, I can program it from Windows via an Arduino without problems.

avrdude -p m328p -c linuxgpio –b 14400 -t
In terminal mode of avrdude I can read complete flash memory manually.

 

Setting fuse bits also seems to work, at least I can see some effects (stopped it, as I am no expert).

 

Problem: Nothing happens when using the -U command to access flash memory with a file.

avrdude -p m328p -c linuxspi –b 14400 -P /dev/spidev0.0 –U flash:r:test.hex

No file is read and when writing it even does not complain in case the file does not exist.

Happens with apt-get installed 6.3 avrdude and manually compiled 6.2 version.
Does not work with -c linuxgpio or when playing with the baudrate.

There is no error message, all I get is :
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e950f (probably m328p)

avrdude: safemode: Fuses OK (E:FD, H:DA, L:E2)

avrdude done. Thank you.

Any advice how to proceed?
Thanks,
Felix

 

P.S. I also posted the question in raspberrypi org forum.

Last Edited: Wed. Feb 5, 2020 - 03:38 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The fact that it reads the signature and the fuses proves (like Arduino) that everything is working OK so it must be something in the actual syntax you are using.

 

Could it be that you simply aren't allowed to write files to the current directory where you issue the avrdude command from perhaps? Just try "touch test.txt" and see if that is created OK.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I work as root and downloaded some hex files from my windows arduino IDE to the directory, that worked. 

Anyway I would expect avrdude to complain when I try to flash non-existing files or write into locked files/directories or having communication problems. 

Instead it just says "ok" and "thank you". 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

fhwe wrote:
I work as root
Oof - that is NOT the way Linux is designed to be used. All kinds of dire things can happen. But, yeah, it should allow you to create files in most places.

 

Sorry, I personally am out of ideas for you then. Hopefully someone else might have a clue.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Finally it works!

I installed version 6.1 from Kevin Cuzner and that works perfectly.
I followed that instruction: https://www.mikrocontroller.net/article ... programmer which is a guided walk through http://kevincuzner.com/2013/05/27/raspb ... rogrammer/.

In the first attempt I followed https://ozzmaker.com/program-avr-using- ... y-pi-gpio/, not considering it is about 6.2 and not 6.3 (which is rated as not working by a comment). Still playing around with them fails. 

So I stay which 6.1 and am happy. I found one patch (https://www.mikrocontroller.net/topic/356707#3985870) which I will try when playing with crystals.

Still one strange thing: when toggling from linuxspi to linuxgpio it seems, linuxgpio blocks the ports. I cannot flash afterwards and need to reboot to flash. Any advice about how to unlock the ports?