ATMEGA32U4 - basic circuit power supply question

Dear Community,

I want to place the ATMEGA32U4 to my main board. With help of internet I sketched simple circuit for precise measuring of analog signal. I have 4.1V reference, analog signal and 5V supply. These parts are not important now. I want to have ATMEGA32U4 powered ONLY from external 5V supply, not from USB! USB will be only for sending measured datas to PC / Smartphone. Please can someone take a look on USB connection if this will work? I connected grounds together but I am not sure if USB power will work this way (external USB device must detect ATMEGA chip when connected). I will upload Arduino bootloader via SPI - hope this is correct.

I will be grateful for any advice.

Thank you.
UK

In general , i would say it looks ok.

However,

decoupling caps are missing . You need one 100nF cap at every voltage supply pin.
Also use a protection diode across the reset pin to protect against reverse polarity.
Make sure you 5V power supply i regulated and according to the datasheet specs

Thank you for your advice.
I added 100nF to each pin. I belive protection diode over reset pin is not needed because reset button is grounded.

unknow001:
Thank you for your advice.
I added 100nF to each pin. I belive protection diode over reset pin is not needed because reset button is grounded.

The diode is not a must but its a good practice. It protects the MPU from reverse spikes during the push button operation. If you have a look at the arduino micro schematic you will find one there as well as part of the reset circuitry.
If you are making a PCB for this item, it doesn't cost anything to include one.

Ahh ...you are right. I never noticed it.

I just completed the board but have one problem. All works like charm when I use Arduinos Serial Monitor (sending / receiving data over USB) but from my personal application I can only send data. I never receive anything. Did I need to configure USB port on ATMEGA32U4?

Thank you.

unknow001:
I just completed the board but have one problem. All works like charm when I use Arduinos Serial Monitor (sending / receiving data over USB) but from my personal application I can only send data. I never receive anything.

Not exactly sure what you mean here.
At first you say you can send/receive data on the serial monitor - This means all USB hardware is ok.

Then you say you cannot receive anything from your "personal application" ?
Can you elaborate further?

Hello,

yes I can elaborate the problem further. Arduino's Serial Monitor work well but not my own written application. It can only send packets to the Arduino. Messages from Arduino never come. Third party serial monitor shows that Arduino sends the packet, but "somehow" Atmega32u4 not "flag" these packets so my application never trigger reading. But any of standard Arduino products (Uno, Nano ...) work without problem with my application. So there must be difference between Atmega32u4 USB and Arduino's USB. Maybe some "secret" configuration I not find in datasheet ... dunno.

Any idea?

Thank you.

When you reffer to your application you mean tge arduino sketch?

So, for example a println statement does appear in your pc's seriql moniror or not?

Maybe you should post your code..

It seems your sketch is working as you could send receive data using the Arduino Serial Monitor.

When you replace this Serial Monitor with "your application" the problem is your application cannot receive anything.

We probably need more information about "your application".

I assume this will work fine with a terminal emulator (like terra term) as well?

Yes, third party Serial monitors work too. Only my application not with my own board with Atmega32u4. My application with standard Arduino boards work without problem. So Iam pointing to idea - Atmega32u4 must have "internal" setting of USB driver which need to be set. How is it than possbile that original Arduino works and not my own board which is "copy" of Leonardo. This is weird... Application and Arduino code is simple and 100% working ... I just need to bring Atmega32u4 to work like other Arduinos ...

Ive made dozens of home brew arduino micro compatibles and they behave just like the original micro but to be honest i ve never interfaced any of them with any other app besides the serial monitor when it comes to the usb port.

Looks like my Atmega32u4 not work well in case of USB. Tested again with Arduino Uno - my application work without problem and I see all incoming data. But Atmega32u4 sends the data too, but my application not catch them. So there must be the difference ...