I had left my fuses alone from the start, especially when programming my AVR via SPI (using at STM32 and my own code) wasn't producing consistently clean return values.
Once I got that all sorted out, I was able to program my AVR and blink an LED (thanks to a previous thread)... Yayyy!
So I move onto getting USART working... not so "yayyy". For some strange reason, even at 2400 baud, my echo code wasn't returning what I was sending.
After a ton of varying attempts, I thought I might just try to change my fuse to clock at 8MHz instead of the factory-set 1MHz (to give my more baud options to try).
I didn't think it'd be a big deal since I know earlier I had tested switching the fuse to 2MHz and then back to 1MHz. I don't remember if I tried 4MHz at that time.
Now that I set the fuse for 8MHz, ALL the SPI data I send returns 0xFF. (eg. Sending programming mode 0xAC530000, returns 0xFFFFFFFF from my AVR)
I changed my STM32 code so I could change my SPI speeds on-the-fly (instead of having to re-flash my ST for every test).
I originally had my SPI speed set at 15625, but I also tested at the max 250000 (1/4 of 1MHz). For the most part, 250KHz worked, but there were random error returns and I wouldn't trust flashing anything at that speed. But 15625 produced zero errors.
I have another ATMEGA16 that is bare/untouched and my SPI code still works with that.
Are there any thoughts why it works flawlessly (seemingly) at 1MHz and an SPI speed of 15625, but not when it's at 8MHz? I tried several other SPI speeds including the max 2MHz (1/4 8MHz), 1MHz, 250KHz as well as 15625Hz and they all give me MISO returns of 0xFF.
My master is:
Polarity = Low
Phase = First edge
Data Size = 8 bit
First Bit = MSB
Speed = Very High (50MHz - 200MHz //whatever this does. I'm guessing slew.)
SCK, MOSI = SPI Function/Mode & No pullup
MISO = SPI Function/Mode & Pullup at the start, then no pullup once the AVR enters programming mode
Reset = Push/Pull & Pullup
And this all works fine when my AVR is at 1MHz.
Frankly, when the datasheet says "When reading data from the ATmega16, data is clocked on the falling edge of SCK", that would make me think my ST would want the phase to be the second edge when the polarity is low. But when I tried that with my 1MHz clocked AVR, I got a lot more error returns.
The ST comment for "phase" is described as "Specifies the clock active edge for the bit capture". "Bit capture" = "reading data from the ATMega16" to me. "Falling edge" means the second edge when the polarity is low.