Fattoresaimon / I2CEncoderMini

GNU General Public License v3.0
32 stars 7 forks source link

Using the Atmel Project and loading it into a device under debug immediately bricks the device #4

Open rowifi opened 3 years ago

rowifi commented 3 years ago

I've tried two devices, and bricked both. Presumably the project as is must disable the UPDI pin feature in order to use the pin as an interrupt out. Maybe the devices are now functioning as i2c encoders, but I can't check that right now. If I'm correct, where does that occur in the code? I'd like to prevent it to verify my IDE and programmer is set up correctly.

I didn't think the UPDI could be locked out without setting a fuse, and I didn't think fuses were set by loading and running code in debug.

Fattoresaimon commented 3 years ago

Hello, The UPDI pins is used as a GPIO pin in my code, it's configure in the fuse: #define f_SYSCFG0 0xF0 //GPIO MODE If i remember correctly if you set it as a GPIO, even during the debug, it disable the UPDI and you can't debug. If the pin is set to GPIO your programmer have to give a 12V pulse in order to revert the pin to the UPDI. I'm using the pickit4 and it to automatically. But i remember while i was developing the project, that sometime the ATtiny402 was looking bricked. The solution was to erase the entire chip plus the UserSignature. In the Atmel studio you can do like that: Tools -> Device Programming -> memories Under Device choose the two type of memory.