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

Add 96Boards WisTrio board support #12354

Merged
merged 10 commits into from
Apr 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
/boards/arm/96b_nitrogen/ @idlethread
/boards/arm/96b_neonkey/ @Mani-Sadhasivam
/boards/arm/96b_stm32_sensor_mez/ @Mani-Sadhasivam
/boards/arm/96b_wistrio/ @Mani-Sadhasivam
/boards/arm/arduino_due/ @ioannisg
/boards/arm/cc3220sf_launchxl/ @vanti
/boards/arm/curie_ble/ @jhedberg
Expand Down
60 changes: 60 additions & 0 deletions boards/arm/96b_wistrio/96b_wistrio.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* Copyright (c) 2019 Linaro Limited
*
* SPDX-License-Identifier: Apache-2.0
*/

/dts-v1/;
#include <st/l1/stm32l151Xb.dtsi>

/ {
model = "RAKWireless 96boards WisTrio board";
compatible = "rak,wistrio", "st,stm32l151";

chosen {
zephyr,console = &usart1;
zephyr,shell-uart = &usart1;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
};

leds {
compatible = "gpio-leds";
green_led_0: led_0 {
gpios = <&gpioa 12 GPIO_INT_ACTIVE_LOW>;
label = "User LD1";
};
blue_led_0: led_1 {
gpios = <&gpiob 4 GPIO_INT_ACTIVE_LOW>;
label = "User LD2";
};
};

aliases {
led0 = &green_led_0;
};
};

&usart1 {
current-speed = <115200>;
pinctrl-0 = <&usart1_pins_b>;
pinctrl-names = "default";
status = "ok";
};

&usart3 {
current-speed = <115200>;
pinctrl-0 = <&usart3_pins_a>;
pinctrl-names = "default";
status = "ok";
};

&i2c1 {
status = "ok";

lis3dh@32 {
compatible = "st,lis3dh";
reg = <0x32>;
label = "LIS3DH";
};
};
12 changes: 12 additions & 0 deletions boards/arm/96b_wistrio/96b_wistrio.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
identifier: 96b_wistrio
name: 96boards WisTrio
type: mcu
arch: arm
toolchain:
- zephyr
- gnuarmemb
ram: 16
flash: 128
supported:
- gpio
erwango marked this conversation as resolved.
Show resolved Hide resolved
- i2c
31 changes: 31 additions & 0 deletions boards/arm/96b_wistrio/96b_wistrio_defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
CONFIG_ARM=y
CONFIG_SOC_SERIES_STM32L1X=y
CONFIG_SOC_STM32L151XB=y
CONFIG_CORTEX_M_SYSTICK=y
# 32MHz system clock
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=32000000

# enable uart driver
CONFIG_SERIAL=y

# enable pinmux
CONFIG_PINMUX=y

# enable GPIO
CONFIG_GPIO=y

# clock configuration
CONFIG_CLOCK_CONTROL=y
# SYSCLK selection
CONFIG_CLOCK_STM32_SYSCLK_SRC_PLL=y
# Use HSI source
CONFIG_CLOCK_STM32_PLL_SRC_HSI=y
CONFIG_CLOCK_STM32_PLL_DIVISOR=2
# produce 32Mhz clock at PLL output
CONFIG_CLOCK_STM32_PLL_MULTIPLIER=4
CONFIG_CLOCK_STM32_AHB_PRESCALER=1
CONFIG_CLOCK_STM32_APB1_PRESCALER=1

# console
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y
3 changes: 3 additions & 0 deletions boards/arm/96b_wistrio/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
zephyr_library()
zephyr_library_sources(pinmux.c)
zephyr_library_include_directories(${ZEPHYR_BASE}/drivers)
10 changes: 10 additions & 0 deletions boards/arm/96b_wistrio/Kconfig.board
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Kconfig - 96boards WisTrio board configuration
#
# Copyright (c) 2019 Linaro Ltd.
#
# SPDX-License-Identifier: Apache-2.0
#

config BOARD_96B_WISTRIO
bool "96boards WisTrio Development Board"
depends on SOC_STM32L151XB
27 changes: 27 additions & 0 deletions boards/arm/96b_wistrio/Kconfig.defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Kconfig - 96boards WisTrio board configuration
#
# Copyright (c) 2019 Linaro Ltd.
#
# SPDX-License-Identifier: Apache-2.0
#

if BOARD_96B_WISTRIO

config BOARD
default "96b_wistrio"

if UART_CONSOLE

config UART_1
default y

endif # UART_CONSOLE

if I2C

config I2C_1
default y

endif # I2C

endif # BOARD_96B_WISTRIO
199 changes: 199 additions & 0 deletions boards/arm/96b_wistrio/doc/96b_wistrio.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
.. _96b_wistrio:

96Boards WisTrio
#################

Overview
********

96Boards WisTrio LoRa Tracker board is based on the RAK Wireless RAK5205
chipset integrating SX1276 LoRaWAN Modem, STM32L151CB MCU and GPS module.
Zephyr applications use the 96b_wistrio configuration to run on these
boards.

.. figure:: img/96b-wistrio.png
:width: 1000px
:align: center
:height: 509px
:alt: 96Boards WisTrio

