I am hoping someone can suggest a solution to my problem...
I have firmware written and tested for the ATmega328PB, but due to lack of availability, decided to investigate how simple it would be to port the code to ATmega324PB (probably very easy, I would think, given their similarities). So I got a ATmega324PB Xplained Pro, and recompiled the project for that target hardware. I programmed the ATmega324PB using my Atmel ICE via the JTAG port on the Xplained board. So far so good.
I have debug printing out a USART, and it was gibberish - no surprise. I had to go in and change some fuse settings to accommodate the board differences (use internal RC oscillator, disable brownout, etc.). When I went to save fuse settings, it warned me that SPI was being disabled. The 324PB has no option for SPI programming, as far as I know, so should not be a concern... however, since I am new to the 324PB, I decided to play it safe, and change the settings to avoid the warning. Big mistake. I had checked both JTAGEN and SPIEN, and this time when I saved, the warning did not appear.
From this point on, I could not talk to the ATmega324PB. Not through my Atmel ICE, and not through the built-in EDBG. When I try, the error message appears:
No JTAG devices detected. Debugger command Activate physical failed.
Unable to enter programming mode. Verify device selection, interface settings,
target power, security bit, and connections to the target device.
One point of interest... the previously loaded firmware still runs, and on startup, it reads and prints the fuse settings. I can see that the values are:
LO = 0x62
HI = 0xD8
EX = 0xF7
This means that SPIEN is programmed (0) and JTAGEN is not. Somehow, JTAG got deselected (not by me!), perhaps because it is mutually exclusive with SPIEN?
In any case, I am now stuck... I cannot program this device.
Another strange thing... the Device Programming interface in Atmel Studio allows me to choose wither JTAG or SPI, which I find odd, since SPI is not an option for this chip.
So it seems that Atmel Studio leads to a bricked device with no way to recover.
(or maybe there is a way...I wonder if HVPP is an option here... I have never used it before).
Thanks for any help,