Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Silicon Labs] Add support for USBDevice #1287

Merged
merged 9 commits into from Aug 13, 2015

Conversation

stevew817
Copy link
Contributor

This pull request adds initial support for adding USBDevice capabilities to Silicon Labs Wonder/Giant/Leopard and Happy Gecko platforms.

There is one outstanding bug impacting this pull request:
#1284

mpolojar and others added 8 commits July 28, 2015 17:22
** Overview

This commit provides USB device-mode drivers for Silicon Labs chips.
The code is based on the SiLabs USB driver that is part of the
Simplicity dev environment.

Because Mbed USBDevice class wants to control the USB transactions
itself, large parts of the higher level code originally present in the
driver have been stripped out. An attempt has been made to keep Mbed
code separate enough that patches can be applied with minor effort, if
needed.

** Use of dynamic memory

Due to requirements imposed by the USB hardware, the driver needs read
and write buffers for every enabled endpoint. Since information on
what EPs will be used is only available during runtime, dynamic memory
allocation is used to minimize memory usage.

If needed, dynamic memory use can be disabled via a flag in
usbconfig.h. In this case, please read the documentation to see what
limitations this imposes. Static memory usage can also be reduced by
limiting the maximum number of active endpoints - see configuration in
usbconfig.h and USBEndpoints_EFM32.h.

** Power management

Driver supports the new SiLabs functionality in Mbed sleep(). Normal
sleep (EM1) is always available, and deep sleep (EM2) is available
when USB is either disconnected or suspended. How and when different
sleep modes are made possible can be configured in usbconfig.h

** Supported hardware

Current release officially supports, and has only been tested on Giant
Gecko. Upcoming releases will add support for other SiLabs platforms
on Mbed.
USB device support for Wonder, Leopard and Happy Gecko. See
details on configuration etc on the previous commit.

Known issue: USBAudio does not work reliably on Happy Gecko.
Everything should be copyrighted to SiLabs, and licensed
under Apache 2.0.
Zero Gecko has no USB support, so don't even try to compile for it.
Use correct function when resetting endpoint 0 (on stall etc)
on Happy Gecko.
No USB in Zero Gecko so removed also from here for the sake of clarity.
Happy only has 3 endpoints, so flag out the rest.
Happy Gecko's USB Low Energy Mode does not work properly with
isochronous endpoints.

Note that Happy Gecko errata USB_E112 states:

  Do not use the SUSPEND mode of LEMOSCCTRL in USB_CTRL.

  In rare cases with high data throughput, a transmission can
  fail when this mode is enabled.

  Use the GATED mode of LEMOSCCTRL for the best energy
  efficiency. The NONE mode can be used to disable energy
  savings

However, even using GATE mode causes problems for high-frequency
isochronous transfers. The primary effect for OUT endpoints is that
the first read will succeed, and the following one (targetting the
next frame) will fail with zero bytes incoming data, and PKTDRPSTS
is set in the related interrupt status register.

Disabling LEMOSCCTRL (set to NONE) solves the problem. Since this
will cause increased energy usage, do this only when an ISOC endpoint
is added.
@0xc0170
Copy link
Contributor

0xc0170 commented Aug 13, 2015

Thanks, LGTM

0xc0170 added a commit that referenced this pull request Aug 13, 2015
Silicon Labs - Add support for USBDevice
@0xc0170 0xc0170 merged commit 376d6a7 into ARMmbed:master Aug 13, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants