Does 1.5.6-r2 work with USBtinyISP?

I am trying to program an ATTINY4313 using the IDE and a USBtinyISP board. The setup worked with IDE 1.0.5 but I get a strange error with 1.5.6-r2.

I have updated the driver for the USBtinyISP and I have installed the latest version of avrdude. If I invoke avrdude from the command line, it says the device (USBtinyISP) is initialized and ready.

In the IDE, I select the ATTINY 4313 from the Tools/Boad menu and USBtinyISP from the Tools/Programmer menu. I do not select a COM port. The OS Device Manager shows the USBtinyISP present as a USB device.

If I try to upload my sketch to the 4313 by selecting File/Upload Using Programmer, it compiles successfully but then gives me a "BOARD AT COM6 NOT AVAILABLE" error. There is no COM6 on the system, the device manager shows only COM1 and COM2. I have tried powering down and rebooting, but no change, always the mysterious COM6 error.

How to get past this?

I have installed the latest version of avrdude.

I keep hearing about avrdude. I googled it and it says it's a dos command line program. Do I need it ?

Did you install the tiny cores in 1.56 r2? 1.05 and 1.56 are two different IDE's...

Doc

raschemmel:

I have installed the latest version of avrdude.

I keep hearing about avrdude. I googled it and it says it's a dos command line program. Do I need it ?

If you've installed the IDE, you already have it.

The IDE calls avrdude to do the actual chip programming. You see the avrdude output in the window when you build with "verbose output: upload" checked.

Docedison: Did you install the tiny cores in 1.56 r2? 1.05 and 1.56 are two different IDE's...

Doc

You don't need the tiny cores to program with the USBtinyISP -- it is an ISP programmer.

You do need to select it under "Tools|Programmer" before tryng to actually program with it using "File|Upload Using Programmer".

Note: Hitting the normal "Build and Upload" button won't work if you are using an ISP programmer. You need to use "File|Upload Using Programmer" instead.

vanduino: If I try to upload my sketch to the 4313 by selecting File/Upload Using Programmer, it compiles successfully but then gives me a "BOARD AT COM6 NOT AVAILABLE" error. There is no COM6 on the system, the device manager shows only COM1 and COM2. I have tried powering down and rebooting, but no change, always the mysterious COM6 error.

How to get past this?

Sounds like it is a problem with the IDE, not what you are doing.

Until the issue is fixed, the only workaround would be to build the hex file in the IDE, and then upload it manually using avrdude from the command line. Or go back to 1.0.5. Sucks, but it is still a beta release strictly speaking, so I guess you've found what they are looking for -- an issue.

Put in a report and it may get fixed in the next release, if you are lucky.

@Doc, I have the 1.5.x tiny cores, everything seems like the latest version. I gave up on the USBtinyISP and I went back to trying to use the Due as the ISP programmer.

I downloaded Peter VH's bitbanging ArduinoISP code and ran it as a sketch instead of the stock example ArduinoISP in the IDE.

http://forum.arduino.cc/index.php?topic=156764.0 http://petervanhoyweghen.wordpress.com/2013/06/11/arduinoisp-on-the-due/comment-page-1/#comment-114

It loads and gives an LED heartbeat. Progress.

You have to modify /hardware/arduino/avr/programmers.text:

#arduinoisp.protocol=stk500v1    
arduinoisp.protocol=arduino

You have to be careful to keep all Vcc at 3V3, board and chip.

Switch over to Due Native USB port to upload sketch to ATTiNY.

More progress. I can now see SPI banging away on my newly arrived Saleae logic analyzer (an elegant tool). I have some wiring details to correct and then I am going to see if I can talk to the ATTINY in earnest.

I can now program the Attiny 4313 with the Due if I have the Attiny in a breadboard. It only fails about 5% of the trials. If I put the Attiny into a socket embedded into my local SPI bus, programming fails about 95% of the trials.

It does not seem to matter if I select the HARDWARE_SPI option of ArduinoISPdue or bit-banging. The SPI clock divisor is set at 225, so I don't know that I can go slower. At this point, I am having good enough success on the breadboard, but SPI programming seems real touchy when I try to integrate it into my PCB. I have checked all the traces for continuity, resistance, etc. On the logic analyzer, I can see the Attiny responding. The SPI signal levels look correct, but I keep getting device signature errors. It is as though SPI is so marginal that the traces and connectors on the PCB throw it off. The same circuit with the Mega worked fine. I will continue to see if I can isolate the problem.

I just tried it. This is a serious bug in the 1.5x IDE. It requires a serial port before it even starts up avrdude even if avrdude is not going to use a serial port.

This needs to be bugged. It is serious enough that is should get fixed in the next release.

pico: Note: Hitting the normal "Build and Upload" button won't work if you are using an ISP programmer. You need to use "File|Upload Using Programmer" instead.

