Go Down

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

raschemmel

Arduino UNOs, Pro-Minis, ATMega328, ATtiny85, LCDs, MCP4162, keypads,<br />DS18B20s,74c922,nRF24L01, RS232, SD card, RC fixed wing, quadcopter

1studio1

#16
Apr 17, 2014, 05:49 pm Last Edit: Apr 17, 2014, 06:03 pm by 1studio1 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.


Yes, absolutely that was how I confirmed beyond doubt that the upload via programmer had worked - i.e it erased the bootloader - crude I know but works in my head :)

Quote

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?


Oh right - that's good news then :)  and contrary to Adafruits comment on their website so very pleased to hear that. Perhaps they are referring to an older version. I must admit I have not looked through the code but did wonder why it would not work as it's only copying a bootloader file from the hardware dir to the target MCU surely.

I think the PA uses the same signatures but need to find the details in the datasheet.

Can I ask what description files you used? (entry in boards.txt and files in hardware directory) I have found something called Sanguino, is it ???  (which seems to be an old product) and another set just called ATMega644 from another website. I would like to use proven technology here from forum members not stuff from some undocumented and random blog I have never heard of.

ATB Steve


retrolefty

Quote

Oh right - that's good news then smiley  and contrary to Adafruits comment on their website so very pleased to hear that. Perhaps they are referring to an older version. I must admit I have not looked through the code but did wonder why it would not work as it's only copying a bootloader file from the hardware dir to the target MCU surely.


The Adafruit comments were not wrong but rather confusion about flash size limit being 16 bit words not bytes. So using a USBtiny you can work with avr chips with up to 128KB (64K flash words) or less. That covers most all AVR mega chips except the mega2560 that has 256KB (128K flash words). That make sense?


1studio1

Quote
The Adafruit comments were not wrong but rather confusion about flash size limit being 16 bit words not bytes. So using a USBtiny you can work with avr chips with up to 128KB (64K flash words) or less. That covers most all AVR mega chips except the mega2560 that has 256KB (128K flash words). That make sense?


Arha ! got it!, that makes perfect sense now when you write it out - Yes I was being confused by that. TY.

Checked the signatures are the same on both MCUs 0x000, 0x0002, 0x0004, 0x0001 so that will be ok.

Which bootloader and board description to use is my next quest!

Ta very much for the clarifications - Steve

retrolefty

Quote

Which bootloader and board description to use is my next quest!


For the 644? If so I use opto version set up for 16mhz named  optiboot_atmega644p-4-5.hex, as it's the smallest and fastest baudrate, handles WDT interrupts properly, etc.

Code: [Select]

:020000000504F5
:10FC0000112484B714BE81FFF2D085E08093810077
:10FC100082E08093C00088E18093C10086E08093F9
:10FC2000C20080E18093C4008EE0CBD0209A86E0B1
:10FC300020E33CEF91E0309385002093840096BB55
:10FC4000B09BFECF189AA8958150A9F7CC24DD244B
:10FC500088248394B5E0AB2EA1E19A2EF3E0BF2E69
:10FC6000A4D0813471F4A1D0082FB1D0023811F49E
:10FC700085E005C0013811F484E001C083E08DD037
:10FC800089C0823411F484E103C0853419F485E01D
:10FC9000A6D080C0853579F488D0E82EFF2485D0A1
:10FCA000082F10E0102F00270E291F29000F111F09
:10FCB0008ED068016FC0863521F484E090D080E05A
:10FCC000DECF843609F040C070D06FD0082F6DD0E1
:10FCD00080E0C81680EED80618F4F601B7BEE895A5
:10FCE000C0E0D1E062D089930C17E1F7F0E0CF16C5
:10FCF000F0EEDF0618F0F601B7BEE89568D007B65B
:10FD000000FCFDCFA601A0E0B1E02C9130E01196FF
:10FD10008C91119790E0982F8827822B932B129625
:10FD2000FA010C0187BEE89511244E5F5F4FF2E0A7
:10FD3000A030BF0751F7F601A7BEE89507B600FC53
:10FD4000FDCF97BEE89526C08437B1F42ED02DD0D4
:10FD5000F82E2BD03CD0F601EF2C8F010F5F1F4FF8
:10FD600084911BD0EA94F801C1F70894C11CD11CFE
:10FD7000FA94CF0CD11C0EC0853739F428D08EE10F
:10FD80000CD086E90AD08AE07ACF813511F488E078
:10FD900018D01DD080E101D063CF982F8091C00092
:10FDA00085FFFCCF9093C60008958091C00087FF27
:10FDB000FCCF8091C00084FD01C0A8958091C60051
:10FDC0000895E0E6F0E098E1908380830895EDDF08
:10FDD000803219F088E0F5DFFFCF84E1DECF1F939A
:10FDE000182FE3DF1150E9F7F2DF1F91089580E04B
:08FDF000E8DFEE27FF2709946C
:040000030000FC00FD
:00000001FF