96Boards WisTrio

This board is one of the 96Boards IoT Edition platform providing LoRa
connectivity.

Hardware
********

96Boards WisTrio provides the following hardware components:

- RAK5205 Chipset
- 3.3V work voltage
- 128 KB Flash
- 16 KB SRAM
- On board sensors:

- Acclerometer: STMicro LIS3DH
- Integrated Environmental sensor: Bosch BME680

- 2 User LEDs
- GPIO with external interrupt capability
- UART (2)
- I2C (1)
- GPS Module
- GPS Antenna
- LoRa Antenna

Supported Features
==================

The Zephyr 96b_wistrio board configuration supports the following hardware
features:

+-----------+------------+-------------------------------------+
| Interface | Controller | Driver/Component |
+===========+============+=====================================+
| NVIC | on-chip | nested vector interrupt controller |
+-----------+------------+-------------------------------------+
| SYSTICK | on-chip | system clock |
+-----------+------------+-------------------------------------+
| UART | on-chip | serial port |
+-----------+------------+-------------------------------------+
| GPIO | on-chip | gpio |
+-----------+------------+-------------------------------------+
| PINMUX | on-chip | pinmux |
+-----------+------------+-------------------------------------+
| I2C | on-chip | i2c |
+-----------+------------+-------------------------------------+

The default board configuration can be found in the defconfig file:

``boards/arm/96b_wistrio/96b_wistrio_defconfig``

Connections and IOs
===================

LED
---

- LED1 / User1 LED = PA12
- LED2 / User2 LED = PB4

Push buttons
------------

- BUTTON = RST (BT1)

Serial Port
===========

96Boards WisTrio board has 2 UARTs. Zephyr console output is assigned
to USART1 with 115200 8N1 as the default setting and USART3 is used for
GPS module.

I2C
---

96Boards WisTrio board has 1 I2C connected to on-board sensors.
The default I2C mapping is:

- I2C1_SCL : PB8
- I2C1_SDA : PB9

I2C1 also goes to the J22 connector and can be used to attach external
sensors.

Programming and Debugging
*************************

Building
========

Here is an example for building the :ref:`hello_world` application.

.. zephyr-app-commands::
:zephyr-app: samples/hello_world
:board: 96b_wistrio
:goals: build

Flashing
========

96Boards WisTrio can be flashed by two methods, one using the ROM
bootloader and another using the SWD debug port (which requires additional
hardware).

Flashing using the ROM bootloader requires a special activation pattern,
which can be triggered by using the BOOT0 pin. The ROM bootloader supports
flashing via UART, and I2C but this document describes the UART case only.
You can read more about how to enable and use the ROM bootloader by
checking the application note `AN2606`_ .

Using ROM bootloader:
---------------------

1. Connect 96Boards WisTrio to your Linux PC using, USB-Micro to USB-A
cable.

2. ROM bootloader can be triggered by the following pattern:

- Connect BOOT0 to VDD (link pin 1 and 2 on J12)
- Press and release the RST button

More detailed information on activating the ROM bootloader can be found in
Chapter 29 of Application note `AN2606`_. The ROM bootloader supports flashing
via UART, and I2C protocols.

For flashing, `stm32flash`_ command line utility can be used. The following
command will flash the ``zephyr.bin`` binary to the WisTrio board using UART
and starts its execution:

.. code-block:: console

$ stm32flash -w zephyr.bin -v -g 0x08000000 -e 255 /dev/ttyUSB0

Using SWD debugger:
-------------------

Use the `Black Magic Debug Probe`_ as an SWD programmer, which can
be connected to the SWD pins exposed on the J22 header using its flying
leads and its 20 Pin JTAG Adapter Board Kit. When plugged into your host
PC, the Black Magic Debug Probe enumerates as a USB serial device as
documented on its `Getting started page`_.

It also uses the GDB binary provided with the Zephyr SDK,
``arm-zephyr-eabi-gdb``. Other GDB binaries, such as the GDB from GCC
ARM Embedded, can be used as well.

.. code-block:: console

$ arm-zephyr-eabi-gdb -q zephyr.elf
(gdb) target extended-remote /dev/ttyACM0
Remote debugging using /dev/ttyACM0
(gdb) monitor swdp_scan
Target voltage: 3.3V
Available Targets:
No. Att Driver

Debugging
=========

After flashing 96Boards WisTrio, it can be debugged using the same
GDB instance. To reattach, just follow the same steps above, till
"attach 1". You can then debug as usual with GDB. In particular, type
"run" at the GDB prompt to restart the program you've flashed.

References
**********

.. _AN2606:
https://www.st.com/resource/en/application_note/cd00167594.pdf

.. _stm32flash:
https://sourceforge.net/p/stm32flash/wiki/Home/

.. _Black Magic Debug Probe:
https://github.com/blacksphere/blackmagic/wiki

.. _Getting started page:
https://github.com/blacksphere/blackmagic/wiki/Getting-Started
Binary file added boards/arm/96b_wistrio/doc/img/96b-wistrio.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions boards/arm/96b_wistrio/dts_fixup.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
* Copyright (c) 2019 Linaro Ltd.
*
* SPDX-License-Identifier: Apache-2.0
*
* 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.
*/
Loading