ATMega48PA clamping diodes

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

Hello there,

According to the ATmega48PA datasheet "All I/O pins have protection diodes to both VCC and Ground...".

In my case, I would like to use the PD6 (PCINT22/OC0A/AIN0), as the analog comparator positive input. The incoming voltage may be a negative value (ex. -2V). So, I would like to ask you if in the case of use of an alternative input function (like Ana.Comp, ADC), the internal clamping diodes are still connected or not. ???

Thank you.

Michael.

User of:
IAR Embedded Workbench C/C++ Compiler
Altium Designer

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

Pretty much every AVR datasheet says this under electrical characteristics:

Quote:
Voltage on any Pin except RESET
with respect to Ground ................................-0.5V to VCC+0.5V

So -2.0V is well outside spec.

Don't you just use an op-amp to bring the signal into range?

(but then what do I know I'm just a software engineer!)

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

As Cliff says, the AVR ADC will not accept negative voltages. What is the analogue range you wish to convert? In the simplest case you may be able to convert it with three resistors.

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#2 Hardware Problem? Read AVR042.

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

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

Could we exclude the ADC? It was my mistake to include this in the parenteses. My question stands only for the Analog Comparator.

The external circuit has like this:

100nF
square wave >---| |------->

The signal is a square wave with 1.5V (peak to peak).

When I measure after the 100nF cap (without connected to the AVR Analog Comp. input), the signal is an AC voltage with the lower level -0.75V and the higher +0.75V, as I expected. But when I connect the signal to the AVR ana. comp. input the signal is -0.2V (lower level) to +1.3V (high level).

Can you explain me why this happens ?

Thank you

Michael.

User of:
IAR Embedded Workbench C/C++ Compiler
Altium Designer

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

what about bias voltage on the other side of capacitor? It is difficult to current to flow somewhere without load. (of course it will find some in mcu anyway as you can see)

Computers don't make errors - What they do they do on purpose.

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

icarus1 wrote:

The signal is a square wave with 1.5V (peak to peak)...But when I connect the signal to the AVR ana. comp. input the signal is -0.2V (lower level) to +1.3V (high level).

The same limit applies to ALL AVR pins; they cannot go below 0v, or more accurately one diode drop below 0v. So your 1.5v pk-pk signal is now clamped to one diode drop below 0v which is what you see.

What, exactly, are you trying to achieve?

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#2 Hardware Problem? Read AVR042.

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

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

Brian Fairchild wrote:
icarus1 wrote:

The signal is a square wave with 1.5V (peak to peak)...But when I connect the signal to the AVR ana. comp. input the signal is -0.2V (lower level) to +1.3V (high level).

The same limit applies to ALL AVR pins; they cannot go below 0v, or more accurately one diode drop below 0v. So your 1.5v pk-pk signal is now clamped to one diode drop below 0v which is what you see.

What, exactly, are you trying to achieve?

So you are trying to tell me that even when using the Analog Comparator as an input, the internal clamping diodes are still active ?

Michael.

User of:
IAR Embedded Workbench C/C++ Compiler
Altium Designer

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

icarus1 wrote:

So you are trying to tell me that even when using the Analog Comparator as an input, the internal clamping diodes are still active ?

Yes, they have to be. Consider this...the comparator inside the chip is powered between 0v and Vcc. Therefore, the input range of voltages on its pins have to be within the same range.

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#2 Hardware Problem? Read AVR042.

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

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

Thank you all for your replies.

Best regards,

Michael.

User of:
IAR Embedded Workbench C/C++ Compiler
Altium Designer