What code do ISP's use?

I recently bought a couple of new ATTINY4313 chips. I have heard that they are used in ISP's, and I am looking for code that will let me do the same. Thanks!

I think that you will need to explain a lot better than that!

Exactly where and what have you “heard”?

They run the same C++ code as other AVRs. For example: http://www.gammon.com.au/forum/?id=11638

Probably some variant of the USBTINYISP code: http://dicks.home.xs4all.nl/avr/usbtiny/

"ISP" in Arduino context means "In-circuit Serial Programming"; you can't really pluralize it. Did you mean "ISP programmers", or were you somehow thinking that they might be talking about "Internet Service Providers"?

westfw: I meant "in-circuit system programming". :D paul_b: See http://forum.arduino.cc/index.php?topic=155092.msg1164302#msg1164302 I am looking for firmware, hopefully Arduino code.

I use an UNO as an ISP and the included in the IDE sketch. If you are using an UNO to program the AT Tiny chips and have it work, you could try taking the one sketch and modify it as needed for an AT Tiny and use the UNO one last time. (once your AT Tiny as ISP sketch works!)

Note that it may well be impossible due to lack of needed pins. Good luck! If you succeed, let us know.

The ATTINY 4313 has 17 available pins. I don’t think I will be running out of space anytime soon. :smiley:

You are looking for the USBtinyISP firmware code from Adafruit, http://learn.adafruit.com/system/assets/assets/000/010/327/original/usbtiny_v2.0_firm.zip

How do I compile that code? Will it work with the Arduino IDE?

How do I compile that code? Will it work with the Arduino IDE?

That s/w uses real build tools so it won’t work with the Arduino IDE.
Use an os that was designed for s/w development like linux.
Install the avr-gcc tools and avr binutils and then just run make.
With debian based systems like Debian, Linux Mint, Ubuntu, it is pretty simple as they are packages in the default repositories.
The README file in the zip image has a bit more about this.

You could build it on Windows but since windows wasn’t designed for s/w development it will be harder.
All the tools like avr-gcc tools, make, and shell tools you need are included with the IDE but you will have to set up your paths to be able to use them from the command line.
You could install ming/msys and then add the avr tools to get a standard shell environment since Windows doesn’t come with a true command line shell. You would still have to set up the paths to use the avr compiler and tools.

— bill

So is there Arduino code to do the same thing?

No, the VUSB Software USB stack isn't compatible with the Arduino software. You could build a serial-port based programmer starting with the ArduinoISP sketch.

You could build it on Windows but since windows wasn't designed for s/w development it will be harder.

You might have to install the Atmel-provided tools; either their "Atmel Studio" IDE (windows only, BTW), or the command-line "Toolchain" (available for Windows or Linux.) Horrors!

isaac, unless you are wanting to change the code, you won't need to build it. I'm sure if look around you can find a pre-built image that you can then just burn into your part.

--- bill

Did you look at Nick Gammon's ISP code that I suggested?

Is Nick's code usable on the 4313?

Compile it & run it.

A point of clarification about the USBtiny code. "Won't work with IDE" means it can't be built with IDE. However, once it is burned into the chip and the additional circuitry is connected, it can be used with the IDE to upload sketches into other AVR chips using ISP programming.

You will obviously need some other ISP programming device to burn the USBtiny code into the AVR.

--- bill

You don't need to build the USBtinyISP firmware. You can just use the precompiled hex file under the /spi/main.hex, from the zip file link I provided. This USBtinyISP hex file will work as is with the attiny4313 mcu as well.

You will need to change the lfuse to 0xEF, for external clocking.

I have tested this main.hex file burning it onto an attiny4313 and it runs correctly as USBtinyISP programmer.

If you want to build it under Windows, you will need to install WINAVR-20060421 and MinGW. You only need to make it under the /spi/ folder. You can ignore the /ir/ folder. You should keep it to build as attiny2313 even though you have a attiny4313. (the t4313 is not available under avr-gcc v3.4.3) (Note: it does not build correctly in newer WINAVR versions, well at least not without having to modify the code)

Can I upload the .hex file with avrdude?

OP: What do you want?

Do you want the USB-Tiny-ISP, the USB In System Programmer that can be used to program other AVR devices (including bootloading/etc)? Then use Adafruit's code, linked above. There's got to be a .hex file out there that you could flash with avrdude, and I doubt it's hard to find.

I don't think Nick Gammon's sketches will work on the 4313 - IIRC they were much bigger than 4k compiled.

My guess is you want something that you can select from the "Programmers" menu of the IDE and use to program AVRs - in that case, put ArduinoasISP (or a derivitive thereof) on a '328-based pro mini - or use the '4313 with that USBTinyISP code (after either building it or obtaining it pre-built)