First time using IDE to program an ATtiny85

Hi everyone, this is a very first post and I hope there will be more in the future.

First I would like to mention that in the past I have already used the PIC16F family and more recently the AVR ATmega328 in some small projects, but always programming in assembly.

I recently came into contact with Arduino Uno and its IDE, but I have some doubts about this new world and I would like to expose them here.

I am starting very simple project for reading an analog signal and displaying the value on a nextion display. Only sending data via serial, not receiving anything from the display.

First I want to use the Arduino IDE to program the uC. I'm thinking of using ATtiny85.

I know that ATtiny85 is not on the list of devices, but I can install a core to use it and but my researches saw that the best core is SpenceKonde/ATTinyCore.

Now the questions, with this core do I use the same commands and functions that I would use in the Arduino Uno?

ATtiny85 doesn't have native serial, but I saw that I can use a serial library by software, is that correct?

After typing the code and compiling it, I can export the .hex file. I saw that 2 .hex files are always generated. What's the difference between them and which one should I use?

And lastly, can I record the generated .hex file using the USBasp recorder? And which fuses should I select?

Look and learn.....

https://www.youtube.com/watch?v=MmDBvgrYGZs

ATTinyCore gets my vote. I have used it for years and love it.

Yes, basic functions like the read and write of digital and analog pins are the same. Using serial, I2C, SPI also. There are specific default pins for the latter functions. Those can be found on the pin diagrams in the library. I don't remember, off the top of my head, having any trouble with any Arduino functions. Functions of external libraries (not included with the IDE) may be a different story.

Yes, but you need to use certain pins for RX and TX. If you must use different pins, use a software serial library like SoftwareSerial.

The last 2 questions I cannot answer. I just bootload and upload the code using the Arduino as ISP and my homemade programmer.

I am not able to install SpenceKonde/ATTinyCore, it seems that there is a problem on the server, as reported by Dr. Azzy.

Can I download the zip file and install manually? I'm using IDE 2.1.0

What I found interesting in SpenceKonde/ATTinyCore is that it already has the serial by software and in my case I can disable the RX, since I will only use the TX, I will only transmit data.

I'm just still in doubt about the two .hex files that are generated when the compiled binary is exported and which of these files I can use to record using USBasp and which fuses I use.

You should be able to upload it straight from the IDE, without having to worry about the hex files.

Also, it looks like the issue with the board manager url has only just popped up today, but it looks like you may have already read this issue.

Can I download the zip file and install manually? I'm using IDE 2.1.0

Apparently, yes.

Manual Installation
Option 1: Download the .zip, extract, and place in the hardware folder inside your sketchbook folder (if there is no hardware folder, create it). You can find/set the location of the sketchbook folder in the Arduino IDE at File > Preferences -> Sketchbook location.

I've just tested it out, and it does work.

1 Like

You have mentioned the hex files twice now. Why are you interested in them? To simply upload your code to the attiny from the IDE, you do not need to be concerned about hex files, just hit "upload using programmer" and everything is taken care of for you.

Also please explain what you mean by "record using USBasp". Perhaps it is a language translation error between your language and English. If you mean uploading your code to the attiny using the USBasp, just hit "upload using programmer" and it should work.

This is my second week using the Arduino IDE. In the past I made some assembly programs for the ATmega328 in the AtmelStudio IDE and used the USBasp Writer to record the hexadecimal with the eXtreme Burner software.

I can answer the previous question.

I was thinking that I need to generate the hex and use the eXtreme Burner software with the USBasp burner to have the microcontroller recorded.

But I saw here in the Arduino IDE interface that in the Recorder option I have USBasp in the list.

So I can use USBasp directly in the arduino IDE to record the ATtiny85

Am I right?

:+1:t2:

Programmer option

Upload to or program the attiny

:slight_smile:

I'm becoming enchanted by everything that the Arduino IDE provides in its standard version and by everything I can add to it.

I'm researching to be able to use your programming language, since I come from assembly and even the C language itself is something I'm not very familiar with. But assembly gave me the opportunity to get to know its registers and how microcontrollers work.

If you are used to assembly programming, using any high-level language might feel like you are no longer in control and not able to achieve efficient code. That is true in many ways. But of all the high-level languages, C and C++ probably give you more control and produce more efficient machine code than almost any other language. Plus, the code you write in C/C++ can be ported to other chips with completely different architectures with only minor adaptations.

Exactly, a Debounce routine on a button that in assembly is something you learn and understand in the first few weeks, now it's a new learning experience.

At first, looking at some arduino codes, I was amazed at the use of the delay function. I saw programs that half the time the microcontroller is doing nothing in some loop decrementing something to originate the delay function.

Then I saw that the millis function is the option, when you need to have a time interval to execute something, but you don't want to wait for the delay time and want to do something in that interval.

I installed core SpenceKonde/ATTinyCore and I had a doubt, on GitHub that the version is 2.0.0, but the available version is 1.5.2.

I didn't understand this question

V2.0.0 is not yet stable. If you want to test it, you should install it manually. 1.5.2 is the newest version available through the board manager right now.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.