Go Down

Topic: Unable to use USBtinyISP on a bread board ATMega328p set-up (Read 10596 times) previous topic - next topic

1studio1

Hi all,

I am at my wits end here... This is the set up.

I have been following this http://arduino.cc/en/Main/Standalone and other set-ups. but for speed here is what we have:

New ATMega328p MC on a breadboard.
PIN 1 to RST (also tried with and without the following in various combinations:  Pull-up res 10k and .1uf cap via GND tactile switch
Pin 7 to VCC
Pin 8 to GND
Pins 9 and 10 of the MC connected across 16mhz xtal and 2 x 22 caps which then go to GND.
Pin 17 to MOSI
pin 18 to MISO
Pin 19 to SCK
Pin 20 to VCC
Pin 21 to VCC
Pin 22 to GND
Other end of the comms wires go to a ISP breakout (tried it with out break out as well)
USBtinyISP plugged into USB port.

Now here is odd bit.

If I plug the USBtinyISP into my Uno R3 and select Upload via programmer from the file menu of IDE 1.0.5-r2 it works. (blink sketch)
if I plug the USBtinyISP into my Uno R3 and select Tools > board > Uno then Programmer USBTinyISP then Burn Bootloader. It works.

But I'll be darned if I can get ether feature to work on the breadboard version even with a FTDI usb port powering it + TX/RX and the USBtinyISP power (J3) jumper disconnected.

I just keep getting
Code: [Select]
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.


So I tried it via Windows avrdude: -c usbtiny -p M328p still no joy but again if it's on the uno board it works.

I have checked the continuity of the wiring and even soldered one up on a strip board with a DIL socket still the same no wanna play.

This all started because I had this issue with some brand new ATMega644P and PA's that I am building into a prototype that needs more pins than the 328P offers and as I could not communicate with those I figured on Keeping it simple and using tech I already used in the past. I have built lots of stuff using the standalone 328p's in the past but never used an ISP programmer before.

Anyone got any ideas??? cos I am losing the plot, only been at this for like two days - I have read so many web pages on the subject now it's all becoming a haze of MOSI MISO :)

Would be very grateful if someone can help me out with this one as I am obviously missing something and being daft.

All the best Steve


retrolefty

My first guess:

Fuse bytes not setup to use external crystal clock. Plug new 328p chip into your Uno board and perform a burn bootloader operation on it. Then you should be able to remove the new chip into your breadboard and be good to go.

Second guess:

Be sure the two crystal caps are 22 pf and not ufds

Good luck and hang in there

Lefty

MichaelMeissner

I recall reading in the past that USBtinyISP had some problems in uploading to ATMega328p's due to the ATMega328p's having more memory than USBtinyISP was prepared to deal with.  I did a quick google search and found: http://www.desert-home.com/2012/05/arduino-mega2560-wrapping-up-bootloader.html.

Nick Gammon also had this to say: http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=11357.

retrolefty


I recall reading in the past that USBtinyISP had some problems in uploading to ATMega328p's due to the ATMega328p's having more memory than USBtinyISP was prepared to deal with.  I did a quick google search and found: http://www.desert-home.com/2012/05/arduino-mega2560-wrapping-up-bootloader.html.

Nick Gammon also had this to say: http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=11357.


I've owned a USBtiny for several years (4?). I've never had any problems programming 328P chips, 644P chips, 1280 chips, and 1284p chips. I do get a verify error when burning bootloader to the my 1280 boards, however the write is correct and it works both burning the bootloader and sketches. Where there is problems with the USBtiny is with the mega2560 chip in that the USBtiny apparently can't work in the protocol needed for chips with flash sizes greater then 128K bytes which the mega2560 has. My only complaint with the USBtiny programmer is how slow it is to write bootloaders to the larger flash chips, 1280, 644, it's like watching paint dry.  :D

If I was starting out today with arduino projects I wouldn't bother with getting a USBtiny but just rather buy a cheap Asian nano board and load it with the arduinoISP sketch and make a custom 6 pin ribbon cable/connector. I've used the arduinoISP programmer and it saw no problems with it. However I can't say first hand about programming the current mega 2560 as I don't own one.


Lefty

JChristensen


Where there is problems with the USBtiny is with the mega2560 chip in that the USBtiny apparently can't work in the protocol needed for chips with flash sizes greater then 128K bytes which the mega2560 has.


Adafruit says USBtinyISP cannot program chips with more than 64K of flash. I'm getting ready to start on a 1284p project, and I was assuming my USBtinyISP wouldn't work.

retrolefty



Where there is problems with the USBtiny is with the mega2560 chip in that the USBtiny apparently can't work in the protocol needed for chips with flash sizes greater then 128K bytes which the mega2560 has.


Adafruit says USBtinyISP cannot program chips with more than 64K of flash. I'm getting ready to start on a 1284p project, and I was assuming my USBtinyISP wouldn't work.


Yea but keep in mind the difference in AVR flash word size (2 bytes) and flash size given in page one datasheet in bytes. The mega1284p 128kb (64k words) is reachable from the USBtiny, I've done it many times. The mega2560, 256KB (128K words) is not.



JChristensen




Where there is problems with the USBtiny is with the mega2560 chip in that the USBtiny apparently can't work in the protocol needed for chips with flash sizes greater then 128K bytes which the mega2560 has.


Adafruit says USBtinyISP cannot program chips with more than 64K of flash. I'm getting ready to start on a 1284p project, and I was assuming my USBtinyISP wouldn't work.


Yea but keep in mind the difference in AVR flash word size (2 bytes) and flash size given in page one datasheet in bytes. The mega1284p 128kb (64k words) is reachable from the USBtiny, I've done it many times. The mega2560, 256KB (128K words) is not.


Ohhhh. They didn't say so I assumed bytes. Well I'll give it a try then. You get some error messages though?

retrolefty





Where there is problems with the USBtiny is with the mega2560 chip in that the USBtiny apparently can't work in the protocol needed for chips with flash sizes greater then 128K bytes which the mega2560 has.


Adafruit says USBtinyISP cannot program chips with more than 64K of flash. I'm getting ready to start on a 1284p project, and I was assuming my USBtinyISP wouldn't work.


Yea but keep in mind the difference in AVR flash word size (2 bytes) and flash size given in page one datasheet in bytes. The mega1284p 128kb (64k words) is reachable from the USBtiny, I've done it many times. The mega2560, 256KB (128K words) is not.


Ohhhh. They didn't say so I assumed bytes. Well I'll give it a try then. You get some error messages though?


No, not that I recall. Was able to both burn the bootloader and upload sketch using programmer.

raschemmel

I have never used a USBTinyISP  but I can tell you I breadboarded that same ATmega328 circuit with a $3 chip from DIPMICRO that came with the OPTIBOOT bootloader and all I had to do was plug my FTDI BASIC into it and I was running sketches in 5 minutes.
  http://www.dipmicro.com/store/CPU-ARD328P
I have a 16 Mhz crytal and two 18pf caps and a push button for reset. Everything worked perfectly from the start.have a
TLC5940 with 16 leds running the Knight Ryderback and forth  led sequencer.
Arduino UNOs, Pro-Minis, ATMega328, ATtiny85, LCDs, MCP4162, keypads,<br />DS18B20s,74c922,nRF24L01, RS232, SD card, RC fixed wing, quadcopter

1studio1

#9
Apr 17, 2014, 11:59 am Last Edit: Apr 17, 2014, 01:13 pm by 1studio1 Reason: 1
Thanks for your reply Lefty,
Quote
My first guess:

Fuse bytes not setup to use external crystal clock. Plug new 328p chip into your Uno board and perform a burn bootloader operation on it. Then you should be able to remove the new chip into your breadboard and be good to go.


Umm. well I thought that was the answer so I double tried this:  
Put the 328p into the chip socket on the UNO board and connected the USBTinyISP, burnt bootloader ok, loaded a sketch ok. Moved the 328p and USBTinyISP to the breadboard, load sketch - fails, burn bootloader - fails.

Set the sketch to blink LEDs on digital Pins 6 and 7 (chip 12 and 13) and put 328p and USBTinyISP  back on Uno, loaded sketch via USBtinyISP and made sure it worked. reconnect USBTinyISP and 328p back on breadboard and ran sketch both LEDs blink ok...  tried writing sketch - failed, tried burning bootloader and again, as expected it failed.

Quote

Second guess:

Be sure the two crystal caps are 22 pf and not ufds

Double checked the caps are 22pf which they are - (its actually one of three sets I've tried that come as a pair of caps and xtal for these chips.)
Quote

Good luck and hang in there

Lefty

Thanks for the words of encouragement Lefty - feeling really deflated.

Just for clarification; I can upload to any 328p on the breadboard I have tried via my Breakout Board for FT232RL USB to Serial mounted on the breadboard (that is to say 328p on breadboard connected to the PC via the 232RL)  http://www.hobbytronics.co.uk/prototyping/proto-breakout-boards/ft232rl-breakout

I had read the comment about not being able to burn using USBtinyISP to flash sizes larger than 64 and thought that was the problem with the 644p and 644PA which is why I went back to basics with the 328p only to find I had the same issues.

This is so driving mad. but thank you all so much for your comments.

all the best

Steve (about to throw the whole lot in the trash/bin) :(

JChristensen


Steve (about to throw the whole lot in the trash/bin) :(


It must be something simple, don't give up, we do this all the time. How about a picture?

1studio1

Hi Jack,

Thanks for your comments.

As requested here is a schematic. I just created this by following the wiring on my breadboard... not from how I think it is meant to be - haven't even checked it to what it should be it is a direct copy - I figured that a photo of the board might look too confusing with wires everywhere - plus I am not sure where my point and shoot camera is. if I find it I'll post this and a photo again.

I can upload via a USB break out to the three chips I have tried.

All the best Steve

JChristensen

Switch MISO and MOSI.
JP1 pin 1 to IC1 pin 18.
JP1 pin 4 to IC1 pin 17.

1studio1

Hi Jack,

Well that's very strange - changed them round and it failed exactly the same - plugged them back in as per my metered connections on the UNO board and then it worked. but I swear I buzzed the continuity through all leads and it passed, so was there some slight resistance on a lead maybe - but my Fluke 79 mk3 should have detected that on continuity setting surely

So I have now been able to:
Burn boodloader via ISP,
uploaded a sketch via ISP
then tested there was no bootloader (usb upload fail)
then reburnt bootloader via ISP
and USB uploaded

Cmd prompt AVRdude also works

Very odd! it even works on my stripboard prototype with jumpers (it is meant to have a 644 in it.)

So anyone got any ideas how to burn / upload to a ATMega644P and as the P is obsolete the ATMega644PA (its replacement), tips, tricks ??? coz that's what started this whole horror story for me. I was getting the dreaded avrdude: stk500_getsync(): not in sync: error suggesting possibly no bootloader and am I right that the USBtinyISP won't work with these chips? So how do I do it?

All the best
Steve


retrolefty

#14
Apr 17, 2014, 05:33 pm Last Edit: Apr 17, 2014, 05:38 pm by retrolefty Reason: 1
Quote

So I have now been able to:
Burn boodloader via ISP,
uploaded a sketch via ISP
then tested there was no bootloader (usb upload fail)
then reburnt bootloader via ISP
and USB uploaded


When you upload a sketch via ISP (upload sketch using programmer IDE option) it erases the flash completely from the target chip before the sketch upload thus erasing the bootloader, that is normal behavior. If you want to keep the bootloader in the flash you must not later upload via ISP, only normal IDE uploading using USB serial.

I've used my USBtiny to program a 644P with no problems. Not sure if the 644PA uses different signature bytes then a P (check the AVR datasheet to answer that) but if so the AVRDUDE error would be complaining about signature bytes being wrong, not the error you are seeing? I think you are just erasing the bootloader when performing a ISP upload.



Go Up