ATMEGA Abnormal RX USART behavior if used 5V signal

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

Hi everyone,
To study the ATMEGA MCU, I am installing an ATMEGA168 on a breadboard. Power is supplied by a 9V battery whose voltage is stabilized at 5V by the classic 7805.
Now to make debugging easier, I thought of using the USART to display the values ​​of the variables through a serial connection through PUTTY. On my computer, I install an FT232 USB-SERIAL converter with FDTI chips. I know that if I set the FT232 to work at 5V the micro RX pin in addition to receiving data also starts to power the microcontroller.
Why this? I tried to understand from the datasheet dell'ATMEGA, but I can not give me an answer.
However, I have found that if I do so the FT232 works at 3.3V, then the microcontroller will not power, if not when it is powered by the 9V battery.

In the breadboard, I put a button to reset the micro, and in the code, at the start, a greeting is sent. So when I keep the FT232 connected and turn off the power from the 9V battery and press the reset button in the serial monitor, I see the greeting message, indicating that the microcontroller is powered by the RX pin.
I would be grateful if you can explain the reason for this behavior. I also tried to look in the Electrical Characteristics section, but I could not figure out why.
Consequently, components that communicate via serial with ATMEGA must have a working voltage of less than 5V?

If you need I could provide you a image of the circuit.
Thank you so much, and I apologize for any trivial question.

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

The protection diode on the RX pin is conducting. Look in the data sheet under PORTS for a picture of the internal circuit.

 

Using a 9v battery and a 7805 is not a really great power supply.  Might want to look at a simple 5v wall wart supply.

 

Please post a schematic as well.  I am sure there are other issues that we can find.

 

Cheers,

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

Last Edited: Sun. Jan 6, 2019 - 06:45 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

jgmdesign wrote:

The protection diode on the RX pin is conducting. Look in the data sheet under PORTS for a picture of the internal circuit.

 

Using a 9v battery and a 7805 is not a really great power supply.  Might want to look at a simple 5v wall wart supply.

 

Please post a schematic as well.  I am sure there are other issues that we can find.

 

Cheers,

Jim

 

Dear Jim,
first of all, thank you very much for your help and the indications you have already provided.
I am referring to the ATmega48A/PA/88A/PA/168A/PA/328/P datasheet updated to the year 2018.
Following your instructions, I should refer to chapter 14 of the datasheet (14 I / O Ports) and in particular to Figure 14.1. What I understand is that the protection diode deflects the voltage. However, I wonder if it is used (diverted) as a supply voltage for the microcontroller. However, this assumption does not find real feedback in the datasheet, at least as far as my current level of understanding is concerned. Also, I'm using a 7805 with a 9V battery because I'm experimenting with how to power a component based on atmega that cannot be powered by wall wart supply.
I try to publish the schematic, but notes that when my circuit is powered all function well, the anomaly is when I remove the 9V battery, in fact in this last case the microcontroller somehow remains powered by the input voltage to the RX pin, confirmed by the fact that the reset button causes the reset and the transmission of the welcome message, even if the power supply (9V) is disconnected.
I attach a simplified schematic. I have omitted the connections from FT232 to RX and TX pins.
As I said, if I put the jump on the FT232 to work at 3.3V instead of 5V everything works correctly. Reading the datasheet chapter 31.5.9 (Pin Threshold and Hysteresis) I observe that the Vih (the minimum voltage on an input pin that will be read as a logical high) is about 2.6V. Can this be what makes the RX pin working properly and prevents the protection diode from activating? However, if I understand correctly, does the diode deflect the voltage as a power supply for the microcontroller?

 

Schematic

Thank you so much

 

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

codabat wrote:
However, if I understand correctly, does the diode deflect the voltage as a power supply for the microcontroller?

Yes it does. Jim already told you this.

 

Why is this a problem?

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

codabat wrote:
However, I wonder if it is used (diverted) as a supply voltage for the microcontroller. However, this assumption does not find real feedback in the datasheet, at least as far as my current level of understanding is concerned.

 

Key part:

However, this assumption does not find real feedback in the datasheet

Really? From the datasheet, page 85, Section 14.1 it reads:

 

 

So as I said previously:

jgmdesign wrote:
The protection diode on the RX pin is conducting.

 

The Diode is connected from the pin to Vcc to prevent overvoltage, and another Diode is connected to the pin to ground for reverse/negative voltage protection.

 

FYI your AVR is not connected properly in your Schematic.  You MUST connect AVcc to Vcc, and all grounds.  Place a .1uf capacitor on Aref as well.

 

If you must use a 9v battery to power the circuit I strongly suggest you use a switching Buck Regulator as the 7805 will kill the battery before your circuit will and it will also get warm from the 4v it must absorb.

 

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

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

Hi,
No problem. In all honesty, I'm an expert in programming and in electronics I'm less knowledgeable, and I was doubting that I understood what Jim was telling me. In this regard, I quoted the parts of the datasheet that seem to indicate what Jim said, but for my non-great experience, I was afraid of not having understood well.
Thank you for your confirmatory intervention.
Thank you so much.

 

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

Hi Jim,

in the real project, AVCC and all ground are connected.
I thank you again for your speech and for having remarked the references of interest that I had mentioned. Excuse me a lot, but I'm now approaching this kind of knowledge and problems. My background is in the field of software design.
As far as external nutrition is concerned, I will take the advice you have given me into consideration.
Thanks for your support and patience. Was the reference I made to the Vih reported in datasheet correct, at the level of understanding of the problem presented?

Thank you very much
Cheers

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

The value you quoted is from 'typical' characteristics. You would not design to these values. Unlike software ,where everything is crisp - the value 2 is 2, hardware is somewhat different - nothing is crisp. Everything has a tolerance and may vary with temperature, voltage, from chip to chip and the phase of the moon.

 

The protection diode will conduct when the port pin voltage is approximately greater than 0.6V above VCC. As to why 3.3V levels don't cause a problem is strange as they too should power the AVR without a problem.

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

You may find this pdf tutorial helpful just google:  Intro to practical electronics microcontrollers and software

 

It has a lot of basic electronics as well as AVRs

 

Enjoy

 

Jim

 

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274
get $5 free gold/silver https://www.onegold.com/join/713...

 

 

 

 

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

Kartman wrote:

The value you quoted is from 'typical' characteristics. You would not design to these values. Unlike software ,where everything is crisp - the value 2 is 2, hardware is somewhat different - nothing is crisp. Everything has a tolerance and may vary with temperature, voltage, from chip to chip and the phase of the moon.

 

The protection diode will conduct when the port pin voltage is approximately greater than 0.6V above VCC. As to why 3.3V levels don't cause a problem is strange as they too should power the AVR without a problem.

 

Hi Kartman,

Really nice the similarity between software and hardware. Fun, but profoundly true!
Thanks again for your precious reflections. Also, to thank you, I am pleased to see that this is an amazing forum full of people not only very well prepared but also really willing to share knowledge. I hope one day to be able to reciprocate what I had.
I will do my best as you told me and I will try to deepen the 3.3V issue on the RX pin.

Thanks again for your further reflection.

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

Hi  ki0bk,
wow, thank you so much. It's a fantastic resource.
I thank you. I am pleased to see that this is an extraordinary forum full of people not only very well prepared but also really willing to share knowledge. I hope one day to be able to reciprocate what I had.
Thank you so much.