You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ut...@apache.org on 2020/01/09 09:38:10 UTC
[mynewt-core] branch master updated (fee0bbb -> 382ebd6)
This is an automated email from the ASF dual-hosted git repository.
utzig pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git.
from fee0bbb kernel/os/selftest: increase taskpool stack size
new 4e3038f lora: allow SX127x connected to any SPI port
new 78929de bsp: b-l072z-lrwan1: use full paths for dep pkgs
new 8ad0487 bsp: b-l072z-lrwan1: sanity checks for lora
new 382ebd6 bsp: b-l072z-lrwan1: use sane defaults for lora HW
The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
hw/bsp/b-l072z-lrwan1/include/bsp/bsp.h | 10 +++++++
hw/bsp/b-l072z-lrwan1/pkg.yml | 10 +++----
hw/bsp/b-l072z-lrwan1/src/hal_bsp.c | 49 ++++++++++++++++++++++++++-----
hw/bsp/b-l072z-lrwan1/syscfg.yml | 4 ++-
hw/drivers/lora/sx1272/src/sx1272-board.h | 3 --
hw/drivers/lora/sx1276/src/sx1276-board.h | 5 ----
6 files changed, 60 insertions(+), 21 deletions(-)
[mynewt-core] 03/04: bsp: b-l072z-lrwan1: sanity checks for lora
Posted by ut...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
utzig pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git
commit 8ad048790ac843f7c8f79a0f0506f65af6fa134c
Author: Fabio Utzig <ut...@apache.org>
AuthorDate: Wed Jan 8 09:28:57 2020 -0300
bsp: b-l072z-lrwan1: sanity checks for lora
Add code to check that lora HW dependencies are correctly set, and
fix lora usage of timers to better match those pre-defined by the BSP.
Signed-off-by: Fabio Utzig <ut...@apache.org>
---
hw/bsp/b-l072z-lrwan1/src/hal_bsp.c | 49 +++++++++++++++++++++++++++++++------
1 file changed, 42 insertions(+), 7 deletions(-)
diff --git a/hw/bsp/b-l072z-lrwan1/src/hal_bsp.c b/hw/bsp/b-l072z-lrwan1/src/hal_bsp.c
index 46a5281..3295800 100644
--- a/hw/bsp/b-l072z-lrwan1/src/hal_bsp.c
+++ b/hw/bsp/b-l072z-lrwan1/src/hal_bsp.c
@@ -46,6 +46,37 @@
#include "bsp/bsp.h"
+#define TIMER_0_TIM TIM2
+#define TIMER_1_TIM TIM3
+#define TIMER_2_TIM TIM21
+
+#if MYNEWT_VAL(LORA_NODE)
+
+/*
+ * Sanity checks for when LoRaWAN is enabled.
+ */
+
+#if ((MYNEWT_VAL(LORA_MAC_TIMER_NUM) == 0) && !MYNEWT_VAL(TIMER_0))
+#error "TIMER_0 is used by LoRa and has to be enabled"
+#elif ((MYNEWT_VAL(LORA_MAC_TIMER_NUM) == 1) && !MYNEWT_VAL(TIMER_1))
+#error "TIMER_1 is used by LoRa and has to be enabled"
+#elif ((MYNEWT_VAL(LORA_MAC_TIMER_NUM) == 2) && !MYNEWT_VAL(TIMER_2))
+#error "TIMER_2 is used by LoRa and has to be enabled"
+#endif
+
+#if ((MYNEWT_VAL(SX1276_SPI_IDX) == 0) && !MYNEWT_VAL(SPI_0_MASTER))
+#error "SPI_0_MASTER is used by LoRa and has to be enabled"
+#elif ((MYNEWT_VAL(SX1276_SPI_IDX) == 1) && !MYNEWT_VAL(SPI_1_MASTER))
+#error "SPI_1_MASTER is used by LoRa and has to be enabled"
+#endif
+
+#if (MYNEWT_VAL(OS_CPUTIME_TIMER_NUM) < 0)
+#error "OS_CPUTIME_TIMER_NUM is used by LoRa and has to be enabled"
+#endif
+
+#endif /* MYNEWT_VAL(LORA_NODE) */
+
+
#if MYNEWT_VAL(UART_0)
static struct uart_dev hal_uart0;
@@ -79,7 +110,11 @@ static struct stm32_hal_i2c_cfg i2c_cfg0 = {
#if MYNEWT_VAL(SPI_1_SLAVE) || MYNEWT_VAL(SPI_1_MASTER)
struct stm32_hal_spi_cfg spi1_cfg = {
+#if (MYNEWT_VAL(LORA_NODE) && (MYNEWT_VAL(SX1276_SPI_IDX) == 1))
+ .ss_pin = MYNEWT_VAL(SX1276_SPI_CS_PIN),
+#else
.ss_pin = MCU_GPIO_PORTB(12),
+#endif
.sck_pin = MCU_GPIO_PORTB(13),
.miso_pin = MCU_GPIO_PORTB(14),
.mosi_pin = MCU_GPIO_PORTB(15),
@@ -128,15 +163,15 @@ hal_bsp_init(void)
#endif
#if MYNEWT_VAL(TIMER_0)
- hal_timer_init(0, TIM2);
+ hal_timer_init(0, TIMER_0_TIM);
#endif
#if MYNEWT_VAL(TIMER_1)
- hal_timer_init(1, TIM3);
+ hal_timer_init(1, TIMER_1_TIM);
#endif
#if MYNEWT_VAL(TIMER_2)
- hal_timer_init(2, TIM21);
+ hal_timer_init(2, TIMER_2_TIM);
#endif
#if (MYNEWT_VAL(OS_CPUTIME_TIMER_NUM) >= 0)
@@ -182,15 +217,15 @@ void lora_bsp_enable_mac_timer(void)
/* Turn on the LoRa MAC timer. This function is automatically
* called by the LoRa stack when exiting low power mode.*/
#if MYNEWT_VAL(LORA_MAC_TIMER_NUM) == 0
- #define TIMER_INIT TIM2
+ #define LORA_TIM TIMER_0_TIM
#elif MYNEWT_VAL(LORA_MAC_TIMER_NUM) == 1
- #define TIMER_INIT TIM3
+ #define LORA_TIM TIMER_1_TIM
#elif MYNEWT_VAL(LORA_MAC_TIMER_NUM) == 2
- #define TIMER_INIT TIM21
+ #define LORA_TIM TIMER_2_TIM
#else
#error "Invalid LORA_MAC_TIMER_NUM"
#endif
- hal_timer_init(MYNEWT_VAL(LORA_MAC_TIMER_NUM), TIMER_INIT);
+ hal_timer_init(MYNEWT_VAL(LORA_MAC_TIMER_NUM), LORA_TIM);
}
#endif
[mynewt-core] 02/04: bsp: b-l072z-lrwan1: use full paths for dep
pkgs
Posted by ut...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
utzig pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git
commit 78929de9707d486880797abb9b4417cfd8c85334
Author: Fabio Utzig <ut...@apache.org>
AuthorDate: Wed Jan 8 09:27:17 2020 -0300
bsp: b-l072z-lrwan1: use full paths for dep pkgs
Signed-off-by: Fabio Utzig <ut...@apache.org>
---
hw/bsp/b-l072z-lrwan1/pkg.yml | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/hw/bsp/b-l072z-lrwan1/pkg.yml b/hw/bsp/b-l072z-lrwan1/pkg.yml
index eb3fca9..3ef5e86 100644
--- a/hw/bsp/b-l072z-lrwan1/pkg.yml
+++ b/hw/bsp/b-l072z-lrwan1/pkg.yml
@@ -31,13 +31,13 @@ pkg.cflags:
- -DSTM32L072xx
pkg.deps:
- - hw/mcu/stm/stm32l0xx
- - libc/baselibc
+ - "@apache-mynewt-core/hw/mcu/stm/stm32l0xx"
+ - "@apache-mynewt-core/libc/baselibc"
pkg.deps.UART_0:
- - hw/drivers/uart/uart_hal
+ - "@apache-mynewt-core/hw/drivers/uart/uart_hal"
pkg.deps.UART_1:
- - hw/drivers/uart/uart_hal
+ - "@apache-mynewt-core/hw/drivers/uart/uart_hal"
pkg.deps.LORA_NODE:
- - hw/drivers/lora/sx1276
+ - "@apache-mynewt-core/hw/drivers/lora/sx1276"
[mynewt-core] 04/04: bsp: b-l072z-lrwan1: use sane defaults for
lora HW
Posted by ut...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
utzig pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git
commit 382ebd635e3cdadc7733d701ff15741797c3ff1b
Author: Fabio Utzig <ut...@apache.org>
AuthorDate: Wed Jan 8 09:31:16 2020 -0300
bsp: b-l072z-lrwan1: use sane defaults for lora HW
Add GPIO/SPI/TIMER default settings that match lora connection in the
board.
Signed-off-by: Fabio Utzig <ut...@apache.org>
---
hw/bsp/b-l072z-lrwan1/include/bsp/bsp.h | 10 ++++++++++
hw/bsp/b-l072z-lrwan1/syscfg.yml | 4 +++-
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/hw/bsp/b-l072z-lrwan1/include/bsp/bsp.h b/hw/bsp/b-l072z-lrwan1/include/bsp/bsp.h
index b6f4a7e..6a93b93 100644
--- a/hw/bsp/b-l072z-lrwan1/include/bsp/bsp.h
+++ b/hw/bsp/b-l072z-lrwan1/include/bsp/bsp.h
@@ -43,6 +43,16 @@ extern uint8_t _ram_start;
#define LED_3 MCU_GPIO_PORTB(7) /* LD4 - red */
#define LED_4 MCU_GPIO_PORTA(5) /* LD2 - green */
+/* SX1276 pins */
+#define SX1276_DIO0 MCU_GPIO_PORTB(4)
+#define SX1276_DIO1 MCU_GPIO_PORTB(1)
+#define SX1276_DIO2 MCU_GPIO_PORTB(0)
+#define SX1276_DIO3 MCU_GPIO_PORTC(13)
+#define SX1276_DIO4 MCU_GPIO_PORTA(5)
+/* NOTE: DIO5 is not used, but must be defined */
+#define SX1276_DIO5 (-1)
+#define SX1276_NRESET MCU_GPIO_PORTC(0)
+
/* UART */
#define UART_CNT 1
diff --git a/hw/bsp/b-l072z-lrwan1/syscfg.yml b/hw/bsp/b-l072z-lrwan1/syscfg.yml
index 28c3915..6d15159 100644
--- a/hw/bsp/b-l072z-lrwan1/syscfg.yml
+++ b/hw/bsp/b-l072z-lrwan1/syscfg.yml
@@ -43,7 +43,9 @@ syscfg.vals:
CONFIG_FCB_FLASH_AREA: FLASH_AREA_NFFS
NFFS_FLASH_AREA: FLASH_AREA_NFFS
COREDUMP_FLASH_AREA: FLASH_AREA_IMAGE_1
- SX1276_SPI_IDX: 0
+ SX1276_SPI_IDX: 1
+ SX1276_SPI_CS_PIN: 'MCU_GPIO_PORTB(12)'
+ LORA_MAC_TIMER_NUM: 0
STM32_CLOCK_VOLTAGESCALING_CONFIG: 'PWR_REGULATOR_VOLTAGE_SCALE1'
STM32_CLOCK_LSI: 1
STM32_CLOCK_LSE: 0
[mynewt-core] 01/04: lora: allow SX127x connected to any SPI port
Posted by ut...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
utzig pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git
commit 4e3038fb3eb2c8beafba14bb1728cf07c1a74658
Author: Fabio Utzig <ut...@apache.org>
AuthorDate: Wed Jan 8 09:25:50 2020 -0300
lora: allow SX127x connected to any SPI port
This removes a requirement that forces SPI index to always be zero.
Signed-off-by: Fabio Utzig <ut...@apache.org>
---
hw/drivers/lora/sx1272/src/sx1272-board.h | 3 ---
hw/drivers/lora/sx1276/src/sx1276-board.h | 5 -----
2 files changed, 8 deletions(-)
diff --git a/hw/drivers/lora/sx1272/src/sx1272-board.h b/hw/drivers/lora/sx1272/src/sx1272-board.h
index e8e9b11..27153bd 100644
--- a/hw/drivers/lora/sx1272/src/sx1272-board.h
+++ b/hw/drivers/lora/sx1272/src/sx1272-board.h
@@ -16,9 +16,6 @@ Maintainer: Miguel Luis and Gregory Cristian
#define __SX1272_ARCH_H__
#define RADIO_SPI_IDX MYNEWT_VAL(SX1272_SPI_IDX)
-#if RADIO_SPI_IDX != 0
-#error "Invalid SX1272_SPI_IDX value. Must be zero"
-#endif
#if MYNEWT_VAL(SX1272_SPI_CS_PIN) == -1
#error "Must set SX1272_SPI_CS_PIN pin (spi slave select)"
diff --git a/hw/drivers/lora/sx1276/src/sx1276-board.h b/hw/drivers/lora/sx1276/src/sx1276-board.h
index 73edf9c..0e67531 100644
--- a/hw/drivers/lora/sx1276/src/sx1276-board.h
+++ b/hw/drivers/lora/sx1276/src/sx1276-board.h
@@ -18,12 +18,7 @@ Maintainer: Miguel Luis and Gregory Cristian
#include "hal/hal_gpio.h"
#define RADIO_SPI_IDX MYNEWT_VAL(SX1276_SPI_IDX)
-
-#if RADIO_SPI_IDX == 0
#define RADIO_NSS MYNEWT_VAL(SX1276_SPI_CS_PIN)
-#else
-#error Invalid SX1276_SPI_IDX value
-#endif
/*!
* \brief Radio hardware registers initialization definition