Spontaneous erasure of AVR working as SPI slave

Hi, I'm using an ATmega32U2 uC as an SPI slave. Namely it receives the I2S data stream sent to the DA1134F DAC in the AUREL's audio link (

formatting link
,
formatting link
)

However once, when I pressed RESET button to enter the DFU bootloader and update the firmware, I've stated, that the bootloader does not exist any more. I've connected the chip to the SPI programmer, and found, that bootloader is erased and even the fuse bits were changed.

Analyzing the incident, I've stated, that probably I've pressed the RESET when the SCK line (connected to the BCLK line of I2S interface) was low. The ADC input data have accidentally formed the valid serial programming command, and caused erasure of firmware.

The above scenario may happen in any system which uses the AVR as SPI slave, in which the SPI signals are still active when AVR is reset. So probably it would be good to disable SPI programming in such situation. That workaround could be good for parts with JTAG programming, but would be probably unconvenient for small AVRs without JTAG (like ATmega88).

The above problem is easy to predict (basing on documentation), but in fact I was quite surprised when it happened. Therefore I wanted to report it as a caution.

-- Regards, WZab ( snipped-for-privacy@ise.pw.edu.pl )

PS. The part of the code in ATmega88 version used to receive one channel of I2S data with the SPI interface is published on alt.sources with subject "Code for ATmega88 to receive I2S data (one channel) at 24bit/48kHz ").

Reply to
wzab
Loading thread data ...

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.