Programming ATTiny841, code stopped working but no changes have been made

I'm attempting to program an ATTiny841 using Arduino, and the very nice ATTinyCore by SpenceKonde with a custom circuit board. The application is reading an analog input, counting the time between peaks in the analog data, and lighting an LED if the frequency enters a predefined range. Sorry for the length of this in advance, but I've been working on this for a while, tried a lot of things, and I'm just at a loss and hoping some of the super smart folks here may be able to point out what I missed!

Here's the problem: the code has stopped working, but it hasn't changed, the programming process seems to be the issue but I can't figure out why, or how to fix it.

What lead up to the failure:
I had the code working exactly as I need on one of my prototype boards, so I built up a second board, programed it, it worked as expected but I had to make a little tweak to the design and switched the power supply from a 5V linear regulator to a boost converter set to 5V output. Built up a third board, programed it, and... Nothing. I get no output from the chip any more. It's like it doesn't read anything from the analog input. I reprogrammed it with a Blink program to just flash the attached LED, but that didn't even work. The program would flash properly (Arduino IDE would do the write and read back and report no errors) but it didn't seem to run.

After this, I thought maybe by programmer went bad (using a SparkFun AVR Pocket programmer) so I switched to another one I have, but still didn't work. After some other testing I found that when I flashed the blink program from a different computer it would work! However, flashing the original firmware still wouldn't read from the analog input properly.

I thought maybe there was something wrong in my new design, but after checking extensively between versions I couldn't find anything, so I tried swapping a good working chip onto the new board. It worked perfectly! So, I tried reflashing the chip with the exact same firmware from Arduino with the working computer and new programmer from earlier and... It quit working.... WTF?

So, replaced it with a brand new chip thinking something went wrong with that one, flashed it, still won't work!

I am absolutely 100% positive that the code has not changed, and I'm using the same settings, and I just don't understand what I'm missing. Any ideas?
EDIT: Attaching Schematic. I wasn't able to post it initially as I was travelling!

Detector Test Schematic v3.pdf (56.3 KB)

Just some ideas.
Post the schematic. Depending on what you also have connected to the programming pins can affect the upload process.
Have you got different versions of the Arduino Attiny core on the various PCs that you tried.
Sometimes it is necessary to use the "burn bootloader " option on a new chip to set the fuses correctly even if you don't actually upload a bootloader.

Thanks for the suggestions! I did double check the library and IDE versions, and everything is on Arduino IDE v1.8.19, and the ATTinyCore v1.5.2. I know the IDE is out of date, but on my Linux machine that's the version in the repo, and I haven't bothered to change it. The two machines I programmed with, the first one that I did all of the development on is running Linux Mint 21.1, the second machine I mentioned that let me program when the original stopped working is running Windows 10. Still IDE v1.8.19.

I did try to downgrade the ATTinyCore back to 1.5.0 and 1.4.1, then re-flash, but neither worked. I also tried going to Arduino 2.1.0 on the Windows machine and tried re-flashing but the analog in still doesn't work.

I do make sure to click the 'Flash Bootloader' option after initially installing the chip on the board to make sure the fuses were set properly for the 16MHz external resonator. I have also tried clicking 'Flash Bootloader' just prior to flashing the firmware, and trying to use the internal 8MHz clock with the program, but it still doesn't read...

I also cleaned up and documented the sample code a bit, and have attached it here to see if anybody sees an obvious problem.

EDIT: I have verified the amplifier is working correctly on my oscilloscope, it's definitely not a hardware issue. I see ~2v to 2.5V on the input in silence, and I can see a peak of about 4V when talking into the mic, or playing a test tone from Online Tone Generator - generate pure tones of any frequency.

test_firmware.ino (2.9 KB)

You have considered the two available pin mappings and selected the right one in the menu?

Yes, the board is set assuming a clockwise pin assignment, which I believe is the default. Though for A1, I believe the pin assignment is the same physical pin regardless of which pin assignment is used.

Also to verify visually that the firmware was running I added a double flash of the LED at the end of the setup(). I see the double flash when I program it or any time it's powered on. I did also note after adding that flash after setup, however, that the chip seems to reboot itself 2-3 times on power up. That seems unusual... The pull up resistor on reset measures normally, and the power caps are in there correctly. Do these chips just do that and I've never noticed, or could that be an issue?

Can you

  1. produce a screen dump such as the one in post #4 showing the IDE configuration for your Attiny841 and post it.
  2. Set the IDE preferences to generate verbose compilation and uploading output and also post that.

Ok, sorry for the long silence! I set out to gather these things and found my issue.

The programming issue with the one computer turned out to be a stupid problem: I hadn't selected the programmer. I had to reinstall the IDE to find this out, but basically I got in a rush and apparently forgot to select the programmer. Confusingly, with no programmer selected and attempting to upload via programmer, rather than erroring out saying no programmer was connected, the IDE reported success and acted like everyone was fine? No clue there... Maybe a bug.

The issue with the code not detecting ended up being my fault. I fat-fingered a key at some point, which happened to add a zero to the end of my buffer. What was supposed to be 15 ended up being 150, so the buffer took so long to fill that the frequency was rarely detected correctly given the length of the test tones. Took out the stray zero and it went back to working!

Lesson learned: don't get in a rush, and the obvious solution is probably it... Thanks all for the help!