It can be made to work. You have to create a new board type that specifies the ISP programmer. Here is one I use on an UNO for with an USBasp programmer.

unoUSBASP.name=Arduino Uno w/USBASP
unoUSBASP.upload.using=usbasp
unoUSBASP.upload.maximum_size=32768
unoUSBASP.bootloader.low_fuses=0xff
unoUSBASP.bootloader.high_fuses=0xde
unoUSBASP.bootloader.extended_fuses=0x05
unoUSBASP.bootloader.path=optiboot
unoUSBASP.bootloader.file=optiboot_atmega328.hex
unoUSBASP.bootloader.unlock_bits=0x3F
unoUSBASP.bootloader.lock_bits=0x0F
unoUSBASP.build.mcu=atmega328p
unoUSBASP.build.f_cpu=16000000L
unoUSBASP.build.core=arduino
unoUSBASP.build.variant=standard

Note also that if you don't create a separate board type for use with the ISP programmer, and use the "Upload Using Programmer" that you will not be able to use the full flash since the board type data specifies the maximum flash size and the entries that come with the IDE have reduced the flash size by the bootloader size.

You can see in my entry above that I specify the full 32k flash size since no bootloader is being used.

--- bill

Although I own a couple of the asp programmers… I built the Adafruit ISP programmer and I did 2 mods… the first was to rewire the zif socket for the 43 - 2313 and 85 chips and the second was to wire the ISP connector to the SPI pins except the reset which must go to pin 10 for the reset to be under control of the Adfruit ISP sketch. I also use the AT - PA programming board which has both 6 and 10 pin programmer connections. This way using a dedicated Uno I can program virtually any Atmel chip that is supported by the IDE. I’ve not used it with a Mega 1284 or 2560 though. The AT - PA also has provisions for a 328 and a crystal or a resonator…
It has worked very well for me for over 6 month’s… for the rest I bought a MK II programmer.

Doc
I own a Digix and see no reason to even attempt using it as a programmer… Uno’s are cheap enough that this method made more sense to me… Point of fact… I used my genuine r3 for the dedicated programmer…

raschemmel:

I have installed the latest version of avrdude.

I keep hearing about avrdude. I googled it and it says it's a dos command line program. Do I need it ?

The reality is it is a command line world. The IDE is just a pretty GUI wrapper on top of the command line programs that do the real work. All the GNU tools are all command line, c-preprocessor, compiler, linker, archiver, binutils to convert to hex records, avrdude to do the uploading, etc... In more typical environments, make would be used to do the build, but the IDE developers have decided to re-ivent the world and have tried to mimic the rule based types of things that make was designed to handle.

If you turn on the verbose output in the IDE [File]->[Prefernces] you can watch the IDE GUI fire off and run all the command line programs.

--- bill

download WinAVR file from here:

http://sourceforge.net/projects/winavr/files/WinAVR/

rename C:\Arduino\hardware\tools\avr C:\Arduino\hardware\tools\avr.old (for backup) and then make a new directory

C:\Arduino\hardware\tools\avr

put all the contents from the downloaded WinAVR files in:

C:\Arduino\hardware\tools\avr

move avrdude.conf from C:\Arduino\hardware\tools\avr\bin to C:\Arduino\hardware\tools\avr\etc

you will have to create the etc directory

Edit the avrdude.conf file and put the text below after the ATtiny2313 and you will be able to program the ATtiny4313! I wanted to save someone the trouble I went through to figure this out. I am using an Arduino UNO to program the ATtiny4313. The ATtiny4313 is very desirable because it has twice as much memory as the ATtiny2313. I am using an Arduino UNO as the programmer. Good Luck! Will

————————————————————

ATtiny4313

————————————————————

part id = “t4313?; desc = “ATtiny4313?; has_debugwire = yes; flash_instr = 0xB2, 0x0F, 0x1F; eeprom_instr = 0xBB, 0xFE, 0xBB, 0xEE, 0xBB, 0xCC, 0xB2, 0x0D, 0xBA, 0x0F, 0xB2, 0x0F, 0xBA, 0x0D, 0xBB, 0xBC, 0x99, 0xE1, 0xBB, 0xAC; stk500_devcode = 0x23;

Use the ATtiny26 devcode:

avr910_devcode = 0x5e; signature = 0x1e 0x92 0x0d; pagel = 0xD4; bs2 = 0xD6; reset = io; chip_erase_delay = 9000;

pgm_enable = “1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1?, “x x x x x x x x x x x x x x x x”;

chip_erase = “1 0 1 0 1 1 0 0 1 0 0 x x x x x”, “x x x x x x x x x x x x x x x x”;

timeout = 200; stabdelay = 100; cmdexedelay = 25; synchloops = 32; bytedelay = 0; pollindex = 3; pollvalue = 0x53; predelay = 1; postdelay = 1; pollmethod = 1;

