Skip to content

[Silicon Labs] Add support for the new EFM32 Pearl Gecko #1501

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

Merged
merged 111 commits into from
Jan 15, 2016

Conversation

stevew817
Copy link
Contributor

Rebased & opened a new pull request.

New release of the Silicon Labs HAL for mbed.
Changelog:

  • Added HAL support for the new EFM32 Pearl Gecko kit
  • Updated PWM implementation to be more in line with the expectations regarding how a PWM waveform should look
  • Pulled up the included version of emlib to the latest (4.2.1)
  • Code cleanup throughout the entire HAL
  • Updated linker scripts to reflect the correct sizes for interrupt tables

mpolojar and others added 30 commits January 12, 2016 17:00
Leopard Gecko used as baseline.

TODO

 - Peripheral/GPIO pin mappings etc for Pearl are marked "Pearl ok",
   rest are wrong

 - Missing new (4.1.0+) emlib
New version with support for Pearl & co.
PWM pin mappings. Since the pins can be freely chosen (unlike
in previous HW), there should be no need to use the other channels.

Also corrected frequency for HFXO in ref devices.
Pearl GPIO block does not support DOUTSET/DOUTCLR,
so use read+DOUTTGL instead.
Use RTCC API for lp_ticker on Pearl. Basic adaptation, but more
work is required.

Now frees RTC when ticker is not used (detected through interrupt
disable), so that sleep modes below EM2 do not remain
permanently blocked.
Removed DAC/AnalogOut, I2C1, UART0/1, LEUART1, USART2,
GPIO Drive support and GPIO port E.
ADC pinmap updated, PinMap_DAC removed, since DEVICE_ANALOGOUT not supported
Mbed needs to have interrupt vectors in RAM so reserve space at
the beginning of memory, and export the relevant symbols.
Normal UARTs not present, use USART.
Use new ROUTEPEN/ROUTELOC0 registers for selecting I2C pins.
Conditionals for including em_rtc.h and em_rtcc.h.
Use the correct interrupt name in RTCC code.
LDMA support for the dma_api module
analogin_api.c changed to make it compile.

Compilation error will be generated if _ADC_SINGLECTRL_POSSEL_MASK ||
_ADC_SINGLECTRL_INPUTSEL_MASK is not defined. This is because NEGATIVE
voltage measurement is not supported by MBED API.
Serial pin routing for Pearl. Note that this currently requires
the pins to be in the same "location", even though this is not
needed by the Pearl HW.
LDMA support for serial HAL. Adds callback support for emlib LDMA
code so that most of the old serial code can be reused.

Note: Serial shows some signs of life on the bus, but DMA mode
is completely untested.
Channel selection shifted to right place. Now It seems to work
at least with channel PC11. Weird thing is, that floating pin gives
result 0.4. Should be 0.0.
Any channel can be used. It is possible to have 4 pwm outputs
active at a same time, if PinMap_PWM configuration is done properly.

Future improvement proposal: dynamic channel selection!
LDMA now functional for both RX/TX.

One hack remains - need to check if TXC interrupt check can be
removed from older platforms, or if flagging is necessary.
GPIO pins were uninitialized. Fixed and tested.
Correct routing for SPI pins on Pearl
SPI dma forced to compile. Continuing improvements...
Number of interrupt slots reported by different files before this commit:

            giant  happy  leopard  pearl  wonder  zero
spec        39     21     39       34     39      17
nvic        39     21     39       34     40      19
startup.s   39     21     40       34     40      19
gcc link    40     21     41       34     40      19
arm link    40     22     40       -      40      16
reserved    0      0      1        0      0       2

  spec - reference manual
  nvic.h - cmsis_nvic.h
  startup.s - assembler startup files
  gcc link - efm32*.ld linker script for GCC
  arm link - efm32*.sct linker script for ARM (RVCT)
  reserved - number of 'reserved' slots at the end of irq table in startup.s files

