diff --git a/boards/arm/efm32wg_stk3800/Kconfig b/boards/arm/efm32wg_stk3800/Kconfig new file mode 100644 index 00000000000..cf7971f5f84 --- /dev/null +++ b/boards/arm/efm32wg_stk3800/Kconfig @@ -0,0 +1,19 @@ +# Kconfig - EFM32WG STK3800 board configuration +# +# Copyright (c) 2017 Christian Taedcke +# +# SPDX-License-Identifier: Apache-2.0 + +if BOARD_EFM32WG_STK3800 + +config BOARD_INIT_PRIORITY + int + + # omit prompt to signify a "hidden" option + default KERNEL_INIT_PRIORITY_DEFAULT + depends on GPIO + help + Board initialization priority. This must be bigger than + GPIO_GECKO_COMMON_INIT_PRIORITY. + +endif # BOARD_EFM32WG_STK3800 diff --git a/boards/arm/efm32wg_stk3800/Kconfig.board b/boards/arm/efm32wg_stk3800/Kconfig.board new file mode 100644 index 00000000000..82d8192abcd --- /dev/null +++ b/boards/arm/efm32wg_stk3800/Kconfig.board @@ -0,0 +1,11 @@ +# Kconfig - EFM32WG STK3800 board +# +# Copyright (c) 2017, Christian Taedcke +# +# SPDX-License-Identifier: Apache-2.0 +# + +config BOARD_EFM32WG_STK3800 + bool "SiLabs EFM32WG-STK3800 (Wonder Gecko)" + depends on SOC_SERIES_EFM32WG + select SOC_PART_NUMBER_EFM32WG990F256 diff --git a/boards/arm/efm32wg_stk3800/Kconfig.defconfig b/boards/arm/efm32wg_stk3800/Kconfig.defconfig new file mode 100644 index 00000000000..25a776317fa --- /dev/null +++ b/boards/arm/efm32wg_stk3800/Kconfig.defconfig @@ -0,0 +1,51 @@ +# Kconfig - EFM32WG STK3800 board +# +# Copyright (c) 2017, Christian Taedcke +# +# SPDX-License-Identifier: Apache-2.0 +# + +if BOARD_EFM32WG_STK3800 + +config BOARD + default efm32wg_stk3800 + +config CMU_HFXO_FREQ + default 48000000 + +config CMU_LFXO_FREQ + default 32768 + +if GPIO_GECKO + +config GPIO_GECKO_PORTA + def_bool y + +config GPIO_GECKO_PORTB + def_bool y + +config GPIO_GECKO_PORTC + def_bool n + +config GPIO_GECKO_PORTD + def_bool n + +config GPIO_GECKO_PORTE + def_bool y + +config GPIO_GECKO_PORTF + def_bool y + +endif # GPIO_GECKO + +if UART_GECKO + +config UART_GECKO_0 + def_bool y + +config UART_GECKO_0_GPIO_LOC + default 1 + +endif # UART_GECKO + +endif # BOARD_EFM32WG_STK3800 diff --git a/boards/arm/efm32wg_stk3800/Makefile b/boards/arm/efm32wg_stk3800/Makefile new file mode 100644 index 00000000000..6ece6a9a343 --- /dev/null +++ b/boards/arm/efm32wg_stk3800/Makefile @@ -0,0 +1,10 @@ +# Makefile - EFM32WG-STK3800 board +# +# Copyright (c) 2017, Christian Taedcke +# +# SPDX-License-Identifier: Apache-2.0 +# + +ccflags-y +=-I$(srctree)/drivers + +obj-$(CONFIG_UART_GECKO) += board.o diff --git a/boards/arm/efm32wg_stk3800/board.c b/boards/arm/efm32wg_stk3800/board.c new file mode 100644 index 00000000000..d6df9664b9e --- /dev/null +++ b/boards/arm/efm32wg_stk3800/board.c @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2017 Christian Taedcke + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include + +static int efm32wg_stk3800_init(struct device *dev) +{ + struct device *bce_dev; /* Board Controller Enable Gpio Device */ + + ARG_UNUSED(dev); + + /* Enable the board controller to be able to use the serial port */ + bce_dev = device_get_binding(BC_ENABLE_GPIO_NAME); + + if (!bce_dev) { + printk("Board controller gpio port was not found!\n"); + return -ENODEV; + } + + gpio_pin_configure(bce_dev, BC_ENABLE_GPIO_PIN, GPIO_DIR_OUT); + gpio_pin_write(bce_dev, BC_ENABLE_GPIO_PIN, 1); + + return 0; +} + +/* needs to be done after GPIO driver init */ +SYS_INIT(efm32wg_stk3800_init, PRE_KERNEL_1, CONFIG_BOARD_INIT_PRIORITY); diff --git a/boards/arm/efm32wg_stk3800/board.h b/boards/arm/efm32wg_stk3800/board.h new file mode 100644 index 00000000000..4aeb835e15e --- /dev/null +++ b/boards/arm/efm32wg_stk3800/board.h @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2017 Christian Taedcke + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef __INC_BOARD_H +#define __INC_BOARD_H + +#include + +/* Push button PB0 */ +#define PB0_GPIO_NAME CONFIG_GPIO_GECKO_PORTB_NAME +#define PB0_GPIO_PIN 9 + +/* Push button PB1 */ +#define PB1_GPIO_NAME CONFIG_GPIO_GECKO_PORTB_NAME +#define PB1_GPIO_PIN 10 + +/* LED 0 */ +#define LED0_GPIO_NAME CONFIG_GPIO_GECKO_PORTE_NAME +#define LED0_GPIO_PORT LED0_GPIO_NAME +#define LED0_GPIO_PIN 2 + +/* LED 1 */ +#define LED1_GPIO_NAME CONFIG_GPIO_GECKO_PORTE_NAME +#define LED1_GPIO_PIN 3 + +/* Push button switch 0. There is no physical switch on the board with this + * name, so create an alias to SW3 to make the basic button sample work. + */ +#define SW0_GPIO_NAME PB0_GPIO_NAME +#define SW0_GPIO_PIN PB0_GPIO_PIN + +/* This pin is used to enable the serial port using the board controller */ +#define BC_ENABLE_GPIO_NAME CONFIG_GPIO_GECKO_PORTF_NAME +#define BC_ENABLE_GPIO_PIN 7 + +#endif /* __INC_BOARD_H */ diff --git a/boards/arm/efm32wg_stk3800/doc/efm32wg_stk3800.jpg b/boards/arm/efm32wg_stk3800/doc/efm32wg_stk3800.jpg new file mode 100644 index 00000000000..7ec398a1e23 Binary files /dev/null and b/boards/arm/efm32wg_stk3800/doc/efm32wg_stk3800.jpg differ diff --git a/boards/arm/efm32wg_stk3800/doc/efm32wg_stk3800.rst b/boards/arm/efm32wg_stk3800/doc/efm32wg_stk3800.rst new file mode 100644 index 00000000000..8b8ca194ac2 --- /dev/null +++ b/boards/arm/efm32wg_stk3800/doc/efm32wg_stk3800.rst @@ -0,0 +1,174 @@ +.. _efm32wg_stk3800: + +EFM32WG-STK3800 +############### + +Overview +******** + +The EFM32 Wonder Gecko Starter Kit EFM32WG-STK3800 contains a MCU from the +EFM32WG family built on ARM® Cortex®-M4F processor with excellent low +power capabilities. + +.. image:: efm32wg_stk3800.jpg + :width: 375px + :align: center + :alt: EFM32WG-STK3800 + +Hardware +******** + +- Advanced Energy Monitoring provides real-time information about the energy + consumption of an application or prototype design. +- 32MByte parallel NAND Flash +- 160 segment Energy Micro LCD +- 2 user buttons, 2 LEDs and a touch slider +- Ambient Light Sensor and Inductive-capacitive metal sensor +- On-board Segger J-Link USB debugger + +For more information about the EFM32WG SoC and EFM32WG-STK3800 board: + +- `EFM32WG Website`_ +- `EFM32WG Datasheet`_ +- `EFM32WG Reference Manual`_ +- `EFM32WG-STK3800 Website`_ +- `EFM32WG-STK3800 User Guide`_ +- `EFM32WG-STK3800 Schematics`_ + +Supported Features +================== + +The efm32wg_stk3800oard configuration supports the following hardware features: + ++-----------+------------+-------------------------------------+ +| Interface | Controller | Driver/Component | ++===========+============+=====================================+ +| NVIC | on-chip | nested vector interrupt controller | ++-----------+------------+-------------------------------------+ +| SYSTICK | on-chip | systick | ++-----------+------------+-------------------------------------+ +| GPIO | on-chip | gpio | ++-----------+------------+-------------------------------------+ +| UART | on-chip | serial port-polling; | +| | | serial port-interrupt | ++-----------+------------+-------------------------------------+ + +The default configuration can be found in the defconfig file: + + ``boards/arm/efm32wg_stk3800/efm32wg_stk3800_defconfig`` + +Other hardware features are currently not supported by the port. + +Connections and IOs +=================== + +The EFM32WG SoC has six gpio controllers (PORTA to PORTF), but only three are +currently enabled (PORTB, PORTE and PORTF) for the EFM32WG-STK3800 board. + +In the following table, the column Name contains Pin names. For example, PE2 +means Pin number 2 on PORTE, as used in the board's datasheets and manuals. + ++-------+-------------+-------------------------------------+ +| Name | Function | Usage | ++=======+=============+=====================================+ +| PE2 | GPIO | LED0 | ++-------+-------------+-------------------------------------+ +| PE3 | GPIO | LED1 | ++-------+-------------+-------------------------------------+ +| PB0 | GPIO | Push Button PB0 | ++-------+-------------+-------------------------------------+ +| PB1 | GPIO | Push Button PB1 | ++-------+-------------+-------------------------------------+ +| PF7 | GPIO | Board Controller Enable | +| | | EFM_BC_EN | ++-------+-------------+-------------------------------------+ +| PE0 | UART0_TX | UART Console EFM_BC_TX U0_TX #1 | ++-------+-------------+-------------------------------------+ +| PE1 | UART0_RX | UART Console EFM_BC_RX U0_RX #1 | ++-------+-------------+-------------------------------------+ + +System Clock +============ + +The EFM32WG SoC is configured to use the 48 MHz external oscillator on the +board. + +Serial Port +=========== + +The EFM32WG SoC has three USARTs, two UARTs and two Low Energy UARTs (LEUART). +UART0 is connected to the board controller and is used for the console. + +Programming and Debugging +************************* + +.. note: + Before useing the kit the first time, you should update the J-Link firmware + from `J-Link-Downloads`_ + +Flashing +======== + +The EFM32WG-STK3800 includes an `J-Link`_ serial and debug adaptor built into the +board. The adaptor provides: + +- A USB connection to the host computer, which exposes a Mass Storage and a + USB Serial Port. +- A Serial Flash device, which implements the USB flash disk file storage. +- A physical UART connection which is relayed over interface USB Serial port. + +Flashing an application to EFM32-STK3800 +---------------------------------------- + +The sample application :ref:`hello_world` is used for this example. +Build the Zephyr kernel and application: + +.. code-block:: console + + $ cd + $ . zephyr-env.sh + $ cd samples/hello_world/ + $ make BOARD=efm32wg_stk3800 + +Connect the EFM32WG-STK3800 to your host computer using the USB port and you +should see a USB connection which exposes a Mass Storage (STK3800) and a +USB Serial Port. Copy the generated zephyr.bin in the STK3800 drive. + +Open a serial terminal (minicom, putty, etc.) with the following settings: + +- Speed: 115200 +- Data: 8 bits +- Parity: None +- Stop bits: 1 + +Reset the board and you should be able to see on the corresponding Serial Port +the following message: + +.. code-block:: console + + Hello World! arm + + +.. _EFM32WG-STK3800 Website: + http://www.silabs.com/products/development-tools/mcu/32-bit/efm32-wonder-gecko-starter-kit + +.. _EFM32WG-STK3800 User Guide: + http://www.silabs.com/documents/public/user-guides/efm32wg-stk3800-ug.pdf + +.. _EFM32WG-STK3800 Schematics: + http://www.silabs.com/documents/public/schematic-files/BRD2400A_A00.pdf + +.. _EFM32WG Website: + http://www.silabs.com/products/mcu/32-bit/efm32-wonder-gecko + +.. _EFM32WG Datasheet: + http://www.silabs.com/documents/public/data-sheets/EFM32WG990.pdf + +.. _EFM32WG Reference Manual: + http://www.silabs.com/documents/public/reference-manuals/EFM32WG-RM.pdf + +.. _J-Link: + https://www.segger.com/jlink-debug-probes.html + +.. _J-Link-Downloads: + https://www.segger.com/downloads/jlink diff --git a/boards/arm/efm32wg_stk3800/efm32wg_stk3800.yaml b/boards/arm/efm32wg_stk3800/efm32wg_stk3800.yaml new file mode 100644 index 00000000000..90065fe8487 --- /dev/null +++ b/boards/arm/efm32wg_stk3800/efm32wg_stk3800.yaml @@ -0,0 +1,13 @@ +identifier: efm32wg_stk3800 +name: EFM32WG-STK3800 +type: mcu +arch: arm +ram: 32 +flash: 256 +toolchain: + - zephyr + - gccarmemb +testing: + ignore_tags: + - net + - bluetooth diff --git a/boards/arm/efm32wg_stk3800/efm32wg_stk3800_defconfig b/boards/arm/efm32wg_stk3800/efm32wg_stk3800_defconfig new file mode 100644 index 00000000000..63edd59ba8b --- /dev/null +++ b/boards/arm/efm32wg_stk3800/efm32wg_stk3800_defconfig @@ -0,0 +1,11 @@ +CONFIG_ARM=y +CONFIG_SOC_FAMILY_EXX32=y +CONFIG_SOC_SERIES_EFM32WG=y +CONFIG_BOARD_EFM32WG_STK3800=y +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y +CONFIG_SERIAL=y +CONFIG_CORTEX_M_SYSTICK=y +CONFIG_GPIO=y +CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=48000000 +CONFIG_CMU_HFCLK_HFXO=y diff --git a/dts/arm/Makefile b/dts/arm/Makefile index 4a3c13a36d2..56c17cfe9e6 100644 --- a/dts/arm/Makefile +++ b/dts/arm/Makefile @@ -49,6 +49,7 @@ dtb-$(CONFIG_BOARD_STM32_MIN_DEV) = stm32_min_dev.dts_compiled dtb-$(CONFIG_BOARD_STM32F3_DISCO) = stm32f3_disco.dts_compiled dtb-$(CONFIG_BOARD_OLIMEX_STM32_P405) = olimex_stm32_p405.dts_compiled dtb-$(CONFIG_BOARD_STM32F429I_DISC1) = stm32f429i_disc1.dts_compiled +dtb-$(CONFIG_BOARD_EFM32WG_STK3800) = efm32wg_stk3800.dts_compiled always := $(dtb-y) endif diff --git a/dts/arm/efm32wg_stk3800.dts b/dts/arm/efm32wg_stk3800.dts new file mode 100644 index 00000000000..b3c42889e2c --- /dev/null +++ b/dts/arm/efm32wg_stk3800.dts @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2017 I-SENSE group of ICCS + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; +#include + +/ { + model = "Silicon Labs EFM32WG STK3800 board"; + compatible = "silabs,efm32wg_stk3800", "silabs,efm32wg"; + + chosen { + zephyr,console = &uart0; + zephyr,sram = &sram0; + zephyr,flash = &flash0; + }; +}; + +&uart0 { + current-speed = <115200>; + status = "ok"; +}; diff --git a/dts/arm/efm32wg_stk3800.fixup b/dts/arm/efm32wg_stk3800.fixup new file mode 100644 index 00000000000..e9355a15fed --- /dev/null +++ b/dts/arm/efm32wg_stk3800.fixup @@ -0,0 +1,12 @@ +/* This file is a temporary workaround for mapping of the generated information + * to the current driver definitions. This will be removed when the drivers + * are modified to handle the generated information, or the mapping of + * generated data matches the driver definitions. + */ + + +#define CONFIG_NUM_IRQ_PRIO_BITS ARM_V7M_NVIC_E000E100_ARM_NUM_IRQ_PRIORITY_BITS +#define CONFIG_UART_GECKO_0_NAME SILABS_EFM32_USART_4000C000_LABEL + +#define CONFIG_UART_GECKO_0_BAUD_RATE SILABS_EFM32_USART_4000C000_CURRENT_SPEED +#define CONFIG_UART_GECKO_0_IRQ_PRI SILABS_EFM32_USART_4000C000_IRQ_0_PRIORITY