cyberponk
Newbie level 2
Hi mates, I am trying to use i2c with ATmega32u4 in Proteus (version 8.5 SP1) and in my i2c library the following line hangs the MCU:
It never gets past this.
Doing some debugging I verified that TWCR never changes in this model, so it is impossible to enable i2c, which is the cause of this hang.
I tried setting it directly, with TWCR=0xFF just for testing, but register value never changes.
If I do the same thing on ATmega328p the register does change.
If I upload the code to a physical processor it works.
If I use the same code on ATmega328p simulation in Proteus, it also works.
This looks to me like a Proteus model problem or bug.
Has anyone got ATmega32u4 to work with i2c in Proteuus simulation?
Code:
while(wait && (TWI_MTX == twi_state)){
continue;
}
It never gets past this.
Doing some debugging I verified that TWCR never changes in this model, so it is impossible to enable i2c, which is the cause of this hang.
I tried setting it directly, with TWCR=0xFF just for testing, but register value never changes.
If I do the same thing on ATmega328p the register does change.
If I upload the code to a physical processor it works.
If I use the same code on ATmega328p simulation in Proteus, it also works.
This looks to me like a Proteus model problem or bug.
Has anyone got ATmega32u4 to work with i2c in Proteuus simulation?
Last edited: