Happy Gecko starterkit review part 2

by <a href="http://community.silabs.com/t5/Welcome-and-Announcements/Community-Ranking-System-and-Recognition-Program/m-p/140490#U140490"><font color="#000000"><font size="2">Ninja</font></font> </a> uSasha on ‎09-03-2015 04:02 PM

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.

Capture.PNG

 

With optimisation for size it will be 26K and 4K respectively.

Capture1.PNG

 

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.

Capture2.PNG

 

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.

Capture4.PNG

 

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.

Capture4.PNG

 

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:

http://www.usb.org/developers/hidpage/Hut1_12v2.pdf

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

Capture5.PNG

 

open it in text editor and you will see C array:

Capture6.PNG

 

You can paste it into the code now.

Capture6.PNG

 

 

Full project can be found here: https://github.com/uSasha/gecko_reporter