ATtiny861 programming problem

The IDE can download the program to the controller only once after the bootloader is loaded.

I assembled a circuit with an external 16 MHz crystal.
I set parameters (Arduino IDE 1.8.13):
"ATiny461 / 861 (a) (Optiboot)"
Chip: "ATtiny861a"
Clock Source (Only set on bootload): "16 MHz (external)"
Pin mapping: "New style (down each side)"
Timer 1 Clock: "CPU (CPU frequency)"
LTO (1.6.11 + only): "Enabled"
tinyNeoPixel port: "Port A (pins 0 ~ 2, 10 ~ 14)"
millis () / micros (): "Enabled"
B.O.D. Level (Only set on bootload): "B.O.D. Disabled (saves power)"
All values are set by default except for the "Clock Source" setting.

Then I loaded a bootloader (Programmer "Arduino as ISP", using Arduino Nano, 10uF capacitor between RESET and GND is installed), the message "bootloader write complete" was displayed and in the window below:

 *** failed;
avrdude: WARNING: invalid value for unused bits in fuse "efuse", should be set to 1 according to datasheet
This behavior is deprecated and will result in an error in future version
You probably want to use 0x00 instead of 0xfe (double check with your datasheet first).

When I loaded the Blink program (Examples\01.Basic\Blink) into the microcontroller, then download is successful and the LED is blinking!
If I change the program (for example, change delay) and try to reload it, the I get the message:

avrdude: verification error, first mismatch at byte 0x0090
         0x60! = 0x68
avrdude: verification error; content mismatch
avrdude: verification error; content mismatch

If I load the bootloader again (the message "invalid value for unused bits in fuse" efuse "" is displayed again), and then try to load Blink again, the program will load successfully and the blinking rate of the LED changes according to the new delay! If I change the delay in Blink again and try to download this program again, the error "avrdude: verification error; content mismatch" is displayed again.
The program will be loaded again the next time only after loading the bootloader.

Turning off DC supply and turning it on again (simulate RESET) does not change anything.

ATTinyCore has two boards with "ATtiny861".

If you select "ATiny261/461/861(a)" and load bootloader, then the message will appear:

avrdude: WARNING: invalid value for unused bits in fuse "efuse", should be set to 1 according to datasheet
This behaviour is deprecated and will result in an error in future version
You probably want to use 0x01 instead of 0xff (double check with your datasheet first).

Difference between "0xff" and "0xfe" (previous message).
But works fine and аny program can be loaded many times!
So I use "ATiny261/461/861(a)" and the issue is resolved.

Were you planning to report this issue to me so that it could be corrected in the next release of ATTinyCore?

There are a whole bunch of things here that don't add up....

Aaaah! I'll bet that's it - you initially bootloaded with optiboot definition. Then you did not connect a serial adapter as uploading using Optiboot requires, instead you just left the arduino as ISP connected. And the upload speed of arduino as ISP is 19200 baud.... which is the same as optiboot on those parts (that's also a problem, and I don't think that;'s what the optiboot binaries we use are actually expecting), and uses the same protocol so the upload "worked" and the IDE was none-the-wiser. But, subsequent uploads would not work, because for uploads through the bootloader the -e flag is not passed to avrdude so the flash is not erased...

I didn't know how to contact the ATTinyCore developer, so I wrote here. Right now, after your message, a brilliant idea came to me - to read the documentation for ATTinyCore. :smiley: This is amazing - it turns out that you can download programs to ATtiny via the serial port! I discovered a lot of new things for myself. Thank you very much! But is it possible to correct the fuses setting to remove the warning?
I apologize for not starting to read the documentation right away and just asked an extra question. I thought there would be only a superficial description.

And one moment. Maybe someone will come in handy.
I tried programming with FTDI, uploading the "ATtiny461\ATtiny861(a) Optiboot" bootloader first.
Programming with FTDI did not work for me right away.
The installation of 1K resistors between the RX and TX pins and the corresponding pins of the microcontroller (PA6 and PA7) helped. Maybe I didn't read it carefully, but I did not see this feature in the documentation.

Huh, well that's something I haven't heard of..... Including resistors there really shouldn't change anything

Until 2.0.0, I make no claims about whether Optiboot works on the x61. I am certain that there are "supported" cases where it does not work.

In general, there's a lesson here about Arduino as ISP and bootloaders, namely, that I should probably make sure that the bootloader never runs at the same baud rate as Arduino as ISP.

One of the planned areas that 2.0.0 will break compatibility is optiboot binaries anyway. All Optiboot boards will require the new bootloader to be uploaded. sometimes the baud rates were seemingly chosen simply to be mean to people who insisted on using the bootloader on parts I didn't think ought to be using it by forcing them to endure excessively slow uploads (this is the case for a lot of parts with no hardware serial).
I also have a much better understanding of baud rates and how they work on classic AVRs particularly where there is a hardware serial port; there are several cases where it either didn't work, or worked with razor-thin margin because the baud rate was inappropriate (not necessarily too fast). 115200 baud is fine at 12 MHz, but at 8 and 16 MHz, we really ought to be using 76800 baud instead, since 115200 comes out 2% fast. And the t841 internal, t1634 internal, and 828 internal also come out about 2-3% fast at 5V, 57600 and 115200 for 8 and 16, which is what ATTinyCore uses, is guaranteed not to work. 76800 comes out dead-on though even at 8 MHz,

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