And from my boards.txt file:

Code: [Select]

##############################################################


bobuino644.name=Bobuino 644P optiboot
bobuino644.upload.protocol=arduino
bobuino644.upload.maximum_size=63488
bobuino644.upload.speed=115200
bobuino644.bootloader.low_fuses=0xff
bobuino644.bootloader.high_fuses=0xdc
bobuino644.bootloader.extended_fuses=0xfd
bobuino644.bootloader.path=optiboot
bobuino644.bootloader.file=optiboot_atmega644p-4-5.hex
bobuino644.bootloader.unlock_bits=0x3F
bobuino644.bootloader.lock_bits=0x0F
bobuino644.build.mcu=atmega644p
bobuino644.build.f_cpu=16000000L
#bobuino644.build.core=arduino:arduino
bobuino644.build.core=standard
bobuino644.build.variant=bobuino

##############################################################


But be aware that the bobuino uses a different pins_arduino.h file as he changes some of the pin layout to better match the standard shield layout.

1studio1

#20
Apr 17, 2014, 06:40 pm Last Edit: Apr 17, 2014, 06:44 pm by 1studio1 Reason: 1
Quote
For the 644? If so I use opto version set up for 16mhz named  optiboot_atmega644p-4-5.hex, as it's the smallest and fastest baudrate, handles WDT interrupts properly, etc.


Yes Sorry for the 644 :) cool thanks a lot for posting that. I'll give it a go.

Quote
But be aware that the bobuino uses a different pins_arduino.h file as he changes some of the pin layout to better match the standard shield layout.


Noted (well printed out) :)

Just burnt a bootloader to the ATMega644P using the Sanguino whatsit thingy via the ISP so thanks for giving me the confidence and indeed the  knowledge to try it. Also just uploaded via USB a test sketch to my prototype and all is well as it is working faultlessly. I did spot an error in that the rst pin must not be through the 0.1uf cap and my wire went the wrong side - stupid as when I did that wire I knew it had to bypass it so my excuse is that I was tired at the time... :)

I can't thank everyone enough for your help, confidence building and support through what was for me a very frustrating few days - your all fantastic and this is the best forum for this subject I have come across. VERY much appreciated!!!

Gonna try a 644PA next - fingers crossed!

All the very best

Steve

retrolefty

Your welcome. Keep in mind that the mega1284P chip has the same DIP pin-out as the 644P with a big increase in SRAM capacity of 16KB and other goodies. I have a optoboot for it also if you ever need it.

Lefty

raschemmel

Quote
Checked the signatures are the same on both MCUs 0x000, 0x0002, 0x0004, 0x0001 so that will be ok.

Where do you check this ? (how do you check it ?)
Arduino UNOs, Pro-Minis, ATMega328, ATtiny85, LCDs, MCP4162, keypads,<br />DS18B20s,74c922,nRF24L01, RS232, SD card, RC fixed wing, quadcopter

retrolefty


Quote
Checked the signatures are the same on both MCUs 0x000, 0x0002, 0x0004, 0x0001 so that will be ok.

Where do you check this ? (how do you check it ?)


They are given in the specific AVR datasheet for the chip. The AVRDUDE program used in the IDE has a config file of the signature bytes it's expecting to find when it interrogates the chip.



JChristensen


Your welcome. Keep in mind that the mega1284P chip has the same DIP pin-out as the 644P with a big increase in SRAM capacity of 16KB and other goodies. I have a optoboot for it also if you ever need it.


