Standalone Microcontroller

Status
Not open for further replies.
You can use the AT90USB1286 standalone... that's why Atmel is in business, and it's a great chip. You do need some more advanced skills and tools to work with the small TQFP package than to just plug DIP components into a breadboard, but it's certainly possible.

But one of the things that makes Teensy so convenient is the Teensy bootloader called "HalfKay", the USB program that sits on every board.

The bootloader is proprietary software, not open-source. The reason for that is because PJRC needs to be able to sell the products it creates, and if HalfKay were freely available, they would be crowded out of the market immediately by outside companies (largely in China) which copy his firmware to produce extremely cheap counterfeit Teensy clones without funding the work Paul does to design the hardware and software that makes Teensy good.

If you want the convenient features of Teensy, you have to buy Teensy boards from PJRC, and that's reasonable. Some people don't like the idea that there's any closed-source software in the product at all, but Paul's approach is a reasonable business model and he does basically give away all of the other software that he wrote for the Teensy -- including for commercial purposes -- but to protect his business against copies and counterfeits, he keeps HalfKay proprietary and closed-source.

If you need to reduce the per-unit cost of some product you're making by avoiding using the Teensy, then you'll have to do the engineering to replace what Paul's done to make Teensy worth using. It's not magic... you could write a replacement for HalfKay yourself. In fact, the existence of HalfKay, and the published protocol, and the source code for the PC side of the link would make it much easier than when Paul wrote it all from scratch.

Of course, you could always approach Paul directly and ask if he's interested in doing some of that work for you, either for a flat fee or for some royalty if it's a commercial product.

