What uC would be an upgrade from the 32u4?

I've been working on a wearable project that's constrained in terms of size. For my prototype, I ended up using a Sparkfun Pro Micro (tiny leonardo clone) as the 32u4 chip was attractive in terms of capabilities, the Pro Micro form factor was small and convenient, and everything about it is open source.

Anyhow, I'm now at the stage where I'm ready to start laying out a custom PCB for the project, but I've hit a bit of a crossroads when it comes to the chip. Using the 32u4, I find I have several I/O pins available, and over 1/2 k of ram available, but I'm almost out of flash. I've had to remove the bootloader and removed all of the USB libraries, which kind of negates some of the advantages of the 32u4 chip. I could leave it as-is and stay with the 32u4 but there are a few more features I would love to add, if i had the program space to do so.

Now I am considering moving up to a uC with more flash (more ram is always great too) but I would like to stay within the Arduino IDE. I don't mind if I can't use a bootloader, I'm comfortable using an ICSP, but if I stay with a USB-enabled chip, I'd like to have enough room to include the USB functionality,at least include CDC functions.

I've looked at the AT90USB1286 that is in the Teensy++ 2.0 and that looks like a good option. Would I be able to use it though in the Arduino environment? Obviously it's there as the Teensy++ but I wouldn't be able to make use of that as this would be on a custom board and wouldn't have the Teensy bootloader. Or are there other options that might be just as good?

Due to size restrictions, I need to use something SMD but I'd be hand soldering it so the package would need to be something with the pins accessable, and not too crazy-small.

Thanks!

"I've hit a bit of a crossroads" Ha! I ducked! You missed me 8)

If I recall correctly, the Teensy++ 2.0 says it is Arduino compatible, and the www.pjrc.com all kinds of info on setting up for it.
I am looking at the chip for the same purpose, SMD on a custom board. Haven't looked into how to get the bootloader into it yet. Got the board designed, figure the next step is to do some more reading, and then contact paul@pjrc.com:

Teensyduino

Teensyduino is a software add-on for the Arduino, to run sketches on the Teensy and Teensy++!

Running Sketches on the Teensy

Most programs written for Arduino work on Teensy. All of the standard Arduino functions (digitalWrite, pinMode, analogRead, etc) all work on Teensy. Teensyduino is also compatible with many Arduino libraries.

Lol - you're too quick for me! :slight_smile:

I'm pretty sure the Teensy bootloaders are proprietary so it probably isn't available to be loaded on a raw chip / homebrew board. I wonder though if everything else would work on a 'raw' chip though, eg. install the Teensy add-on but write sketches using ICSP.

If not, I've been messing around enough that I'm fairly confident I could set up my own boards.txt entry and pins_arduino.h file to handle pin mapings. I'm not as confident however in my abilities to get the more detailed stuff right, like ADC, interrupts, timers, etc. (For my wearable, I'm running at 3.3v so I've got my 32u4 clocked at 8MHz and would expect to do the same with an alternate uC.)

Cheers!

Another candidate I'm looking at now is the ATMega644 or 1284 from the Sanguino. It's available in a TQFP44 like the 32u4, and has plenty of flash, ram, and IO. Instead of onboard USB it has a second UART, which would work just as well for me.

The 644, 1284, or even the 2560 would all give you more ram as well as more flash; however, none of them include the USB functionality. The Teensy++ uses an 90USB1287(?) so that chip may be of interest as well since it include the added flash your interested while retaining USB.

I would suggest you reexamine your need to get more flash, particularly, if your device is built with the Arduino environment. This is especially true if you make extensive use of libraries. The Arduino environment and libraries are designed to provide easy functionality. Efficiency and compactness are not part of their design goals. You could undoubtedly rewrite sections of your code, eliminate libraries by coding needed functionality yourself and eliminate any unneeded functions. All of this will free up flash. If nescessary you could recode parts in assembly to further optimize code size.

All of the previous may not be nescessary if your only creating a few of the items, but if your creating a lot of them, the additional development costs could easily be less than additional hardware costs associated with beefier chips.

A version of this

with a '1284 chip on one side an a USB/Serial chip (FT232 would be comparable in size, or go with even smaller leadless package) on the other could be made nice & small.

Thanks for the comments!

At this point I think I've all but settled on the 1284p as the way to go. Between that and the AT90USB1286, the main difference for me is dual UARTs versus one UART plus native USB. For my purpose, these are 'interchangable' and I am fine with using a FTDI cable instead of a plain USB cable - I don't need to add an FTDI chip to my project.

I've already stripped as much from my sketch as possible to keep the final size down, both in flash and in ram. I've gutted the libraries I'm using (adafruit oled, adafruit gfx, tinygps, time, etc) to remove anything I wasn't using. I've removed the bootloader from the Pro Micro, and disabled the USB libraries in the arduino core. With all that, my sketch is at over 29kB.

Adding back the usb libraries (CDC only, HID disabled) brings me up over 31kB and that's without adding the code to the sketch to actually utilize the CDC port. I could probably fit my communications code in there under the 32kB point, but with no chance of any additional features or functions down the road. This is why I reckon a larger uC would give me some elbow-room. :slight_smile:

The main reason I'm leaning towards the 1284p is that the Sanguino environment exists and has been around for a while, is open-source, and is easy to plug in to the Arduino IDE. That it is available in a TQFP-44 at the same size as the 32u4 is also a bonus, as it's a relatively compact size yet large enough that I know I can hand-solder that.

Cheers!

The Mighty1284 core files for the IDE are also working great in IDE 1.0.

Yes as another 1284 user (with several of CrossRoads' arduino variants) I think the 1284 is the most versatile of the AVRs, so long as you don't need native USB. It also happens to have the most built-in SRAM (16K) of them all. And available in TQFP-44 as you mentioned.

Not sure if you need this but after reading thru the datasheet I found that Timer2, one of the built in timers, can be clocked externally (and asynchronous to the main clock) by a slow crystal like a 32.768KHz watch crystal. Since you mentioned this is a wearable device I thought you'd want to know about that, you could implement deep sleep modes that are awakened at regular intervals by Timer2 (saving battery when nothing needs to be done by the software). Problem with it is Arduino doesn't natively support that with its millis() feature but that might not be a show stopper depending on what your sketch does. millis() will still work when the processor is awake.
(FYI I think most of the ATmega chips have this, it's not just the 1284)