pp_controlstack = 0x0E, 0x1E, 0x0E, 0x1E, 0x2E, 0x3E, 0x2E, 0x3E, 0x4E, 0x5E, 0x4E, 0x5E, 0x6E, 0x7E, 0x6E, 0x7E, 0x26, 0x36, 0x66, 0x76, 0x2A, 0x3A, 0x6A, 0x7A, 0x2E, 0xFD, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00; hventerstabdelay = 100; progmodedelay = 0; latchcycles = 5; togglevtg = 1; poweroffdelay = 15; resetdelayms = 1; resetdelayus = 0; hvleavestabdelay = 15; chiperasepulsewidth = 0; chiperasepolltimeout = 10; programfusepulsewidth = 0; programfusepolltimeout = 5; programlockpulsewidth = 0; programlockpolltimeout = 5;

memory “eeprom” size = 256; paged = no; page_size = 4; min_write_delay = 4000; max_write_delay = 4500; readback_p1 = 0xff; readback_p2 = 0xff; read = “1 0 1 0 0 0 0 0 0 0 0 x x x x x”, “a7 a6 a5 a4 a3 a2 a1 a0 o o o o o o o o”;

write = “1 1 0 0 0 0 0 0 0 0 0 x x x x x”, “a7 a6 a5 a4 a3 a2 a1 a0 i i i i i i i i”;

loadpage_lo = ” 1 1 0 0 0 0 0 1?, ” 0 0 0 0 0 0 0 0?, ” 0 0 0 0 0 0 a1 a0?, ” i i i i i i i i”;

writepage = ” 1 1 0 0 0 0 1 0?, ” 0 0 x x x x x x”, ” a7 a6 a5 a4 a3 a2 0 0?, ” x x x x x x x x”;

mode = 0x41; delay = 6; blocksize = 4; readsize = 256; ; memory “flash” paged = yes; size = 4096; page_size = 64; num_pages = 64; min_write_delay = 4500; max_write_delay = 4500; readback_p1 = 0xff; readback_p2 = 0xff; read_lo = ” 0 0 1 0 0 0 0 0?, ” 0 0 0 0 0 a10 a9 a8?, ” a7 a6 a5 a4 a3 a2 a1 a0?, ” o o o o o o o o”;

read_hi = ” 0 0 1 0 1 0 0 0?, ” 0 0 0 0 0 a10 a9 a8?, ” a7 a6 a5 a4 a3 a2 a1 a0?, ” o o o o o o o o”;

loadpage_lo = ” 0 1 0 0 0 0 0 0?, ” 0 0 0 x x x x x”, ” x x x a4 a3 a2 a1 a0?, ” i i i i i i i i”;

loadpage_hi = ” 0 1 0 0 1 0 0 0?, ” 0 0 0 x x x x x”, ” x x x a4 a3 a2 a1 a0?, ” i i i i i i i i”;

writepage = ” 0 1 0 0 1 1 0 0?, ” 0 0 0 0 0 a10 a9 a8?, ” a7 a6 a5 x x x x x”, ” x x x x x x x x”;

mode = 0x41; delay = 6; blocksize = 32; readsize = 256; ;

ATtiny4313 has Signature Bytes: 0x1E 0x92 0x0D.

memory “signature” size = 3; read = “0 0 1 1 0 0 0 0 0 0 0 x x x x x”, “x x x x x x a1 a0 o o o o o o o o”; ; memory “lock” size = 1; write = “1 0 1 0 1 1 0 0 1 1 1 x x x x x”, “x x x x x x x x 1 1 i i i i i i”; read = “0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0?, “x x x x x x x x x x o o o o o o”; min_write_delay = 9000; max_write_delay = 9000; ;

memory “lfuse” size = 1; write = “1 0 1 0 1 1 0 0 1 0 1 0 0 0 0 0?, “x x x x x x x x i i i i i i i i”;

read = “0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0?, “x x x x x x x x o o o o o o o o”; min_write_delay = 9000; max_write_delay = 9000; ;

memory “hfuse” size = 1; write = “1 0 1 0 1 1 0 0 1 0 1 0 1 0 0 0?, “x x x x x x x x i i i i i i i i”;

read = “0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0?, “x x x x x x x x o o o o o o o o”; min_write_delay = 9000; max_write_delay = 9000; ;

memory “efuse” size = 1; write = “1 0 1 0 1 1 0 0 1 0 1 0 0 1 0 0?, “x x x x x x x x x x x x x x x i”;

read = “0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0?, “x x x x x x x x o o o o o o o o”; min_write_delay = 9000; max_write_delay = 9000; ;

memory “calibration” size = 2; read = “0 0 1 1 1 0 0 0 0 0 0 x x x x x”, “0 0 0 0 0 0 0 a0 o o o o o o o o”; ; ;