(No, I don't work for PJRC or speak for them, I just understand how the business works.)

By the way, in response to the link you mentioned, I might point out that one of the great things about all of the Teensy boards is that you can get the header versions and just plug the Teensy directly into the breadboard, just like you would a DIP ATmega328 as on the "breadboard Arduino". In other words, if your goal isn't saving a couple dollars each, but just using a breadboard more conveniently, just use the versions of the Teensy that have pins soldered on, and you're already there.
 
Dear OP
I'd think that being very price sensitive means volume production. What you call standalone is often called "bare metal" - meaning you design a board, or buy one with the bare minimum of capabilities and do your product design with great attention to BOM cost.

The non-recurring-engineering (NRE) costs, mostly for software, is high in a bare metal product, but if the volume will be high, the amortization base is large enough to cope with high NRE. But you have to assume some amortization base else the first 1,000 units will be too costly and create a sales catch-22, esp. if you are risk-averse or have no capital to invest. I suppose the new fad of "Kickstart" or "crowdfunding" helps with all this, IF you have truly clever wide-appeal idea.

A volume product with a low sell price would probably not have a bootloader for field use, for reasons of cost and counterfeit.

Otherwise, a product like Teensy gets the NRE way down and enables low or modest volume for a product, as well as hobby/student uses.
 
Last edited:
Hi! Thank you for the answer. I'm a newbie in eletronics, in learning process, I'm not interested in create a commercial product based on a "bare metal" Teensy microcontroller, I'm a hobbyst, if I create anything I would like to be open for anyone, but I would't like to force the people to buy a Teensy in order to reproduce the project, but make the use optional with schematics for Teensy, for example.

But the project I've in mind needs to send data through USB but actually I don't have skills and tools to create my own bootloader for a clean microcontroller, so, I'm thinking the best option for me is work with Arduino Leonardo ATMega32U4, that have a open bootloader or use a usb to serial ic and use the ATMega328 from Uno.

I understand the reasons this "Halfkay" is closed and I'll not question it, but this is one more reason to discard Teensy from my project and I'll save myself the right to think the Teensy would be better if it's open.

Thank you!
 
Last edited:
as you prefer! Since you don't plan to or need to alter the bootloader in whatever you choose to use, it would seem that you'd benefit from choosing the best if it doesn't bring a cost penality.
I suggest you are too hung-up on boot loader.. it's just a tool, like a hammer is to building a house. You just want to USE it and largely ignore how it was made.
Consider if you want anb ARM based Teensy 3, it being a significant step up in memory sizes for about the same price. versus an 8 bit AVR based micro. As a newbie you are, it can be easier with a low end ARM like the Teensy 3 becuase you do not need to learn and forever struggle with the two memory address spaces in AVRs (and PICs) - flash and RAM, and how the AVR/PIC "Harvard" address architecture complicated YOUR code and diverts from your rapid learning of C/C++ and so on.
 
Last edited:
OK, I understand better. You're not trying to shave a few dollars off. You're trying to have a handle on every component so you truly understand what you're creating. That's a reasonable motivation, but make sure you understand what the trade-offs are.

If you really like the ATMega32U4, the Teensy2 is a great Arduino-compatible controller that fits on a breadboard. I believe it's significantly less expensive than an actual Leonardo, and I don't believe the 32U4 is available in DIP configuration so anything you use will have to be on a board, rather than being able to wire something up from bare components on a breadboard like you can when you use an ATmega328.

You aren't required to use the Teensy HalfKay bootloader with a Teensy2. It's possible to use something like a USBTinyISP to program an ATmega32U4 using the ISP pins, but then you lose the HalfKay bootloader and won't be able to reload it. I believe that there was an open-source bootloader available that would speak the HalfKay protocol if you wanted to go back to using the Teensy with the Teensy Loader app in the future, but the open-source version takes 2K, rather than the 512 bytes that Paul's version takes (hence the name, HalfKay). It's quite an accomplishment that Paul was able to get a USB bootloader that runs in 512 bytes of AVR assembly, and that's one of the things that makes the Teensy2 so cool.

I also much prefer HalfKay and the Teensy Loader to the Leonardo bootloader. If you look into the details and try both, I think you will too.

I get the impression that you think the bootloader will keep you from programming the USB controller to do exactly what you want. On all of the Teensy boards, the bootloader only runs when you push the reset button (which I think should really be called the "program" button). Normally, when you power on the board, the bootloader doesn't run, so your code has 100% control over the USB hardware. PJRC provides sample USB code for making the Teensy board appear as several different kinds of USB device to the host computer. Am I making sense? The bootloader doesn't get in the way between you and the USB hardware. It stays entirely out of the way unless you press the programming button.

(The sample USB code does, if I recall correctly, notice when the Teensy Loader app is requesting a reboot into programming mode to make Arduino programming more convenient, but that's all in source code that you have access to.)

Regarding T3.1 vs. the ATmega32U4, there are benefits to using the ARM like in the T3.1, but I've also found that if you don't need the raw power, the T2 is nice because it runs at 5V and can provide 5V digital interface to other devices. It is also capable of sourcing and sinking a lot more current than the ARM chips. Also, the Teensy++ 2.0 still has more available pins than the T3.1.

I don't have any relationship with PJRC except that I've purchased Teensy boards from them, and I suspect that stevech is the same. I personally believe that the Teensy boards are about the easiest for beginners to use, while still being as powerful as anything you can get in the Arduino-style market segment... while simultaneously being just about the cheapest option. What's not to like?

OK, so I have the slight advantage that I happen to live within about 10 miles of PJRC and when I buy stuff from them and just pay for regular USPS delivery, I usually get it next-day, but that's just 'cause I'm lucky and they're so on-the-ball when it comes to shipping... :cool:
 
I've had a little look at the NXP LPC800 series of chips, ARM M0 based... The seem to be available in huge same DIP format as the ATMega328, which makes them ideal for the hobby user... No idea about the flashing them though... If Paul were to sell them as part of the Teensy range, I'd drop the ATMega328 like a brick :)
 
I haven't looked at the LPC800 series (ARM Cortex M0+) till you mentioned it... the LPC800 web page seems to suggest that the only DIP package is DIP8, which would be extremely limiting, but the SO20 package might be pretty easy to work with, since it has .05" pitch leads which should be easily hand-solderable for mere mortals (the TSSOP package leads are 0.65mm pitch!). Still need a carrier board to breadboard with it. I might be reading the page wrong but it looks like the SO20 version is limited to 16Kb flash and 4Kb SRAM... fine for a mass-produced special-purpose but not much for a hobbyist ARM chip. Also no USB on-board.

There's also apparently a DIP28 version of the LPC1114 (ARMCortex-M0), which looked very interesting a year ago:

https://www.adafruit.com/blog/2012/03/13/32-bit-meet-dip-arm-cortex-m0-in-dip-packages/

But... I haven't heard anything about it since then. Seems like people are pretty much ignoring it. Again no USB on-board. For some reason they chose a 0.6" wide DIP28 package instead of 0.3" wide like the ATmega328. Or maybe it's the memory limitations again... the DIP version seems to only be available with 32Kb flash and 8Kb RAM. Still, at 50MHz it seems like it would have been a nice alternative to the ATmega328.
 
When you develop your project using Teensy, the Arduino software ultimately creates a .hex file with all your code.

Those .hex files are not locked into Teensy-only use. You certainly can put that .hex file onto a bare chip. For AVR chips (the ones on Teensy 2.0 and Teensy++ 2.0), writing the .hex file directly to a chip is usually done with an ISP programmer. For the Freescale chips (the ones on Teensy 3.0 & 3.1), chip programming is usually done with similar products from P&E Micro.

I'm thinking the best option for me is work with Arduino Leonardo ATMega32U4

Suit yourself. Arduino Leonardo is very similar hardware to Teensy 2.0. Many people find Teensy's upload process simpler and easier than Leonardo. But if Arduino's product meets your needs, then great.

In the end, if your goal is using a "standalone microcontroller", all that really matters is ending up with the .hex file. Then you build or buy an ISP programmer that writes the .hex file onto your standalone microcontroller. In the beginning, you buy one or maybe two boards from PJRC or from Arduino or from a no-name clone maker (where not even 1 penny goes to support the people who made so much software to help you), or you make your own board from scratch if you like. In the end, you just buy the standalone microcontroller chips from an electronic component distributor and put your .hex file onto them.
 
Hi! The answer from PaulStoffregen is what I'm needing to hear...

The project I've in mind needs to send and receive data through the USB to read and burn EEPROMS with a small and limited board area. The microcontroller used in Teensy is so small with usb support dicarding the needs of a serial to usb ic (like ft232 used in arduino uno) and suits what I want to achieve, so if I can write the hex file directly to microcontroller using an ISP, to use the microcontroller standalone is exactly what I need.

Actually I don't have the skills to create an ISP, so can anyone point an option?

Thenk you in advance.

About clones... I always buy the original products from authorized resellers, it's why I wait more than 30 days to get my teensy++ 2. The Arduino I receive in 1 or 2 days because we have resellers in Latin America.
 
Last edited:
For working with a AT90USB part you might want to check out LUFA: http://www.fourwalledcubicle.com/LUFA.php

I have used that in the past with Atmel's old AT90 USB key, which IIRC used a AT90USB1287. The good about it was that it had a nice JTAG header, which was immensely useful for debugging the USB ISR. The bad about it was the non-standard header spacing, which was near impossible to find connectors for (IMO, they really shot themselves in the foot using non-standard pin spacing just to save a few pennies on board cost).

At the time I used it to make custom USB interfaces (odd stuff like a combo keyboard + mass storage device). I believe LUFA does work with AVR Teensy devices, and I think the author also had some custom bootloaders as well.

What it does not have (at least back when I used it) was the Arduino tie-in, so it was more working with the device at a low-level (although one could always port-in libraries as needed). Like Teensyduino it does have a huge set of examples though. It really is a great library.
 
Dean Camera and I have almost exactly opposite coding styles, which you'll see if you compare his LUFA library to my USB code in Teensyduino.

Many people love Dean's style, which involves extensive usage of custom types and structs and nicely named constants for pretty much everything. Dean's idea of readable code is creating really complete and thoroughly documented abstraction layers. Dean puts a lot of work into comments that create Doxygen-based documentation for the incredible amount of stuff he's defined. LUFA has hundreds of header files in 4 levels of directory hierarchy.

My idea of readable code could best be described as "minimal": fewer lines in fewer files is simply less to read. So I tend to use only basic compiler types, with numerical constants and hardware registers right in the code. I tend use only minimal comments referring to page numbers within the USB specs that document the meaning of specific constants. I have only a couple headers, pretty much only to declare the public functions.

LUFA does support pretty much all the AVR USB chips and there are examples for other USB types I haven't done. If you like Dean's coding style, LUFA might work really well for you.
 
Hi. Sorry for the newbie question... Could you please help me to figure out why the .hex file compiled by teensyduino 1.19 (even simple blink example) does not work on my old AT90USBKEY board? I've used this patch https://github.com/vanbwodonk/TeensyDuino-Patch-At90usbkey without success...
But I was able to achieve it using this package https://github.com/DynamicPerception/ArduinoAT90USB (even usb-serial works out of the box for arduino 1.5.3). If it would be possible, I prefer to use only Paul's Arduino add-on for my teensy3.1 boards as well as for at90usbkey. Thank you.
 
When you develop your project using Teensy, the Arduino software ultimately creates a .hex file with all your code.

Those .hex files are not locked into Teensy-only use. You certainly can put that .hex file onto a bare chip. For AVR chips (the ones on Teensy 2.0 and Teensy++ 2.0), writing the .hex file directly to a chip is usually done with an ISP programmer. For the Freescale chips (the ones on Teensy 3.0 & 3.1), chip programming is usually done with similar products from P&E Micro.

In the end, if your goal is using a "standalone microcontroller", all that really matters is ending up with the .hex file. Then you build or buy an ISP programmer that writes the .hex file onto your standalone microcontroller. In the beginning, you buy one or maybe two boards from PJRC or from Arduino or from a no-name clone maker (where not even 1 penny goes to support the people who made so much software to help you), or you make your own board from scratch if you like. In the end, you just buy the standalone microcontroller chips from an electronic component distributor and put your .hex file onto them.

Hi Paul, do you think that Teensyduino-generated hex files could be uploaded to a 32u4 (with the original atmel bootloader) using Atmel flip ?
Or within the Arduino IDE with an UNO as ISP or a similar programmer ?
 
Yes, it should work, if your code is under the 28K limit for Atmel's bootloader.

Teensy allows up to 31.5K.

ISP programming lets you use all 32K.

Teensyduino doesn't try to lock your hex files to the Teensy hardware. I fully understand many people want to make products where they'll mass produce their own boards. I'd like to ask you to also understand Teensy and Teensyduino really don't include any support for making your own board. Please, if you're using Flip or an ISP programmer and you need support, post on Atmel's avrfreaks forum, or contact Amtel directly, or seek support from whoever sold you that ISP programmer.
 
Status
Not open for further replies.
Back
Top