Reply 60 of 124, by feipoa
- Rank
- l33t++
Thank you. I will look into your suggestions once I can confirm that I can at least programme the ATtiny85 successfully with my Arduino. If I cannot programme the ATtiny85, I probably cannot programme the ATtiny13. At this point, it doesn't matter to me how bloated or slim the code is as long as it fits in the AVR and is functional.
Since I already know the Adafruit SI5351 code works, I am starting with that code on the ATtiny85. I connected it per the youtube example I posted earlier. I followed the *blink* example in the following testbed:
Although it appears like the *blink* code is working on the ATtiny85, I do receive these mismatch errors in the IDE after uploading:
avrdude: verification error, first mismatch at byte 0x001f
0x20 != 0x24
avrdude: verification error; content mismatch
avrdude: verification error; content mismatch
I'm not sure if I need to worry about this error. In the screenshot, you can see I selected the clock of 4 MHz (internal). If I select any other values, the 500 ms delay in the code is way off from reality. With a stopwatch, I measured about 9 seconds for 10 blinks; it should be 10 seconds. I don't understand how we are supposed to know what the correct frequency is, but the Youtuber says if you "burn bootloader", this won't matter. He did not explain further.
The problem comes when I want to programme the ATtiny85 again. I get an error stating I have selected the wrong microcontroller and I can use -F to bypass this restriction. Reading up on -F, it seems like this is something we generally do not want to do because it doesn't help in 99% of the cases, and may ruin the microcontroller. The only way I have figured out how to re-programme the ATtiny85 again is to play around with the reset button on the Arduino and in some unrepeatable sequence, remove power to the ATtiny85. If I can manage to hit the "compile/send code" button in the Arduino IDE while doing some sequence of Arduino resets and removing/reapplying power to the ATtiny85, I can re-programme the ATtiny85. However, I will still receive the above mismatch error at byte 0x001f.
The menus in the Youtube example were a little different in my version of the IDE, which is 1.8.19. For example, on that user, he was able to select ATtiny 25/45/85, whereas my options were ATtiny 25/45/85 (No bootloader), ATtiny 25/45/85 (Optiboot), ATtiny 25/45/85 (Micronucleus/Digispark). I'm not sure what those later two are, but must have something to do with burning a bootloader. I selected the No bootloader option.
Having to perform this mickey mouse juggling act to re-programme ATtiny85 whenever we want to change the frequency on the SI5351 isn't very practical. Nonetheless, moving on...
I then did my juggling act to programme the ATtiny85 with the stock Adafruit SI5351 code (with Serial Monitor commented out). The ATtiny85 did programme, but I received a similar mismatch error:
avrdude: verification error, first mismatch at byte 0x000b
0xc0 != 0xc2
avrdude: verification error; content mismatch
avrdude: verification error; content mismatch
Curiously, the upload screen says the sketch is only using 157 bytes of SRAM, but when I uploaded it to the Arduino EtherTen, the same sketch was using 436 bytes. Is the compiler removing some code when it detects at ATtiny85?
Tomorrow, I will manually wire this ATtiny85 to the Wiretap PCB to see if the frequency is set to 84.4 MHz. Somewhere online I saw that the I2C pins on the ATtiny85 were: pin 7 is SDA and pin 6 is SCL, however I'm not sure if I need to set this up in code?
EDIT: By the way, the ATtiny13 is 1.3 mm smaller than the ATtiny85, so I will return to it if I can get the ATtiny85 working.
Plan your life wisely, you'll be dead before you know it.