Fixed amounts to reflect those in the startup files, including reserved
slots:

Giant
    Reduce amount in GCC and ARM linker files to 39

Happy
    Fix comment in GCC linker file
    Reduce amount in ARM linker file to 21

Leopard
    Increase amount to 40 in cmsis_nvic.h
    Reduce amount to 40 in GCC linker file (this bug caused by
    emlib 4.1.0 port commit 1923e8b4)

Wonder
    No changes, but note that ref. manual does not list FPUEH
    interrupt that is included in startup files at index 39

Zero
    Increase amount to 19 in ARM linker file
Read as not returning correct values, because RTCC (or RTC in other
Gecko's) was not initiated. This was a problem in every Gecko.

If RTCC is initiated for lptimer it is done without binding it to
irqhandler (since irq not needed). Also implementation for geckos
using RTC added.

Tested with pearl and happy geckos
stevew817 and others added 19 commits January 12, 2016 17:25
* Added PD9 back in (for some reason it was at some point removed from the pinmap, not sure why because it is a usable pin when you remove the on-board sensor or use the Pearl chip standalone)
* Fixed PWM locations to match the pin-CC channel combinations.
* Setting the PWM period now correctly updates all other channels to keep their duty cycle
* No longer keep values in RAM that can be read directly from a register
* Setting the PWM duty cycle to 100% no longer makes the signal glitch on every period
* Code condensation
…ansfer means the transaction is finished already, and its handling is thus less time-sensitive than being in the middle of an interrupt-driven Serial or SPI transaction.
Emlib should now match the standard SiLabs release. Required extensions
have been moved to dma_api and marked with LDMAx_ prefix.
@0xc0170
Copy link
Contributor

0xc0170 commented Jan 14, 2016

Please share the test output from singletest.py

@stevew817
Copy link
Contributor Author

Test summary:
+--------+-----------------+-----------+-------------+---------------------------------------+--------------------+---------------+-------+
| Result | Target | Toolchain | Test ID | Test Description | Elapsed Time (sec) | Timeout (sec) | Loops |
+--------+-----------------+-----------+-------------+---------------------------------------+--------------------+---------------+-------+
| OK | EFM32PG_STK3401 | GCC_ARM | DTCT_1 | Simple detect test | 3.08 | 10 | 3/3 |
| OK | EFM32PG_STK3401 | GCC_ARM | EXAMPLE_1 | /dev/null | 6.5 | 20 | 3/3 |
| OK | EFM32PG_STK3401 | GCC_ARM | MBED_10 | Hello World | 3.09 | 5 | 3/3 |
| OK | EFM32PG_STK3401 | GCC_ARM | MBED_11 | Ticker Int | 14.17 | 15 | 3/3 |
| OK | EFM32PG_STK3401 | GCC_ARM | MBED_12 | C++ | 4.24 | 10 | 3/3 |
| OK | EFM32PG_STK3401 | GCC_ARM | MBED_16 | RTC | 7.59 | 20 | 3/3 |
| OK | EFM32PG_STK3401 | GCC_ARM | MBED_2 | stdio | 3.6 | 20 | 3/3 |
| OK | EFM32PG_STK3401 | GCC_ARM | MBED_23 | Ticker Int us | 14.01 | 15 | 3/3 |
| OK | EFM32PG_STK3401 | GCC_ARM | MBED_24 | Timeout Int us | 14.51 | 15 | 3/3 |
| OK | EFM32PG_STK3401 | GCC_ARM | MBED_25 | Time us | 14.07 | 15 | 3/3 |
| OK | EFM32PG_STK3401 | GCC_ARM | MBED_26 | Integer constant division | 4.09 | 20 | 3/3 |
| OK | EFM32PG_STK3401 | GCC_ARM | MBED_34 | Ticker Two callbacks | 14.17 | 15 | 3/3 |
| OK | EFM32PG_STK3401 | GCC_ARM | MBED_37 | Serial NC RX | 9.3 | 20 | 3/3 |
| OK | EFM32PG_STK3401 | GCC_ARM | MBED_38 | Serial NC TX | 8.9 | 20 | 3/3 |
| OK | EFM32PG_STK3401 | GCC_ARM | MBED_A1 | Basic | 4.06 | 20 | 3/3 |
| OK | EFM32PG_STK3401 | GCC_ARM | MBED_A21 | Call function before main (mbed_main) | 4.01 | 20 | 3/3 |
| OK | EFM32PG_STK3401 | GCC_ARM | MBED_A5 | DigitalIn DigitalOut | 4.06 | 10 | 3/3 |
| OK | EFM32PG_STK3401 | GCC_ARM | MBED_A6 | DigitalInOut | 4.05 | 10 | 3/3 |
| OK | EFM32PG_STK3401 | GCC_ARM | MBED_A7 | InterruptIn | 11.31 | 15 | 3/3 |
| OK | EFM32PG_STK3401 | GCC_ARM | MBED_A9 | Serial Echo at 115200 | 4.86 | 20 | 3/3 |
| OK | EFM32PG_STK3401 | GCC_ARM | MBED_BUSOUT | BusOut | 4.24 | 15 | 3/3 |
| OK | EFM32PG_STK3401 | ARM | DTCT_1 | Simple detect test | 3.83 | 10 | 3/3 |
| OK | EFM32PG_STK3401 | ARM | EXAMPLE_1 | /dev/null | 6.77 | 20 | 3/3 |
| OK | EFM32PG_STK3401 | ARM | MBED_10 | Hello World | 3.56 | 5 | 3/3 |
| OK | EFM32PG_STK3401 | ARM | MBED_11 | Ticker Int | 14.66 | 15 | 3/3 |
| OK | EFM32PG_STK3401 | ARM | MBED_12 | C++ | 4.73 | 10 | 3/3 |
| OK | EFM32PG_STK3401 | ARM | MBED_16 | RTC | 7.73 | 20 | 3/3 |
| OK | EFM32PG_STK3401 | ARM | MBED_2 | stdio | 3.9 | 20 | 3/3 |
| OK | EFM32PG_STK3401 | ARM | MBED_23 | Ticker Int us | 14.67 | 15 | 3/3 |
| OK | EFM32PG_STK3401 | ARM | MBED_24 | Timeout Int us | 14.99 | 15 | 3/3 |
| OK | EFM32PG_STK3401 | ARM | MBED_25 | Time us | 14.61 | 15 | 3/3 |
| OK | EFM32PG_STK3401 | ARM | MBED_26 | Integer constant division | 4.78 | 20 | 3/3 |
| OK | EFM32PG_STK3401 | ARM | MBED_34 | Ticker Two callbacks | 14.77 | 15 | 3/3 |
| OK | EFM32PG_STK3401 | ARM | MBED_37 | Serial NC RX | 9.37 | 20 | 3/3 |
| OK | EFM32PG_STK3401 | ARM | MBED_38 | Serial NC TX | 8.92 | 20 | 3/3 |
| OK | EFM32PG_STK3401 | ARM | MBED_A1 | Basic | 4.71 | 20 | 3/3 |
| OK | EFM32PG_STK3401 | ARM | MBED_A21 | Call function before main (mbed_main) | 4.78 | 20 | 3/3 |
| OK | EFM32PG_STK3401 | ARM | MBED_A5 | DigitalIn DigitalOut | 4.66 | 10 | 3/3 |
| OK | EFM32PG_STK3401 | ARM | MBED_A6 | DigitalInOut | 4.66 | 10 | 3/3 |
| OK | EFM32PG_STK3401 | ARM | MBED_A7 | InterruptIn | 11.89 | 15 | 3/3 |
| OK | EFM32PG_STK3401 | ARM | MBED_A9 | Serial Echo at 115200 | 5.03 | 20 | 3/3 |
| OK | EFM32PG_STK3401 | ARM | MBED_BUSOUT | BusOut | 4.65 | 15 | 3/3 |
| OK | EFM32PG_STK3401 | uARM | DTCT_1 | Simple detect test | 3.09 | 10 | 3/3 |
| OK | EFM32PG_STK3401 | uARM | EXAMPLE_1 | /dev/null | 6.2 | 20 | 3/3 |
| OK | EFM32PG_STK3401 | uARM | MBED_10 | Hello World | 3.1 | 5 | 3/3 |
| OK | EFM32PG_STK3401 | uARM | MBED_11 | Ticker Int | 14.26 | 15 | 3/3 |
| OK | EFM32PG_STK3401 | uARM | MBED_12 | C++ | 4.25 | 10 | 3/3 |
| OK | EFM32PG_STK3401 | uARM | MBED_16 | RTC | 7.3 | 20 | 3/3 |
| OK | EFM32PG_STK3401 | uARM | MBED_2 | stdio | 3.22 | 20 | 3/3 |
| OK | EFM32PG_STK3401 | uARM | MBED_23 | Ticker Int us | 14.27 | 15 | 3/3 |
| FAIL | EFM32PG_STK3401 | uARM | MBED_24 | Timeout Int us | 18.96 | 15 | 0/3 |
| OK | EFM32PG_STK3401 | uARM | MBED_25 | Time us | 14.99 | 15 | 3/3 |
| OK | EFM32PG_STK3401 | uARM | MBED_26 | Integer constant division | 4.04 | 20 | 3/3 |
| OK | EFM32PG_STK3401 | uARM | MBED_34 | Ticker Two callbacks | 14.3 | 15 | 3/3 |
| OK | EFM32PG_STK3401 | uARM | MBED_37 | Serial NC RX | 9.06 | 20 | 3/3 |
| OK | EFM32PG_STK3401 | uARM | MBED_38 | Serial NC TX | 8.58 | 20 | 3/3 |
| OK | EFM32PG_STK3401 | uARM | MBED_A1 | Basic | 4.03 | 20 | 3/3 |
| OK | EFM32PG_STK3401 | uARM | MBED_A21 | Call function before main (mbed_main) | 4.04 | 20 | 3/3 |
| OK | EFM32PG_STK3401 | uARM | MBED_A5 | DigitalIn DigitalOut | 4.03 | 10 | 3/3 |
| OK | EFM32PG_STK3401 | uARM | MBED_A6 | DigitalInOut | 4.02 | 10 | 3/3 |
| OK | EFM32PG_STK3401 | uARM | MBED_A7 | InterruptIn | 11.3 | 15 | 3/3 |
| OK | EFM32PG_STK3401 | uARM | MBED_A9 | Serial Echo at 115200 | 4.5 | 20 | 3/3 |
| OK | EFM32PG_STK3401 | uARM | MBED_BUSOUT | BusOut | 4.13 | 15 | 3/3 |
+--------+-----------------+-----------+-------------+---------------------------------------+--------------------+---------------+-------+
Result: 1 FAIL / 62 OK
Shuffle Seed: 0.7565863978

Completed in 1943.09 sec

* Allow pins to be configured as NC without failing or asserting
* Fix putc() to not return before the entire character has been physically shifted out.
* Use MBED_ASSERT
* Fix baudrate calculation to avoid wrong configuration on startup for stdio
@stevew817
Copy link
Contributor Author

Was a bit too quick on the trigger for the test report... Test report is after the last commits have been applied.

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 15, 2016

+1

0xc0170 added a commit that referenced this pull request Jan 15, 2016
[Silicon Labs] Add support for the new EFM32 Pearl Gecko
@0xc0170 0xc0170 merged commit 919364e into ARMmbed:master Jan 15, 2016
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.

4 participants