Gbulmer, I have been working with some designs based on the pic18f14k50 and its 3.3v cousin the pic18lf14k50. They clock in at around 2.50 and come in a dip. I have samples of the new crystal free pic16f1455 which is ~1.50 both of these chips allow you to write a cdc-acm (like the cp2102) but also to customize it, allowing you to set boot0 and 1 and reset the chip.
Bootloader-less Designs
(39 posts) (4 voices)-
Posted 3 years ago #
-
feurig - Thanks for the comment, but I must report that I am an old computer scientist, and hence PIC's are 'not my cup of tea' ;-)
I admit something that would set the boot-pins and reset as well as do USB is very tempting.I am slightly surprised no one has done a 'V-USB' for the lowest-end ARM (http://www.obdev.at/products/vusb/index.html)
It drives me nuts that neither ST nor Atmel make a USB enabled MCU in a DIY friendly DIP package.
IMHO, if ST did STM32+USB in DIP, they'd probably get most of the worlds Computer Science and Electronics graduates trained up at college for 'free' (from my miniscule, un-scientific sample: some colleges don't use PIC, or are planning to migrate away, so a nice ARM with USB in DIP might be a 'no-brainer')
(Do you know of a low-ish cost Cortex-M with USB in DIP, that is available in small quantity?-)Anyway CP2102 will do for the lowest-cost end for now; ready-made USB to serial boards are about $2.
BTW a chum uses a Cypress 'EZ-USB' and gets USB high-speed (480Mb) connectivity, but that's an 8051!Posted 3 years ago # -
Trust me I share your bias towards the pics its a psychotic architecture at best. But the two I mentioned are best bang for buck out there in terms of programmable usb chips. I have done extensive work with the atmel usb chips which would work here as well. btw the lpc1114 comes in a 28 pin dip and clocks in at a $1.50 no usb though.
Posted 3 years ago # -
feurig - I understand the PICs have a lot going for them. I'm also aware of the LPC1114 in DIP, but USB AVR or USB ARM in a DIP package would get me more excited :-)
I was also pondering the 'soft' USB, which runs on AVR's for STM32:
http://www.obdev.at/articles/implementing-usb-1.1-in-firmware.htmlAFAIK, that handles 1.5Mb USB on a 16MHz AVR.
I have no intention of writing this, but it should be practical to re-implement that 'soft' USB, on a low-cost, USB-less Cortex-M.
On a low-cost STM32F051, running at 48MHz, and with DMA, it might even be possible to do it in C, rather than assembler.That's a project for the long winter evenings ;-)
An LPC1114 might be something to investigate, but where do you get them at $1.50? Mouser lists them at $2.58 at 25 off. That price is comparable to an STM32F with USB.
Posted 3 years ago # -
I was going to make it clear how I felt about Christian's software usb implementation but I thought It would muddy the water a lot. While it is clever I don't like using software and most of the processor where there is hardware that does the job, and the low end atmels dont get cheap enough to make a significant difference.
My feeling is that the usb component should be reduced to "devices" (components/modules) and that by tweaking on existing low cost chips like the mcp2200/pic18f14k (motorola er freescale makes a similar cost/class usb controller) and the corresponding software stacks we can get where we want without a lot of new development.
The thing that is really missing from the ide perspective is the implementation of something like the current Arduinos programmers.txt where you can specify different methods of loading code on the chip. This may be in the works with the next gen but it looks like we will have to wait for the remarkably absent maple folks to return before we can do more than speculate here.
The markup at Mouser and Digikey for the lpc1114 part is pathetic. I am afraid that if I tell you where I got mine for 1.50 the price might go up. (http://components.arrow.com/part/search/lpc1114FN28/102,12?region=na)
Posted 3 years ago # -
feurig
... While it is clever I don't like using software and most of the processor where there is hardware that does the job, and the low end atmels dont get cheap enough to make a significant difference.
99.8% agree:
1. I'd prefer to use the same processor family for all functions. I don't want to use PIC, and I'd prefer not to use Atmel AVR on a STM32 board if I can avoid it. Part of the idea is to make boards which are easy to use to make things, and using two tool chains raises the complexity.
2. Currently USB is a significant cost differentiator on STM32, so the price difference is relatively large, more than 2x. I don't feel any need to abandon STM32 otherwise, they have most things I want (The I2C is a bit naff, and I wish VDD and PA3 were swapped on the LQFP64, which would make tracking the PCB even nicer. I do like the look of Quad SPI Flash Interface on NXP's Cortex parts, but I don't really need it. STM32F/W are very good really :-).I agree, cheap USB-enabled MCU's do give enough benefit that they may be the best currently available solution. As you say, use as 'devices', which is easier to do with DIP, which can be pre-programed and handed to folks in kits.
The thing that is really missing from the ide perspective is the implementation of something like the current Arduinos programmers.txt where you can specify different methods of loading code on the chip.
Yes. I assume LeafLabs don't "eat their own dog food" and use the Maple IDE, or they might have fixed things like that.
This may be in the works with the next gen but it looks like we will have to wait for the remarkably absent maple folks to return before we can do more than speculate here.
Well, looking at the Wiring github, there are commits by mbolivar, so LeafLabs were doing something there.
LeafLabs announced they were Teaming up with Wiring more than a year ago. I had hoped improvements would arrive faster, but maybe it is even harder to coordinate work?
Thank you for the pointer to the LPC's (I've never used Arrow)
Posted 3 years ago # -
The think about the usb to serial with a few added handshakes (or usb-midi for that matter) is that once you have a working firmware its pretty well set and forget and you can blackbox it (protocol in pins out -- hence the module/component metaphor). I was just looking at the wiring last night and noticed that mbolivars commits are now 3 months old (an eternity in active development time) which would correspond to roughly when the entire maple team vanished without saying anything (not in the irc channel not on their own blog and not here in the forums)
I hope that this means they are hunkering down for the next big thing. It would be nice if they would pop up and give us a clue or two.
Mebby the teensy3.0 knocked the wind out of them. But like this that's another thread.
Posted 3 years ago # -
"A single USB device all the time" and using e.g. Flash drive (USB storage) for programming the flash while keeping the CDC serial would call for a USB composite device ...
What you describe is not "A single USB device all the time". What you describe is two different USB devices; a Flash drive and a CDC serial.
No, speaking USB, a composite device is one device with several different interfaces being activated all the time and at the same time. The different interfaces can bind to different drivers on the host computer.
Thanks for clarifying the motivation and scope of this discussion. I was reasoning more in the context of Maple boards, which are around 45 USD and the 1.60 less would not make much difference.
Gbulmer, I have been working with some designs based on the pic18f14k50 and its 3.3v cousin the pic18lf14k50. They clock in at around 2.50 and come in a dip. I have samples of the new crystal free pic16f1455 which is ~1.50 both of these chips allow you to write a cdc-acm (like the cp2102) but also to customize it, allowing you to set boot0 and 1 and reset the chip.
So now we are talking about adding a $1.50 chip to add the USB functionality we lose by saving $1.60? I must surely be missing something.
All in all, I think it will be difficult to find a one-size-fits-all solution. Between being easy to understand/tweak and easy to use, cheap and versatile there must be some compromises. However, it shouldn't be too difficult to have the GUI sense (or configure it) what kind of bootloader is present, and use for instance DFU USB or STM32 serial (via USB) to program it.
So to make a minimal cost STM32F0 board, I would go for a little header where you plug in your $2.58 CP2102 board to program it. I mean, practically nobody has a real serial port on their computer any longer, and you have to use USB one way or another. That the CP2102 board can be used for other purposes as well should make up for the cost of it.
Posted 3 years ago # -
tormod - Yes, the working assumption is programming and communications happens over USB.
For MCUs that don't contain USB hardware, I agree there must be some hardware, or the equivalent of v-usb (but I am not interested in writing that) to bridge that gap.
Yes a CP2102 would be fine. However it would be even finer if the USB to MCU board used a MCU, and were open enough for anyone who had an idea to take it, and modify it's code to do something different.
No, speaking USB, a composite device is one device with several different interfaces being activated all the time and at the same time. The different interfaces can bind to different drivers on the host computer.
Yes. Isn't that practically an 'academic' difference? It is more accurate, but doesn't appear to solve the problem, which is to program and communicate with very simple, low-cost STM32 boards from Windows/Linux/Mac.
I may be making too many assumptions based on two pieces of evidence. LeafLabs report their experience of trying to build a composite device which worked across the major platforms as very difficult. I worked with a guy who tried several ways to provide multiple interfaces. IIRC, though they succeeded, he also reported it as so much harder than doing a single device interface that it's extra utility was questionable. He was supporting more than the three basic platforms, but IIRC supporting Windows and Mac OS X was the hardest. He was building a device which needed USB programming + communications interfaces.
I am interested in something which:
a. Works across major platforms, Windows, Mac OS X and Linux.
b. Does not need any driver to be installed on any of those platforms for its normal day-to-day use; it uses the 'standard' drivers already installed. It is a significant problem for schools to install drivers across their PCs, and the Thin Client system I've seen can't have any new USB drivers added. I can accept something more complex when the board is first built.
c. Ideally, it should be sufficiently simple that folks could read and understand the code.So now we are talking about adding a $1.50 chip to add the USB functionality we lose by saving $1.60? I must surely be missing something.
The schools I know of use a separate USB to serial interface to program PICs. This reduces the cost enough to enable them to give children more opportunities to make stuff. The budgets are very tight.
IIRC, in the UK state schools, there are approximately, on average, 650,000 pupils in a cohort, attending for at least 5 years in secondary education. So saving a few dollars each time a pupil makes something with an MCU adds up!
Posted 3 years ago # -
tormod, ala42 - So what is the process for executing the bootloader from a running program?
Is there any need to manipulate the BOOT0 or BOOT1? What is its address?Posted 3 years ago # -
The BOOT0/1 pins stay in the normal boot position and are usually not touched. The running program sets a flag in RAM and resets the CPU. The CPU starts the code at the bottom of memory, something like the maple boot code without the ability to flash, which looks for the flag and jumps into the CPU built in boot loader, so I do not need the reinvent the wheel to implement a flashing protocol. If the flag is not found, the main program is started.
I let this dummy boot loader (dummy, as it does not load anything) flash the LED a few times to get a alive sign and also issue a USB disconnect, as the built in USB boot loader is not detected by the host OS without a disconnect.
I set the flag in the USB receiving library code, like standard libmaple does, but you can do that anyway you like. Currently I look for DTR and some bytes on the virtual com port, but might change this to react on a baud rate change.
The advantage of a small boot code at the bottom of memory with a F4 CPU is that you can use the small flash rom pages at the bottom of memory for eeprom emulation and have the main program at a higher address, where the larger pages are located.Posted 3 years ago # -
ala42 - Okay, I think I understand; the manufactured-in, System Memory bootloader is NOT mapped to 0 (by setting BOOT0=1 and BOOT1=0)
So my question is; when you say "... and jumps into the CPU built in boot loader", what address does it jump to, i.e. what is the address of the start of ST's manufactured-in, System memory resident, bootloader? Is it start of System memory at 0x1FFF 0000?
Posted 3 years ago # -
See https://github.com/AeroQuad/AeroQuad/tree/development/Libmaple/maple-bootloader
#define BUILT_IN_BOOT_LOADER ((u32)0x1FFF0000)
if(*START_BOOT_LOADER_MAGIC_ADDR == START_BOOT_LOADER_MAGIC) { connectUSB(); *START_BOOT_LOADER_MAGIC_ADDR = 0; jumpToUser(BUILT_IN_BOOT_LOADER); }
IIRC the F1 boot loader starts later, maybe 0x8000 later.
Posted 3 years ago # -
Tormod
"So now we are talking about adding a $1.50 chip to add the USB functionality we lose by saving $1.60? I must surely be missing something."
You are missing modularity, configurability and the ability to change class. (though you argue for modularity right after this statement)
The cp2102 (like the ftdi232) is a 1 trick pony. You cant, without considerable difficulty, get it to select one of the 3 boot modes on the stm32 when resetting the target device and you cant get it to change usb classes to say midi or hid which you can with the programmable devices.
Posted 3 years ago # -
http://www.bugblat.com/products/cor.html
So we are as backwards as we were with the arduino 6 years ago when we were arguing about how stupid the $4 fdti was and the arduino team got all conservative and pushed the status quo (and 3 years later pushed two designs that were our point exactly (the leonardo and the uno)).
Here. An example of a commercial design a missing the same thing.
Posted 3 years ago #
Reply »
You must log in to post.