ATmega32u4 Design Review

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

This is the first time I'm using the ATmega32u4 in a design.  I've been looking at a few reference designs and I think I have everything correct, but I wanted to check here and make sure there's nothing egregiously wrong with the crystal/supply/USB portions of the design.

This board is basically an alarm for a pressure sensor with some buttons and a display to set the alarm conditions.

I included an ISP header just in case, but I want to be able to program this board via USB as an Arduino Leonardo using fresh ATmega32u4s from Digikey.  My understanding is that I want the non-RC version as they come with Microchip's preprogrammed bootloader.  In this case I should have an external 16MHz clock, right?

 

Attachment(s): 

Last Edited: Thu. Jul 2, 2020 - 03:51 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Connect VBUS from the USB connector to VBUS of the 32U4 (or connect VBUS of 32U4 to +5V).

It appears you have left off several power and ground pins:

23 (GND), 34 (VCC), 35 (GND), 43 (GND), 44 (AVCC)

These must be connected and should have 0.1uF bypass caps as close as possible to them.

 

If you want to have a RESET jump to a Bootloader, I usually put a 1K resistor to GND on the HWB pin (33).

This way, when power is applied, the uC jumps to the application, but the application of  RESET with power already on will jump to bootloader.

 

Edit: (I burn my own bootloader that programs via USB.)

David (aka frog_jr)

Last Edited: Tue. Jun 30, 2020 - 01:35 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Should there be a 5V supply (or does it always require a USB cable)?

What values are D3/4/5?  (need at least >5V)

Give yourself TX AND RX ...now is the time to do that !!

Some buzzers can take a lot of juice...may want IO to a gnd controlling transistor.

It would be nice if your AVR symbol had more extensive naming like PF0/ADC0  PD5/TX0 (or whatever it is)

 

C7/8/9 might be a bit heavy, for a 50k pullup (slooooow), maybe 0.1uF better.  Do the real debounce in software....you don't really want creeping levels.  

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

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

try to put all the segments on one port, that will save you a tremendous amount of code and work.

you might also try to get a 2,56V reference that .

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

Spare pin?

You might want to route it to pads for a resistor and an LED.

You don't even have to install them on the PCB, but often when bringing up a new board I find it helpful.

You can flash the LED to verify that you have the Fuses set correctly for the external Xtal, or turn it on when you enter an ISR for debugging, etc.

 

Check on the 22 pF caps for the Xtal.

The value depends upon the specific Xtal you use.

22 pf will likely be fine.

Lately I've found that I've been ending up with 15-18 pF caps, (not a big difference).

The point, however, is that that shouldn't be blindly copied from a reference design, it, at least in theory, ought to be specifically determined for your specific Xtal.

 

Good luck with your project!

 

JC

 

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

DocJC wrote:
Spare pin?

You might want to route it to pads for a resistor and an LED.

You don't even have to install them on the PCB, but often when bringing up a new board I find it helpful.

+999 !

 

See this thread for a whole load of other tips on how to make a testable and debuggable design:

 

https://www.avrfreaks.net/forum/how-do-i-check-life-signs-scope-atmega2560-standalone

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Connect VBUS from the USB connector to VBUS of the 32U4 (or connect VBUS of 32U4 to +5V). 

Fixed, thanks. 

It appears you have left off several power and ground pins:

23 (GND), 34 (VCC), 35 (GND), 43 (GND), 44 (AVCC)

These must be connected and should have 0.1uF bypass caps as close as possible to them.

They are connected, they're just not shown on this Atmega symbol.

Last Edited: Wed. Jul 1, 2020 - 11:19 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You can flash the LED to verify that you have the Fuses set correctly for the external Xtal, or turn it on when you enter an ISR for debugging, etc.

I've got access to a scope, so I don't need the visual indication, but I'll definitely break out some of the unused IO to some empty through hole pads. 

Check on the 22 pF caps for the Xtal.

The value depends upon the specific Xtal you use.

22 pf will likely be fine.

Lately I've found that I've been ending up with 15-18 pF caps, (not a big difference).

I ended up switching to this ceramic oscillator which takes up a bit less space.

 

My main remaining question is, will I be able to program this board over USB without setting any fuses first?

Last Edited: Thu. Jul 2, 2020 - 01:27 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

My main remaining question is, will I be able to program this board over USB without setting any fuses first?

 

see here:

http://ww1.microchip.com/downloads/en/DeviceDoc/doc7618.pdf

 

From the description (see section 3), it appears you have to change a fuse or isp some code that calls the boot loader, to use the bootloader.

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

Last Edited: Thu. Jul 2, 2020 - 04:38 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

I ended up switching to this ceramic oscillator which takes up a bit less space.

Why save a little spit of space to start off with a possible 0.5% inaccuracy (or 0.6% is using pins 1 & 3).

Then toss in 0.2% for temperature drift and 0.1% for part aging & you've arrived at the winner's circle.

 

Don't you have a fairly large display? 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!