ATMEGA2560-16AU TWI

Go To Last Post
7 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello,

intend to use TWI communication, added pull-ups ( 10k ) on SCL and SDA lines, DDRD = 0xFF, Vcc is 5V.

I am experiencing following problem with TWI: as soon as TWI starts; sending start bit; voltage  drops down to appr. 2 V, no further action on either line occures ( checked with oscilloscope ). I've measured the current on SCL line and does not exceed 400 uA, so I'm far bellow 3 mA.

The pins are not dead, as if I use them as output pins, they work OK, swinging between 5 and 0 V.

 

please advise me,

with regards, Branko

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

According to the I2C spec, 10K is a bit large for pull-ups, though that would not seem to cause your described problem. Normal is closer to 1.0K. 

 

How do you determine that the voltage only drops to 2V?

 

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Post your code.

Greg Muth

Portland, OR, US

Atmel Studio 7 (Version: 7.0.1652) on Windows 10

Xplained/Pro/Mini Boards mostly

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

For the test only, I've connected two MEGA processors, TWI works, so it's not the code that causes problem.

 

My project is to communicate with ADE7878A chip, which works on 3,3 VDC supply, therefore I've placed two optoisolators on TWI lines to avoid 5 VDC getting ADE chip. I enclose schematic for the SCK line as a example.

Enclosed are snapshots from the oscilloscope to show: PIN image shows toggling of PIND0 as a pin, TWI-STARTBIT shows what happens when TWI sends START. Have tried several values of the resistor R1, no improvement.

 

Branko

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

SCK and SDA are both open drain, bidirectional signals.  You can't use an optoisolator in this fashion.  The following schematic is from this application note:

 

Greg Muth

Portland, OR, US

Atmel Studio 7 (Version: 7.0.1652) on Windows 10

Xplained/Pro/Mini Boards mostly

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You can't use an optoisolator in this fashion

Agreed.  The 2V the OP is seeing is likely merely the forward voltage of the LED in the opto plus the drop across R1.

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"Read a lot.  Write a lot."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I thank everybody.

Will do as suggested,

Branko