Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

ATmega32u4 i2c bug in Proteus ?

Status
Not open for further replies.

cyberponk

Newbie level 2
Newbie level 2
Joined
Feb 12, 2017
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
21
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:

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:

Although the variables suggests it as a possibility, I'm not sure if it is the reason; anyway, did you added pullup resistors at the I2C bus ?
 

I have 4.7 digital pull ups connected, but the thing is, the pins never get to change states in the first place, because I cant get the MCU to set i2c enable registers. SDA and SCL are always LOW.

ATmega16u4 has the same problem, but ATmega328p works fine, TWCR register can be changed and i2c works as it should.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top