2

I would like to upload a .hex to ATTiny13V (or '13A) using Arduino Uno R3. I think I know everything to do, but ATTiny13 ISP support and Arduino IDE is a bit search-and-find, and I have some grey-areas in my understanding of how this all works together.

I got here by:

-Finding an Instructable that did something I liked, and there's a ATTiny13V used, a .hex to upload, and C source if I want to modify the source. Right now I do not need to modify the source, the available .hex is fine.

-I then looked for a way to have AVR programing from OS X. This seems a little problem, many AVR programmer hardware work great under Windows but seem to have mixed results under OS X. I saw Arduino could be used for this under OS X.

-I looked on local craigslist for Arduino, someone was selling a Uno R3 with some extras for a great price, and here we are. And now I have a lot more projects I wish to complete!

I am using Arduino 1.6.10 (from the .cc not the .org).

I read on stackexchange and other places that smeezekitty's core13 works for the ATTiny13. elabz.com/arduino-shrunk-how-to-use-attiny13-with-arduino-ide/

That's great, but: If I am not using any of the Arduino-specific commands, I don't think I need the bootloader, correct? I think it is not really a bootloader but builds support for some of the Arduino-specific higher-level commands used by sketch files.

Do I even need the ATTiny13 core files if I hook the pins up properly between the '13 on a breadboard and the Arduino (as per here: https://create.arduino.cc/projecthub/arjun/programming-attiny85-with-arduino-uno-afb829 ).

I really do not understand what the Arduino IDE/bootloader is doing for me as an abstraction layer. Do I need the bootloader if I'm not using any of the higher-level Arduino-specific commands on the chip? HOw about the core files for ATTinyanything vs specifically ATTiny13?

The hex file and C source I will be using are here: http://www.instructables.com/id/Programmable-LED/ My nextstep will be to modify the source. The C source looks like it references some AVR-specific header files. I see that the ArduinoIDE uses avrdude so maybe things will compile anyway?

I feel like I'm close but not 100% in my understanding of what I need to do, with the tools I have on hand.

Thanks for your help- I am not above a step-by-step.

Main question 1: I have a .hex file, an Arduino and IDE 1.6.10, OS X, and breadboard and useful components. What do I need to do to put the hex on this ATTiny13?

Main question 2: Jumping-off points for taking the C source I linked, tweaking it a bit, building a hex, and uploading that. I am not against moving it to a sketch if I have to, but it would be good for me to learn how this works before I mode to the IDE.

I have a small software background, am comfortable taking that C source and making changes and compiling (assuming I can find the needed .h files), but this is my first time working with any multiprocessors.

1 Answer 1

1

Your computer cannot talk directly to the ATtiny. You need some piece of interfacing hardware between them. This is called an ICSP (or ISP) programmer. You also need software to drive the programmer, typically avrdude.

If you do not have a programmer, you can buy one (I had success with some very cheap USBASPs), or you can program an Arduino Uno to behave like an ISP programmer. You do this by uploading into the Arduino a program called ArduinoISP, like explained in the tutorial Using an Arduino as an AVR ISP (In-System Programmer). You will typically use the Arduino IDE and the Arduino core for the Uno to compile and load ArduinoISP into your Uno. Once this is done, you can use the Arduino as a programmer and burn your .hex into your ATtiny.

If you want to compile your own programs for the ATtiny, you will need the avr-gcc compiler and the avr-libc. These are bundled with the Arduino IDE, so you already have them. You will need an Arduino core for the ATtiny only if you want to use the Arduino APIs and libraries. Otherwise you can write plain C programs with noting else than the avr-libc and avr-gcc.

Edit: To compile a plain C program, you can type something like this:

avr-gcc -mmcu=attiny13a -DF_CPU=1200000 -Os -Wall -Wextra flickled.c -o flickled.elf
avr-objcopy -O ihex flickled.elf flickled.hex

This assumes your source file is called flickled.c and your ATtiny runs at 1.2 MHz.

1
  • This worked great, I've programmed both .hex and new sketches into the ATTiny13 using the Uno as ISP. Thank you! Sep 18, 2016 at 2:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.