After spending years in the Raspberry Pi/Arduino world, I recently entered the ATtiny world and even after several days I still can't grasp certain facts. This is what I have learned so far: hydrogen water maker
- One can upload (assembler) code directly to a AVR microprocessor via a certain protocol. However, to do this one needs GPIOs, which the ordinary PC lacks - usually this is solved by connecting PC via the USB port to Arduino Uno (basically also AVR microprocessors) and sending code via the GPIOs of the Arduino.
- One can also upload code via bootloader. This is small code that starts on the power-up of the microprocessor and connects to PC. The most common bootloaders for AVR processors are Optiboot (via serial communication) and Micronucleus (via USB communication).
- In the case of Optiboot, one also needs a USB-serial chip between the microprocessor and the PC USB port. Optiboot is usually pre-installed on Arduino Uno and Arduino Nano, so these two platforms ship with a USB-to-serial chip on the board.
- In the case of Micronucleus, communication is established directly through D+ and D- USB pins. Micronucleus is usually pre-installed on Digistump boards (unless one buys a Digistump board without a microcontroller).
If you just buy the bare AVR microcontroller, you can't do anything with it from your PC. You need either another AVR microcontroller with bootloader already uploaded, i.e. Arduino Uno/Nano, or Raspberry Pi, to upload code or bootloader. In the first case you can just use Arduino IDE or avrdude, while in the second case you can just use avrdude.
Can you confirm that I have understood everything correctly so far?
Now my questions:
- One can use D.A. Mellis ATtiny library to load code via Arduino Uno/Nano using Arduino IDE. However, one has to burn the bootloader first. Does this mean that this library does not burn a bootloader, but actually only changes the fuses (basic settings of the microcontroller)?
- According to the instructions on the internet, the Micronucleus bootloader can only be uploaded with avrdude. Why is it not possible to upload the Micronucleus bootloader from Arduino IDE with Tools/Burn_bootloader?
- What the heck is ATTinyCore or Arduino core in general?
- In my experience, not all sketches work with all bootloaders, especially Micronucleus. I suspect the problem is that Micronucleus runs at 16.5 Mhz, while most sketches for ATtiny expect 8 MHz. Is that right?
Thank you very much for your help with my questions.