2 MCU cool features
In this part of review i want to talk about Happy Gecko MCU itself.
Let’s check what we got here:
New USB controller. It’s device mode only with 3 + 3 endpionts, which means you can make up to 3 bidirectional devices (e.g. keyboard + virtual COM port + mass storage). You barely can put more functionality on such small memory device.
There is a good demo which implements 3 USB classes composite device.
Code compiled with GCC is 42K Flash and 4K RAM.
With optimisation for size it will be 26K and 4K respectively.
What is interesting there are 1.5K RAM for endpoints’ FIFO and dedicated DMA controller, so USB subsystem should consume a huge part of the die area.
There is 3.3V LDO build in with 50mA output, so you can power whole board from USB without external hardware.
USB should be capable to operate without external crystal, but I did not found a section about it in reference manual.
Basically MCU use Start-Of-Frame bits to tune internal RC oscillator.
The most interesting part of HG’s USB is a capability to automatically turn off clock while idle. It can save a ton of energy in low traffic application such as HID. And of course USB is connected to PRS and can generate interrupts on SOF.
For example in normal mode MCU will consume 7.27 mA as HID keyboard, but with low energy mode enabled it’s only 4.9 mA, good Gecko!
3 Fun project
So let’s do something fun! Writing reports are always boring and Happy Gecko wants to help us.
We gonna take USB HID keyboard demo from Simplicity Studio and modify it. Just open SS, connect the kit and press Software Examples button.
Choose usbdhidkbd and press finish. SS should copy all necessary files and open SS-IDE.
We should modify ScanTimeout handler to pass our own codes to PC.
PB0 will make COPY and PB1 will make PASTE.
descriptors.c contains all keyboard codes that Gecko should pass to PC.
You can find all of them on usb.org:
0x06 - is C, 0x19 - is V and modifier 0x01 is Ctrl.
Now copy-pasting should work.
Let’s also create a custom image, for this I will create 128x128 picture in GIMP and export it as .xbm
open it in text editor and you will see C array:
You can paste it into the code now.
Full project can be found here: https://github.com/uSasha/gecko_reporter
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.