Forum Index > Projects > LED Pegboard and Matrix Projects
 Programmer connection?
 |  Printable Version
By: bbum (offline) on Sunday, February 17 2008 @ 10:42 AM PST (Read 24736 times)  
bbum

I picked up one of the USBTinyISP programmers from Lady Ada and I *think* I have put it together correctly (their instructions are not so nice as Peggy's).

I added a 6 pin header to the Peggy board and have attached the programmer.

So far, no smoke. But no programming joy, either.

avrdude reports:

avrdude -n -p m164p -c usbtiny -P usb -v -v -v \
-U lfuse:w:0xE2:m \
-U hfuse:w:0xD9:m \
-U efuse:w:0xff:m \
-U flash:w:peggy.hex

...................

Description : USBtiny simple USB programmer, http://www.ladyada.net/make/usbtinyisp/
avrdude: programmer operation not supported

avrdude: Using SCK period of 10 usec
CMD: [ac 53 00 00] [00 00 00 00]
CMD: [ac 53 00 00] [00 00 00 00]
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.

Boo.


Forum Henchperson
Henchperson

Status: offline

Registered: 01/23/08
Posts: 22

Profile Email    
   
By: bbum (offline) on Sunday, February 17 2008 @ 10:45 AM PST  
bbum

OK -- figured out how to do simple diagnostics with avrdude.

[aalbbum:~/bbum-developer-personal/avr/peggy1_0] bbum% avrdude -c usbtiny -p m164p

avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.

The Peggy board is on and blinks when I execute the above.


Forum Henchperson
Henchperson

Status: offline

Registered: 01/23/08
Posts: 22

Profile Email    
   
By: Windell (offline) on Sunday, February 17 2008 @ 01:24 PM PST  
Windell

First, let's assume that all the solder joints on the programmer are good-- a bad one here or there could cause the problem that you're seeing, but you've probably been careful, put the chip in the right way, and all that. It also sounds like you've managed to make the correct updates to the makefile, which (for everyone else reading this) should have the following settings for use with LadyAda's programmer: PROGRAMMER = usbtiny PORT = usb MCU_TARGET = atmega164p AVRDUDE_TARGET = m164p Next, we need to make sure that the software setup is up to date. Start here. (On the Mac, you'll need to replace the file "avrdude.conf" in /usr/local/etc and "avrdude" in /usr/local/bin with patched binaries, or on Windows, you'll need to download a modified LibUSB driver.) Next, we need to make sure that the power supply connections are correct. The usbtiny programmer can provide power to a target board, if it doesn't require much power. Peggy can potentially draw quite a bit of power at startup, so we need to have it (her?) independently powered during programming. Step 1: Turn on power to the peggy board-- the LEDs should be on. Step 2: Remove the jumper on the programmer that provides power to the target board-- it's the little jumper by the 6 and 10 pin cables. Step 3: Attach the 6-pin cable to the Peggy, matching the red stripe of the cable to the end of the connector with the arrow. Step 4: Connect the USB cable to your computer, and try to program it. (Also note: If everything was working and stops working at some point, it can sometimes help to unplug the USB cable and plug it back in again-- I think that the USB port can be shut off if it spikes at too much power.) Good luck, and let us know how it goes!


Windell H. Oskay
drwho(at)evilmadscientist.com
http://www.evilmadscientist.com/

Forum Evil Scientist
Evil Scientist

Status: offline

Registered: 06/15/06
Posts: 1932
Sunnyvale, CA

Profile Email Website  
   
By: bbum (offline) on Sunday, February 17 2008 @ 02:01 PM PST  
bbum

Huh -- still no go.

If I plug in the programmer without having it connected to the USB port of the computer, the Peggy will not light up.

Once connected to USB, the off/reset buttons behave correctly.

I checked the solder joints -- none look cold.

At least there is no smoke.... Smile


Forum Henchperson
Henchperson

Status: offline

Registered: 01/23/08
Posts: 22

Profile Email    
   
By: bbum (offline) on Sunday, February 17 2008 @ 02:18 PM PST  
bbum

AHA! It appears that I have a bad 10 pin to 10 pin cable. Or the presence of the 10 pin - 10 pin cable with nothing at the other end screws up the connection. Once I cracked open the programmer and removed the 10-10 cable, things started to work moreso than before.

In any case, I now have a viable connection. Sort of.

I did a 'make install'.

(1) LED Rows 16, 17, and 18 flashes during communication. Is that normal?

(2) The chip fails to verify and, because it was erased during programming, I'm left with a very dark Mooninite.

.....
:2005600085B80E94640012B811B90E94640011B814B815B8F2B8F1B81BB80AB90E9464004D
:1A0580001AB818B807B90E94640017B815B804B90E94640014B81ACEFFCF18
:00000001FF
avrdude: 1434 bytes of flash written
avrdude: verifying flash memory against peggy.hex:
avrdude: load data flash data from input file peggy.hex:
avrdude: input file peggy.hex auto detected as Intel Hex
avrdude: input file peggy.hex contains 1434 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.75s



avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0000
0x0c != 0xff
avrdude: verification error; content mismatch


Forum Henchperson
Henchperson

Status: offline

Registered: 01/23/08
Posts: 22

Profile Email    
   
By: bbum (offline) on Sunday, February 17 2008 @ 02:27 PM PST  
bbum

Fixed. All better now. I still don't know why the 10pin-10pin cable was problematic.

At one point, I had modified the makefile to add the '-n' flag to the command line of avrdude, thinking that doing so would prevent me from blasting down some bad code while screwing around with this stuff.

Boy howdy is that wrong.

OK -- that was dumb. Removed. Fixed. Everything works. PEBKAC or JEBKAC [jackass exists between keyboard and chair].

As it turns out, avrdude will quite happily send the chip and 'erase' command even in the presence of the '-n' option.

It'll then pretend to upload the new firmware, then it'll download the written firmware for verification purposes and fail miserably because it downloaded nothing but 0xFFs.

Boo.

All better, though.

Yay.


Forum Henchperson
Henchperson

Status: offline

Registered: 01/23/08
Posts: 22

Profile Email    
   
By: Windell (offline) on Sunday, February 17 2008 @ 03:04 PM PST  
Windell

Quote by: bbum

AHA! It appears that I have a bad 10 pin to 10 pin cable. Or the presence of the 10 pin - 10 pin cable with nothing at the other end screws up the connection. Once I cracked open the programmer and removed the 10-10 cable, things started to work moreso than before.

That does indeed sound like a step in the right direction.

(1) LED Rows 16, 17, and 18 flashes during communication. Is that normal?[/p]

Yes, that's exactly what you should be seeing-- As the data is being written it also drives the transistors to turn on those rows.

(2) The chip fails to verify and, because it was erased during programming, I'm left with a very dark Mooninite.[/p]

This is much more troubling. The "right kind" of failure during programming can change the fuse values to something undesirable and effectively brick the chip. The most important thing to keep in mind is that you *must not* carelessly pick your fuse values. But... looks like you've fixed the error, eh? I hadn't ever noticed the '-n' option before-- yes, if you add it you won't be able to actually write the firmware. (That option is documented here, in case anyone is wondering.)


Windell H. Oskay
drwho(at)evilmadscientist.com
http://www.evilmadscientist.com/

Forum Evil Scientist
Evil Scientist

Status: offline

Registered: 06/15/06
Posts: 1932
Sunnyvale, CA

Profile Email Website  
   
By: bbum (offline) on Sunday, February 17 2008 @ 04:02 PM PST  
bbum

Yup -- the disturbing part is that -n is documented as "No-write - disables actually writing data to the MCU", yet avrdude quite happily erases the chip prior to no-writing the new firmware.

I saw the bit about bricking the chip when mucking with the fuse values. As a result, I didn't touch the fuse values. Smile

b.bum


Forum Henchperson
Henchperson

Status: offline

Registered: 01/23/08
Posts: 22

Profile Email    
   
By: bbum (offline) on Sunday, February 17 2008 @ 09:35 PM PST  
bbum

OK -- not quite done with this saga yet.

ONE of my Peggy boards allows in-board programming of the chip.

The other board does not; exhibiting the symptoms as originally described above (it can't sync!)

Now, I *know* it isn't the programmer or, at the least, the programmer + the one board.

I reflowed a bunch of solder joints and generally inspected for badness. Nothing to be found.

It "feels" like something is right on the verge of not working due to power usage constraints or something? Maybe the LED layout on the one board puts a handful more LEDs on the rows that blink and that prevents successful programming?

Totally grasping at straws, I know.


Forum Henchperson
Henchperson

Status: offline

Registered: 01/23/08
Posts: 22

Profile Email    
   
By: Windell (offline) on Monday, February 18 2008 @ 12:19 AM PST  
Windell

>ONE of my Peggy boards allows in-board programming of the chip.

Oh boy... that sounds like an insidious challenge if I've ever heard one. Wink

>Maybe the LED layout on the one board puts a handful more LEDs on the rows that blink and that prevents successful programming?

No... that's not an issue. The LEDs are all driven through the transistors. Exactly the same amount of current is drawn from the chip, no matter how many LEDs are in each row. The 1 k resistor should limit each row to less than 5 mA per row.

So... you know that your software setup is good, and that your programmer works well. Again, double check that the power connections are correct and try disconnecting and reconnecting the USB cable.

First test: try swapping out the chips, if you need to convince yourself that both chips are okay, you can test each on the other board.

Second, if you have a multimeter: Check to see that there is a good connection between each of the important (for programming) pins of the microcontroller and the ISP connector. The relevant pins are labeled (by the chip) MISO, MOSI, SCK, RESET and GND. Measure the resistance from the "shoulders" of a pin of the chip to (first) the labeled hole on the left side of the chip, and then see if that corresponds to a pin on the 6-pin header.

Otherwise, please try to exactly describe the error that you're seeing and I'll try to help.


Windell H. Oskay
drwho(at)evilmadscientist.com
http://www.evilmadscientist.com/

Forum Evil Scientist
Evil Scientist

Status: offline

Registered: 06/15/06
Posts: 1932
Sunnyvale, CA

Profile Email Website  
   
By: bbum (offline) on Monday, February 18 2008 @ 12:32 AM PST  
bbum

Both chips work -- I swapped chips and now successfully have two zany animation boards.

So, gotta be some bad connection or trace or short or something. I reflowed a bunch of solder joints to no avail.

The error is the same as I first encountered. As a matter of fact, I'm betting that the 10pin to 10pin cable is just fine and that I happened to switch between the two boards around the time I removed said cable.

I'll poke at it with the multimeter tomorrow.


Forum Henchperson
Henchperson

Status: offline

Registered: 01/23/08
Posts: 22

Profile Email    
   
By: bbum (offline) on Monday, February 18 2008 @ 10:54 PM PST  
bbum

OK -- it has got to be the damned programmer.

(1) cannot program either board in the presence of the 10 pin cable

(2) can only program one board with the 6 pin cable only

(3) All connections on the Peggy checked. Everything is fine. Nothing is shorted.

(4) Swapping chips between the two boards makes no difference; the same board still works, the same board still does not (so, at the least, I have both boards animated).

Serious voodoo here. Ben is headed over with this USBTiny board to see if it "just works".


Forum Henchperson
Henchperson

Status: offline

Registered: 01/23/08
Posts: 22

Profile Email    
   
By: bbum (offline) on Monday, February 18 2008 @ 11:08 PM PST  
bbum

Head explode.

Ben brought over his programmer. Exhibits the exact same behavior with the additional spookiness that his worked briefly on the one board with the 10pin to10pin cable present, but then it stopped.


Forum Henchperson
Henchperson

Status: offline

Registered: 01/23/08
Posts: 22

Profile Email    
   
By: bbum (offline) on Monday, February 18 2008 @ 11:36 PM PST  
bbum

To expand upon this:

- does not matter if we use batteries or a bench supply

- doesn't matter which programmer we use

- doesn't matter what mode the board is in

This really feels like the LEDs between the two boards is the only difference. At least, neither of us can think of another reason for this rather voodoo-esque behavior!


Forum Henchperson
Henchperson

Status: offline

Registered: 01/23/08
Posts: 22

Profile Email    
   
By: Windell (offline) on Monday, February 18 2008 @ 11:45 PM PST  
Windell

The 10-pin cable issue would seem to suggest that there's something deeper wrong there.
Now, I have never seen this issue that you're describing, so it's a little hard for me to be exactly sure what the problem is.

Can you please describe exactly what error you are getting when trying to program it?


Windell H. Oskay
drwho(at)evilmadscientist.com
http://www.evilmadscientist.com/

Forum Evil Scientist
Evil Scientist

Status: offline

Registered: 06/15/06
Posts: 1932
Sunnyvale, CA

Profile Email Website  
   



 All times are PDT. The time is now 06:50 PM.
Normal Topic Normal Topic
Locked Topic Locked Topic
Sticky Topic Sticky Topic
New Post New Post
Sticky Topic W/ New Post Sticky Topic W/ New Post
Locked Topic W/ New Post Locked Topic W/ New Post
View Anonymous Posts 
Able to Post 
Filtered HTML Allowed 
Censored Content 

Evil Mad Scientist Forum Archives — Read only!

Please visit our new forums for new discussions.


DIY Hardware for Electronic Art


The Original Egg-Bot Kit


Octolively
Interactive LED kits


Meggy Jr RGB
LED matrix game
development kit.


Business-card sized
AVR target boards


Peggy 2
LED Pegboard kits

My Account






Lost your password?