Yes, please!  (Is it different from maniacbug's?)

raschemmel

Quote
The AVRDUDE program used in the IDE has a config file of the signature bytes it's expecting to find when it interrogates the chip. 


config.txt ? (in Hardware folder ?)
Arduino UNOs, Pro-Minis, ATMega328, ATtiny85, LCDs, MCP4162, keypads,<br />DS18B20s,74c922,nRF24L01, RS232, SD card, RC fixed wing, quadcopter

1studio1


Quote
Checked the signatures are the same on both MCUs 0x000, 0x0002, 0x0004, 0x0001 so that will be ok.

Where do you check this ? (how do you check it ?)


If you pop over to Atmels web site and find the MCU your interested in, open the PDF (full not summary version) then click find and type "signature" it will take you to the relevant page / section.

HTH Steve

raschemmel

Arduino UNOs, Pro-Minis, ATMega328, ATtiny85, LCDs, MCP4162, keypads,<br />DS18B20s,74c922,nRF24L01, RS232, SD card, RC fixed wing, quadcopter

retrolefty


Quote
The AVRDUDE program used in the IDE has a config file of the signature bytes it's expecting to find when it interrogates the chip. 


config.txt ? (in Hardware folder ?)


Named avrdude.conf and buried somewhere in the arduino core directories.

retrolefty



Your welcome. Keep in mind that the mega1284P chip has the same DIP pin-out as the 644P with a big increase in SRAM capacity of 16KB and other goodies. I have a optoboot for it also if you ever need it.


Yes, please!  (Is it different from maniacbug's?)


I've seen two different bootloaders for the 1284P so not sure which is maniacbug's.

optiboot_atmega1284p

Quote

:020000000504F5
:020000021000EC
:10FC00000F92CDB7DEB7112484B714BE81FFF1D0B7
:10FC100085E08093810082E08093C00088E180933A
:10FC2000C10086E08093C20080E18093C4008EE032
:10FC3000CAD0209A26E080E39CEF31E090938500C3
:10FC40008093840036BBB09BFECF189AA8952150B4
:10FC5000A9F700E010E0EE24E394E1E1DE2EF3E00A
:10FC6000FF2EA5D0813471F4A2D08983B2D08981CE
:10FC7000823809F48BC0813811F484E001C083E03C
:10FC80008FD08BC0823411F484E103C0853419F421
:10FC900085E0A7D082C0853591F489D0A82EBB24F9
:10FCA00086D0082F10E0102F00270A291B29812F4A
:10FCB000881F8827881F8BBF000F111F6DC08635D6
:10FCC00021F484E08ED080E0DBCF843609F040C0A0
:10FCD0006ED06DD0C82E6BD080EE0030180718F4AF
:10FCE000F801F7BEE895A12C51E0B52E60D0F501E2
:10FCF00081935F01CE16D1F7F0EE00301F0718F0A8
:10FD0000F801F7BEE89565D007B600FCFDCFF80115
:10FD1000A0E0B1E02C9130E011968C91119790E029
:10FD2000982F8827822B932B12960C01E7BEE8951B
:10FD30001124329682E0A030B80761F785E0F8011F
:10FD400087BFE89507B600FCFDCFD7BEE89525C074
:10FD50008437A9F42CD02BD0B82E29D03AD0CB2C74
:10FD60004801F40186911CD00894811C911CCA940E
:10FD7000C1F70F5F1F4FBA940B0D111D0EC08537D1
:10FD800039F427D08EE10CD087E90AD085E078CF0E
:10FD9000813511F488E017D01CD080E101D061CF0B
:10FDA0009091C00095FFFCCF8093C600089580918C
:10FDB000C00087FFFCCF8091C00084FD01C0A895E2
:10FDC0008091C6000895E0E6F0E098E1908380839A
:10FDD0000895EDDF803219F088E0F5DFFFCF84E190
:10FDE000DFCFCF93C82FE3DFC150E9F7F2DFCF9128
:0CFDF000089580E0E8DFEE27FF2709946B
:040000031000FC00ED
:00000001FF
Quote


And boards.txt entry for it:

Quote

##############################################################

bobuino.name=Bobuino 1284P optiboot
bobuino.upload.protocol=arduino
bobuino.upload.maximum_size=130048
bobuino.upload.speed=115200
#bobuino.bootloader.low_fuses=0xff
bobuino.bootloader.low_fuses=0xf7
#bobuino.bootloader.high_fuses=0xde
bobuino.bootloader.high_fuses=0xd6
bobuino.bootloader.extended_fuses=0xfd
bobuino.bootloader.path=optiboot
bobuino.bootloader.file=optiboot_atmega1284p.hex
bobuino.bootloader.unlock_bits=0x3F
bobuino.bootloader.lock_bits=0x0F
bobuino.build.mcu=atmega1284p
bobuino.build.f_cpu=16000000L
#bobuino.build.core=arduino:arduino
bobuino.build.core=standard
bobuino.build.variant=bobuino


##############################################################

Go Up