Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

Feather 32u4 vs Metro 328P Program Storage Space
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Feather 32u4 vs Metro 328P Program Storage Space

by GoremanX on Thu Feb 06, 2020 11:00 pm

Was checking the specs on these two boards, and they seem identical as far as space goes. 32KB of flash and 2KB of ram. The only real difference I saw was a reduced clock of 8mhz vs 16mhz.

So how come when I try to upload the exact same sketch that loads and runs fine on the 328P, it complains that it's too big to fit on the Feather 32u4?

The Arduino IDE tells me the Metro 328P has 32256 bytes of available space. The sketch compiles to 26664 bytes.

Meanwhile, it says the Feather 32u4 has 28672 bytes of available space, and the sketch compiles to 29222 bytes (with absolutely zero changes)

This is confusing to me. Both the fact that the Feather has less available space despite having the same spec, and that the sketch compiles to a different size with no changes. This is especially aggravating because the original compile size would fit within the smaller space of the Feather 32u4, but the new compile size doesn't (even though it would still fit within the available space of the Metro 328P).

Is the boot loader bigger on the Feather? Does the sketch compile with a bigger library when switching boards? Would I have better luck using a Feather 328P instead?

GoremanX
 
Posts: 30
Joined: Sat Jan 04, 2020 6:42 pm

Re: Feather 32u4 vs Metro 328P Program Storage Space

by dastels on Fri Feb 07, 2020 10:44 am

The clock difference is that you are comparing the 5v 328 board. The 3.3v 328 runs at 8MHz as well.

The main difference between the two is that the 32u4 has on-ship hardware USB support, whereas the 328 uses an external chip for that. That has an impact on flash. From https://learn.adafruit.com/atmega32u4-breakout:

Another nice bonus of having USB built in is that instead of having an FTDI chip or cable (like an Arduino), we can emulate the serial port directly in the chip. This costs some Flash space and RAM space but that's the trade-off.


Dave

dastels
 
Posts: 3773
Joined: Tue Oct 20, 2015 3:22 pm

Re: Feather 32u4 vs Metro 328P Program Storage Space

by GoremanX on Fri Feb 07, 2020 10:48 am

Thank you, but that's not what I'm asking about at all.

GoremanX
 
Posts: 30
Joined: Sat Jan 04, 2020 6:42 pm

Re: Feather 32u4 vs Metro 328P Program Storage Space

by dastels on Fri Feb 07, 2020 11:52 am

You're asking why the 32u4 compiles to a bigger binary, right? Well, it's a different chip.

The available flash being lower reflects the USB stack taking up some of it.

The Metro/Feather difference is immaterial, those are just board form factors.

The Feather 328 should have behaviour comparable to the Metro 328.

Dave

dastels
 
Posts: 3773
Joined: Tue Oct 20, 2015 3:22 pm

Re: Feather 32u4 vs Metro 328P Program Storage Space

by GoremanX on Fri Feb 07, 2020 11:57 am

No, I'm asking why it has less available flash space despite having the exact same flash size.

GoremanX
 
Posts: 30
Joined: Sat Jan 04, 2020 6:42 pm

Re: Feather 32u4 vs Metro 328P Program Storage Space

by dastels on Fri Feb 07, 2020 11:59 am

The available flash being lower reflects the USB stack taking up some of it.

dastels
 
Posts: 3773
Joined: Tue Oct 20, 2015 3:22 pm

Re: Feather 32u4 vs Metro 328P Program Storage Space

by GoremanX on Fri Feb 07, 2020 12:03 pm

I don't think that's a good trade-off at all, especially since it impacts me negatively :D

So basically, as I asked in my original post, a Feather 328P would fix my issues? (in addition to costing a lot less)

GoremanX
 
Posts: 30
Joined: Sat Jan 04, 2020 6:42 pm

Re: Feather 32u4 vs Metro 328P Program Storage Space

by dastels on Fri Feb 07, 2020 12:11 pm

Agreed. Your code is close enough to filling flash that the lower amount available, along with the difference in MCU resulting is slightly larger code pushes it over.

You should see the same flash availability and use on a Feather 328 as on a Metro 328.

Dave

dastels
 
Posts: 3773
Joined: Tue Oct 20, 2015 3:22 pm

Re: Feather 32u4 vs Metro 328P Program Storage Space

by GoremanX on Fri Feb 07, 2020 1:32 pm

Thank you!

GoremanX
 
Posts: 30
Joined: Sat Jan 04, 2020 6:42 pm

Please be positive and constructive with your questions and comments.