Hey mbed people!
I am developing a PCB with the LPC11U24. According to the LPC11U24 datasheet, if high-speed USB connectivity is not needed, one can configure the chip to use the 12 MHz (+/- 0.12 MHz) Internal high-frequency RC oscillator (IRC) as a system clock, thereby eliminating the need for an external crystal on the PCB! This is very interesting, because it means with very few parts (and potentially using just the online compiler) some really cool stuff can be built!
So here’s the BIG question to the mbed people: Does the mbed online compiler support configuring the LPC11U24 to simply use the IRC as a system clock instead of the external crystal? If not, would it be possible to add some sort of compiler flag to signal the online compiler to do so?
From a hardware point of view, it appears it is simply a matter of grounding XTALIN and leaving XTALOUT floating.
Finally, perhaps it works right out of the box, but it isn’t clear to me if the LPC11U24 hardware automatically falls-back to the IRC if the external crystal if it not connected.
Many Many thanks to any insight that can be provided!
PS I am aware that I would have to load the firmware onto the chip using a tool such as flashmagic over UART since USB bootloading is not possible without an external crystal
Is this what you mean? (sorry if its still sideways) :
To make this work I had to get Dan and his team to make change to the online compiler so that the binary produced already has the vector table checksum inserted
In my example I am using the crystal that you're trying to design out, so I can't answer your big question from experience, but it seems plausible. We'd be unlikely to add this as a feature to the compiler, but it should be possible to do from the program.
The only word of warning I'd give it is to be careful, as you can make your mbed unresponsive. Here is how to recover if you do manage to brick your mbed : Unbricking your mbed
However, I can confirm that this is indeed the case :-)
This is very interesting, because it means with very few parts
(and potentially using just the online compiler) some really cool stuff can be built!
Hey Chris, I really appreciate your reply. The awesome built-in USB bootloader and the video to prove it is very welcoming (I'm sure to many more than just myself). I was curious if the online compiler dealt with the vector location 7 (as per pg. 368 of the manual rev. 3), and you have confirmed this to be true! Great!
As you have demonstrated, it is relatively painless to get my *.bin file into the bare-bones LPC11U24 using the built-in USB bootloader so long as a crystal is attached to the LPC11U24 during the bootloading session (since this is required for the built-in bootloader's Mass Storage Device as per the LPC11U24 manual).
However, do you have any suggestion as to what code would be required to prevent/override the mbed-online compiler from configuring the LPC11U24 to use the crystal in the *.bin file that is generated? I realize if this were a full mbed, and not a bare-metal LPC11U24 as is in my case, bricking is a danger.
You mentioned it should be possible to configure the clock from within my user program... but if there is no crystal on my final product, I don't see how the execution will ever reach my main(), since I assume, by the time my main() function is called, the mbed libraries will have already configured the LPC11U24 chip to use the [non-existent] crystal.... thus freezing up execution. Does this make sense? Have I missed the way away around this problem or do I have to move away from the online compiler?
What pins did you use to enable USB Boot Loader?
I have looked through LPC11U24
Datasheet, but cannot find info.
I want to use the 48 pin device in a new PCB i am about to start today.
Sorry, I have just spotted the lack of reply to your questions. I am pretty sure I typed one out at the time, not sure what happened.
You are of course right, with no crystal the program will not get as far as executing the user code that switches the clock source. I've seen it done in mbed program, but because the crystal is there, the program executes. I'll have to have a think about this, as it is bordering on the "special use case", i.e. how do we enable people to do this without confusing/inconveniencing those who just want to use mbed as-is.
I'll get back to you (this time in less than 20 days!)
Its a little hidden in the "Programming Flash" section, under the ISP stuff. basically, as part of going into ISP mode, in P0.3 is sampled. If it is high the mass storage boot loader starts, if it is low the serial port boot loader starts.
For fun I have attached the PDF of the schematics, and the Eagle sch/brd for the little PCB from that video. It may or may not be useful!
Chris, thanks again for the update.
Basically, here's my pitch:
1. Step one is to prototype like crazy with mbed. In my case an app that uses many pins, and no built-in USB
2. Once the prototype is ready... Deploy a custom PCB with the LPC11U24 chip and a *ridiculously low part count* since the 12mhz crystal and two 18pF caps could be omitted (in small quantities this saves nearly 50%)! I got a basic running app with only 2 bypass caps on the LQFP48 using the built in oscillator thanks to this helpful post which got me started :
blinky example from NXP code bundle for LPC11Uxx.
No mbed library used
Last commit 28 May 2012 by Alexan E
The above blinky code does not use mbed libraries at all therefore I was able to configure the app to use the internal oscillator... BUT... for a real-world app, it means we'd have to start allllll over again since none of the basic mbed library functions would be at our disposal (a bad thing)!
Of course, if the mbed source code was open then it would be very easy to make our tweak... but I'm not sure your plans are with that, so in the meantime I'd like to suggest a cool way the LPC11U24 could be configured to use the internal oscillator without "hurting" anyone. It would require a small update to the online compiler, and perhaps the creation of a very basic page in the Handbook called "advanced compiler options":
Imagine a flag such as this at the top of the main code file in the online compiler:
// tell compiler to configure LPC11U24 for IRC clock source
#define MBED_COMPILER_FLAG_LPC11U24_USE_INTERNAL_OSCILLATOR 1
// and the business as usual
This [presently fictitious] flag could signal to the mbed compiler to configure the clock for the internal oscillator. Such an option could even perhaps pave the way for future configurations enhancements that cannot be set in user code (I actually can't think of any right now but I seem to remember some stuff from the forums).
You could even have a built-in NOTICE in the compiler messages when the flag is spotted: "LPC11U24 clock configured for IRC (internal RC oscillator)! Proceed at your own risk!"
The LPC11U24 is a great low-cost chip with plenty of processing power for tons of embedded applications... The only downside of using the internal oscillator means no high-speed USB (including built-in USB bootloader as per the manual, which means traditional UART ISP applies). But for embedded applications, you could be some ridiculously awesome stuff with basically 1 chip and 2 bypass caps.
A picture is worth 1000 words:
PS ok I'll spill the beans: Imagine driving 4 low-cost 8x8x3 RGB matrices (that's 768 individual leds) with full PWM colour, realtime communication, and awesome frame-rate... with only 1 LPC11U24, two bypass caps, a few source and sink drivers, and clever matrix programming.
Thanks for the last post. Like the pitch, especially that you've pitched the dream in TechniColour.
There are fixes possible in the short term, probably different ones in the longer term, so we'll have a think about how to proceed. WE'll be right back...
As promised, here is a solution to the problem you are trying to overcome.
Patching functions and libraries
I have written it up as a notebook page so that it can become a bit of a reusable app note.
Hope this helps!
bare metal LPC11U24:
USB connection,(3 resistors, 2 Caps., 1 FET)
two small switches.
I used USB, with crystal to programm,
One flashing LED :)
Need to verify speed/frequency, but I think it is close.
If I get a chance later, then I will try programming with RS232 !!
Using the IRC should be enough for low speed USB, which is what I assume the boot loader uses. If you want to do faster USB,then an proper crystal is required.
Hi Guys, I have only tested the chip crystal-free using UART-based ISP. For the USB-based flashing utility based on the mass-storage controller, the manual seems to say you need a crystal (from page 370 of the UM10462 LPC11UXX manual):
The LPC11Uxx is enumerated as a Mass Storage Class (MSC) device to a PC or another embedded system. In order to connect via the USB interface, the LPC11Uxx must use the external crystal at a frequency of 12 MHz. The MSC device presents an easy integration with the PC’s Windows operating system.
Perhaps you'll get lucky and it will work without, or perhaps the manual is wrong :) Let us know if it works!
USB Flash Disk (DFU) :)
Flash Magic, with lower baud rate NO CRYSTAL !!
hope this inspires you
can You please write more about using DFU method? Do You need any software on PC?
The very short answer. is no software,
Reset and ISP switch,
and one more pin on micro pulled Hi ( for DFU)
All you need to do is come out of reset with ISP low, and DFU Hi, you get a new drive in Windows,
delete the file, replace with. MBED file from compiler,
Hope that explains it.
will try and post photo later .
So you were able to have the LPC11U24 show up as a drive in windows, and there is no crystal on the board?
with crystal, I had a drive for re-flashing ,
but with no crystal I needed flash magic.
must admit did not try because I am 98% sure you need crystal for DFU
OK cool... I was able to do exactly the same as you. UART/ISP (via flashmagic or similar) without crystal at 115200 bps (the max "official" supported baud although I got it up to 150000). With the crystal, the virtual usb-disk shows up in windows. Yes, you have to be careful about the VBUS pin, ISP, and reset. The order is important :)
a fix for you might be to add a pad for X-in.
and squirt 12Mhz in from function generator or clock module.
that will keep your piece part price low, but no field DFU
thank You for Your answer. I have idea of little board with USB connector to be USB RAW HID device with some digital I/O. My idea is use slide switch on side of board to select its operation - - > If I connect device (USB powered) with slide switch in one position device will act as USB RAW HID and will be processing program. But If I connect device with slide switch in second position device will boot up as USB DFU to get new firmware on.
I would like to ask You if this is possible with such slide switch because I would like to avoid ISP RST buttons combo on my board.
I am getting ideas from LPC11U1x/LPC1343 Cortex M0/M3 Microcontroller Breakout Board at http://github.com/Squonk42/USBug with PCB layout and such. In schematics is written "R3/R5 will cause the bootloader to boot into USB/MSC
mode if USB is connected, and into UART/ISP mode
So do I understand that if when I plug my dreamed board to USB port and VBUS pin is set high LPC11U1x will switch to DFU? And when I connect my board with VBUS pin low device will operate in normal mode and process code? I feel I will need to set high or low ISP pin and/or RST pin on power on too... Or am I missing something?
So biggest question is: Am i able to swith between DFU and normal program execution with just one slide switch or do I absolutely must accomodate ISP and RST switch too? Board will be only USB powered so my idea is that I reset board via unplugging board from USB.
I am sorry of my chaotic questions but I am not good in hw and components.
Just did a quick test,
DFU/USART pin set to USB,
ISP Switch pressed down,
Plugged in USB cable, (causing a reset, on power up)
Ha-Presto CRP Disabled drive with firmware.bin in it ..
you will be able to do this with just one switch/button
Just remember to put it back to HID after.
.. Recomend a press switch :)
do You mean that when I press and hold button while connecting board to usb to get programmed and when connecting board without button being held board will run program and act as Raw HID? This is very clever!!!
But now I have big question. I want to order some parts but I am not about minimum parts I need to run LPC11u24 chip to get run with USB working.
I am designing my first little board based on http://github.com/Squonk42/USBug. But before ordering all smd stuff according to BOM of board I want to try some experiments with LPC11u24 and minimum through hole stuff.
So I am looking for any LQFP adapter to house micro and rest I want as through hole stuff to be able run some quick experiments on breadboard. I also have chosen 12 MHZ crystall.
In post above there are mentioned bypass caps but I am not sure about their values. Can anybody tell me minimum parts I will need to run quick tests?
This is MY test board,
LPC11u64 12 Mhz crystal, with 12 or 18 pF caps (depends on crystal)
1*10nF decoupoling cap (far right)
3V3 regulator + 2*100nF Caps
4 0402 LED's
if you hold down ISP Button, puug in USB = Mass Storage,
just plug in USB = HID Device :)
Thank You Ceri, this helps me very much. I am going to find and order such parts. Thanks again for very quick reply. I will post some news how I am going in future.
Hello Ceri, I want to share my progress for own lpc11u24 board. I ordered lpc11u24 in LQFP48 package, LQFP48-100 pin adapter, 12 MHz crystal, 3v3 voltage regulator and caps as You mentoied.
I also ordered all equipment for soldering as mentoied here http://youtu.be/J5Sb21qbpEQ and followed instructions here http://youtu.be/b9FC9fAlfQE by EEVblog.
I must say that I had some little experience with soldering but not much. What I did not expect was so quick progress. I soldered this 0.5 mm pitch package so easy I could not believe.
I checked for bridged pins with multimeter to be sure.
Adapter I got was 1 layer board so I soldered all headers from other side and board sits on table chip facing down:o(
Also voltage regulator I received was too small to fit on breadboard so I power my board from mbed.
By datasheet I determined which pin equals on mbed and my 48 pin package and selected p20 and p22.
I wrote program to blink Leds attached to these pins. It was like a magic. After loading program to newly recognized "flash disk" and restarting board, leds started to blink!!!
I also tested HID example successfully.
I got working my own LPC11u24 chip for first attempt so I am pretty happy with it!!!
As I succesfully passed first stage, I plan to write notebook page following my progress in creating my dreamed USB HID board.
Nice to see more peapole are gettint thair hands dirty :)
does this mean you are going to get a PCB made ??
a whole bunch of new chalinges.
Yes, I want to get made PCBs I will design in next stage of project for me and my friend. My design will be based on project I mentoied earlier mainly for schematic and components placement but I will change rest to my needs. I hope this stage will be successfull too.
Hi Guys, I am glad to see lots of people working with the 48-pin version of the LPC11U24. Indeed, it is really a simple setup! I just wanted to point out to those of you building PCBs of a potential mistake on the official mbed schematic. Since I don't want to double post, you can read my bug report here. It is not a very substantial bug, and your boards will most likely work anyway, but I'm still waiting to hear back from @mbed on this for their official recommendation.
Please log in to post a reply.
mbed, the fastest way to prototype with ARM based microcontrollers.
^ back to top