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 SPI and RTC support for 96Boards Wistrio #19861

Merged
merged 5 commits into from
Oct 18, 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
10 changes: 9 additions & 1 deletion boards/arm/96b_wistrio/96b_wistrio.dts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

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

/ {
model = "RAKWireless 96boards WisTrio board";
Expand Down Expand Up @@ -58,3 +58,11 @@
label = "LIS3DH";
};
};

&spi1 {
status = "okay";
};

&rtc {
status = "okay";
};
2 changes: 1 addition & 1 deletion boards/arm/96b_wistrio/96b_wistrio_defconfig
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
CONFIG_ARM=y
CONFIG_SOC_SERIES_STM32L1X=y
CONFIG_SOC_STM32L151XB=y
CONFIG_SOC_STM32L151XBA=y
# 32MHz system clock
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=32000000

Expand Down
2 changes: 1 addition & 1 deletion boards/arm/96b_wistrio/Kconfig.board
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@

config BOARD_96B_WISTRIO
bool "96boards WisTrio Development Board"
depends on SOC_STM32L151XB
depends on SOC_STM32L151XBA
17 changes: 16 additions & 1 deletion boards/arm/96b_wistrio/doc/96b_wistrio.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Overview
********

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

Expand Down Expand Up @@ -65,6 +65,10 @@ features:
+-----------+------------+-------------------------------------+
| I2C | on-chip | i2c |
+-----------+------------+-------------------------------------+
| SPI | on-chip | spi |
+-----------+------------+-------------------------------------+
| RTC | on-chip | rtc |
+-----------+------------+-------------------------------------+

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

Expand Down Expand Up @@ -103,6 +107,17 @@ The default I2C mapping is:
I2C1 also goes to the J22 connector and can be used to attach external
sensors.

SPI
---

96Boards WisTrio board has 1 SPI connected to on-chip LoRa Radio.
The default SPI mapping is:

- SPI1_SCLK : PA5
- SPI1_MISO : PA6
- SPI1_MOSI : PA7
- SPI1_NSS : PB0

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

Expand Down
3 changes: 2 additions & 1 deletion drivers/counter/counter_ll_stm32_rtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ LOG_MODULE_REGISTER(counter_rtc_stm32, CONFIG_COUNTER_LOG_LEVEL);
|| defined(CONFIG_SOC_SERIES_STM32F3X) \
|| defined(CONFIG_SOC_SERIES_STM32F7X) \
|| defined(CONFIG_SOC_SERIES_STM32WBX) \
|| defined(CONFIG_SOC_SERIES_STM32G4X)
|| defined(CONFIG_SOC_SERIES_STM32G4X) \
|| defined(CONFIG_SOC_SERIES_STM32L1X)
#define RTC_EXTI_LINE LL_EXTI_LINE_17
#endif

Expand Down
10 changes: 10 additions & 0 deletions dts/arm/st/l1/stm32l1.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@
};

soc {
rtc: rtc@40002800 {
compatible = "st,stm32-rtc";
reg = <0x40002800 0x400>;
interrupts = <41 0>;
clocks = <&rcc STM32_CLOCK_BUS_APB1 0x10000000>;
prescaler = <32768>;
status = "disabled";
label = "RTC_0";
};

usart2: serial@40004400 {
compatible = "st,stm32-usart", "st,stm32-uart";
reg = <0x40004400 0x400>;
Expand Down
22 changes: 22 additions & 0 deletions dts/arm/st/l1/stm32l151Xb-a.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Copyright (c) 2019 Linaro Limited
*
* SPDX-License-Identifier: Apache-2.0
*/

#include <mem.h>
#include <st/l1/stm32l151.dtsi>

/ {
sram0: memory@20000000 {
reg = <0x20000000 DT_SIZE_K(32)>;
};

soc {
flash-controller@40023c00 {
flash0: flash@8000000 {
reg = <0x08000000 DT_SIZE_K(128)>;
};
};
};
};
31 changes: 31 additions & 0 deletions soc/arm/st_stm32/stm32l1/Kconfig.defconfig.stm32l151xba
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Kconfig - ST Microelectronics STM32L151XB-A MCU
#
# Copyright (c) 2019 Linaro Ltd.
#
# SPDX-License-Identifier: Apache-2.0
#

if SOC_STM32L151XBA

config SOC
string
default "stm32l151xba"

config NUM_IRQS
int
default 45

if GPIO_STM32

config GPIO_STM32_PORTD
default y

config GPIO_STM32_PORTE
default y

config GPIO_STM32_PORTH
default y

endif # GPIO_STM32

endif # SOC_STM32L151XBA
3 changes: 3 additions & 0 deletions soc/arm/st_stm32/stm32l1/Kconfig.soc
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,7 @@ config SOC_STM32L151X8A
config SOC_STM32L151XB
bool "STM32L151XB"

config SOC_STM32L151XBA
bool "STM32L151XBA"

endchoice
6 changes: 6 additions & 0 deletions soc/arm/st_stm32/stm32l1/dts_fixup.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,10 @@
#define DT_WWDT_0_CLOCK_BITS DT_INST_0_ST_STM32_WINDOW_WATCHDOG_CLOCK_BITS
#define DT_WWDT_0_CLOCK_BUS DT_INST_0_ST_STM32_WINDOW_WATCHDOG_CLOCK_BUS

#define DT_RTC_0_BASE_ADDRESS DT_ST_STM32_RTC_40002800_BASE_ADDRESS
#define DT_RTC_0_IRQ_PRI DT_ST_STM32_RTC_40002800_IRQ_0_PRIORITY
#define DT_RTC_0_IRQ DT_ST_STM32_RTC_40002800_IRQ_0
#define DT_RTC_0_NAME DT_ST_STM32_RTC_40002800_LABEL
#define DT_RTC_0_CLOCK_BITS DT_ST_STM32_RTC_40002800_CLOCK_BITS
#define DT_RTC_0_CLOCK_BUS DT_ST_STM32_RTC_40002800_CLOCK_BUS
/* End of SoC Level DTS fixup file */
6 changes: 6 additions & 0 deletions soc/arm/st_stm32/stm32l1/soc.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@
#include <stm32l1xx_ll_i2c.h>
#endif

#if defined(CONFIG_COUNTER_RTC_STM32)
#include <stm32l1xx_ll_rtc.h>
#include <stm32l1xx_ll_exti.h>
#include <stm32l1xx_ll_pwr.h>
#endif

#ifdef CONFIG_SPI_STM32
#include <stm32l1xx_ll_spi.h>
#endif
Expand Down