Skip to content

Commit f76926c

Browse files
Oliv4945fpistm
authored andcommitted
Add RAK3172 module
1 parent 31e562d commit f76926c

File tree

4 files changed

+304
-0
lines changed

4 files changed

+304
-0
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -749,6 +749,7 @@ User can add a STM32 based board following this [wiki](https://github.com/stm32d
749749
| :green_heart: | STM32L073RZ | [AcSIP S76S](https://www.acsip.com.tw) | *2.3.0* | |
750750
| :green_heart: | STM32F072C8<br>STM32F072CB | [Elektor LoRa Node](https://github.com/ElektorLabs/180516-Elektor_LoRa_Node) | *1.8.0* | [More info](https://www.elektormagazine.com/labs/lorawan-node-experimental-platform) |
751751
| :yellow_heart: | STM32WLE5JC | [LoRa-E5 mini](https://wiki.seeedstudio.com/LoRa_E5_mini/) | **2.6.0** | |
752+
| :yellow_heart: | STM32WLE5CC | [RAK3172 Module](https://github.com/RAKWireless/rakwireless-docs/tree/master/docs/Product-Categories/WisDuo/RAK3172-Module) | **2.6.0** | |
752753
| :green_heart: | STM32L151CB | [RAK811 LoRa Tracker](https://www.rakwireless.com/en/) | *1.4.0* | [Wiki](https://github.com/stm32duino/Arduino_Core_STM32/wiki/Connectivities#lora) |
753754
| :green_heart: | STM32L051C8 | [RHF76-052](https://lora-alliance.org/lora_products/rhf76-052/) | *1.7.0* | Basic support |
754755

boards.txt

+12
Original file line numberDiff line numberDiff line change
@@ -10482,6 +10482,18 @@ LoRa.menu.pnum.LORA_E5_MINI.build.peripheral_pins=-DCUSTOM_PERIPHERAL_PINS
1048210482
LoRa.menu.pnum.LORA_E5_MINI.build.variant_h=variant_LORA_E5_MINI.h
1048310483
LoRa.menu.pnum.LORA_E5_MINI.build.cmsis_lib_gcc=arm_cortexM4l_math
1048410484

10485+
# RAK3172 module
10486+
LoRa.menu.pnum.RAK3172_MODULE=RAK3172 Module
10487+
LoRa.menu.pnum.RAK3172_MODULE.upload.maximum_size=262144
10488+
LoRa.menu.pnum.RAK3172_MODULE.upload.maximum_data_size=65536
10489+
LoRa.menu.pnum.RAK3172_MODULE.build.mcu=cortex-m4
10490+
LoRa.menu.pnum.RAK3172_MODULE.build.board=RAK3172_MODULE
10491+
LoRa.menu.pnum.RAK3172_MODULE.build.series=STM32WLxx
10492+
LoRa.menu.pnum.RAK3172_MODULE.build.product_line=STM32WLE5xx
10493+
LoRa.menu.pnum.RAK3172_MODULE.build.variant=STM32WLxx/WL54CCU_WL55CCU_WLE4C(8-B-C)U_WLE5C(8-B-C)U
10494+
LoRa.menu.pnum.RAK3172_MODULE.build.variant_h=variant_RAK3172_MODULE.h
10495+
LoRa.menu.pnum.RAK3172_MODULE.build.cmsis_lib_gcc=arm_cortexM4l_math
10496+
1048510497
# RAK811_TRACKER board
1048610498
LoRa.menu.pnum.RAK811_TRACKER=RAK811 LoRa Tracker (16kb RAM)
1048710499
LoRa.menu.pnum.RAK811_TRACKER.upload.maximum_size=131072
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
/*
2+
*******************************************************************************
3+
* Copyright (c) 2020, STMicroelectronics
4+
* All rights reserved.
5+
*
6+
* This software component is licensed by ST under BSD 3-Clause license,
7+
* the "License"; You may not use this file except in compliance with the
8+
* License. You may obtain a copy of the License at:
9+
* opensource.org/licenses/BSD-3-Clause
10+
*
11+
*******************************************************************************
12+
*/
13+
#if defined(ARDUINO_RAK3172_MODULE)
14+
#include "pins_arduino.h"
15+
16+
// Digital PinName array
17+
const PinName digitalPin[] = {
18+
PA_0, // D0
19+
PA_1, // D1
20+
PA_2, // D2 - USART2/LPUART1 TX
21+
PA_3, // D3 - USART2/LPUART1 RX
22+
PA_4, // D4 - SPI_NSS
23+
PA_5, // D5 - SPI_SCK
24+
PA_6, // D6 - SPI_MISO
25+
PA_7, // D7 - SPI_MOSI
26+
PA_8, // D8
27+
PA_9, // D9
28+
PA_10, // D10/A3
29+
PA_11, // D11/A7 - I2C_SDA
30+
PA_12, // D12/A8 - I2C_SCL
31+
PA_13, // D13/A5 - SWDIO
32+
PA_14, // D14/A6 - SWCLK
33+
PA_15, // D15/A4
34+
PB_2, // D16/A2
35+
PB_3, // D17/A0
36+
PB_4, // D18/A1
37+
PB_5, // D19
38+
PB_6, // D20 - USART1_TX
39+
PB_7, // D21 - USAR1_RX
40+
PB_8, // D22
41+
PB_12, // D23
42+
PC_13, // D24
43+
PH_3 // D25 - BOOT0
44+
};
45+
46+
// Analog (Ax) pin number array
47+
const uint32_t analogInputPin[] = {
48+
17, // A0, PB3
49+
18, // A1, PB4
50+
16, // A2, PB2
51+
10, // A3, PA10
52+
15, // A4, PA15
53+
13, // A5, PA13
54+
14, // A6, PA14
55+
11, // A7, PA11
56+
12 // A8, PA12
57+
};
58+
59+
// ----------------------------------------------------------------------------
60+
#ifdef __cplusplus
61+
extern "C" {
62+
#endif
63+
64+
/**
65+
* @brief System Clock Configuration
66+
* @param None
67+
* @retval None
68+
*/
69+
WEAK void SystemClock_Config(void)
70+
{
71+
RCC_OscInitTypeDef RCC_OscInitStruct = {};
72+
RCC_ClkInitTypeDef RCC_ClkInitStruct = {};
73+
74+
/** Configure the main internal regulator output voltage
75+
*/
76+
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
77+
/** Initializes the CPU, AHB and APB busses clocks
78+
*/
79+
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_MSI;
80+
RCC_OscInitStruct.MSIState = RCC_MSI_ON;
81+
RCC_OscInitStruct.MSICalibrationValue = RCC_MSICALIBRATION_DEFAULT;
82+
RCC_OscInitStruct.MSIClockRange = RCC_MSIRANGE_11;
83+
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
84+
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
85+
Error_Handler();
86+
}
87+
/** Configure the SYSCLKSource, HCLK, PCLK1 and PCLK2 clocks dividers
88+
*/
89+
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK3 | RCC_CLOCKTYPE_HCLK
90+
| RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_PCLK1
91+
| RCC_CLOCKTYPE_PCLK2;
92+
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_MSI;
93+
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
94+
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
95+
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
96+
RCC_ClkInitStruct.AHBCLK3Divider = RCC_SYSCLK_DIV1;
97+
98+
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK) {
99+
Error_Handler();
100+
}
101+
}
102+
103+
#ifdef __cplusplus
104+
}
105+
#endif
106+
107+
#endif /* ARDUINO_RAK3172_MODULE */
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
/*
2+
*******************************************************************************
3+
* Copyright (c) 2020, STMicroelectronics
4+
* All rights reserved.
5+
*
6+
* This software component is licensed by ST under BSD 3-Clause license,
7+
* the "License"; You may not use this file except in compliance with the
8+
* License. You may obtain a copy of the License at:
9+
* opensource.org/licenses/BSD-3-Clause
10+
*
11+
*******************************************************************************
12+
*/
13+
#pragma once
14+
15+
/*----------------------------------------------------------------------------
16+
* STM32 pins number
17+
*----------------------------------------------------------------------------*/
18+
#define PA0 0
19+
#define PA1 1
20+
#define PA2 2
21+
#define PA3 3
22+
#define PA4 4
23+
#define PA5 5
24+
#define PA6 6
25+
#define PA7 7
26+
#define PA8 8
27+
#define PA9 9
28+
#define PA10 PIN_A3
29+
#define PA11 PIN_A7
30+
#define PA12 PIN_A8
31+
#define PA13 PIN_A5
32+
#define PA14 PIN_A6
33+
#define PA15 PIN_A4
34+
#define PB2 PIN_A2
35+
#define PB3 PIN_A0
36+
#define PB4 PIN_A1
37+
#define PB5 19
38+
#define PB6 20
39+
#define PB7 21
40+
#define PB8 22
41+
#define PB12 23
42+
#define PC13 24
43+
#define PH3 25
44+
45+
// Not available
46+
// PB0
47+
// PC14
48+
// PC15
49+
50+
// Alternate pins number
51+
#define PA1_ALT1 (PA1 | ALT1)
52+
#define PA2_ALT1 (PA2 | ALT1)
53+
#define PA3_ALT1 (PA3 | ALT1)
54+
#define PA4_ALT1 (PA4 | ALT1)
55+
#define PA5_ALT1 (PA5 | ALT1)
56+
#define PA6_ALT1 (PA6 | ALT1)
57+
#define PA7_ALT1 (PA7 | ALT1)
58+
#define PB8_ALT1 (PB8 | ALT1)
59+
60+
#define NUM_DIGITAL_PINS 26
61+
#define NUM_ANALOG_INPUTS 9
62+
63+
// On-board LED pin number
64+
#ifndef LED_BUILTIN
65+
#define LED_BUILTIN PNUM_NOT_DEFINED
66+
#endif
67+
68+
// On-board user button
69+
#ifndef USER_BTN
70+
#define USER_BTN PNUM_NOT_DEFINED
71+
#endif
72+
73+
// SPI definitions
74+
#ifndef PIN_SPI_SS
75+
#define PIN_SPI_SS PA4
76+
#endif
77+
#ifndef PIN_SPI_SS1
78+
#define PIN_SPI_SS1 PB2
79+
#endif
80+
#ifndef PIN_SPI_SS2
81+
#define PIN_SPI_SS2 PNUM_NOT_DEFINED
82+
#endif
83+
#ifndef PIN_SPI_SS3
84+
#define PIN_SPI_SS3 PNUM_NOT_DEFINED
85+
#endif
86+
#ifndef PIN_SPI_MOSI
87+
#define PIN_SPI_MOSI PA7
88+
#endif
89+
#ifndef PIN_SPI_MISOSPI1_SCK
90+
#define PIN_SPI_MISO PA6
91+
#endif
92+
#ifndef PIN_SPI_SCK
93+
#define PIN_SPI_SCK PA5
94+
#endif
95+
96+
// I2C definitions
97+
#ifndef PIN_WIRE_SDA
98+
#define PIN_WIRE_SDA PA11
99+
#endif
100+
#ifndef PIN_WIRE_SCL
101+
#define PIN_WIRE_SCL PA12
102+
#endif
103+
104+
// Timer Definitions
105+
// Use TIM6/TIM7 when possible as servo and tone don't need GPIO output pin
106+
#ifndef TIMER_TONE
107+
#define TIMER_TONE TIM16
108+
#endif
109+
#ifndef TIMER_SERVO
110+
#define TIMER_SERVO TIM17
111+
#endif
112+
113+
// UART Definitions
114+
#ifndef SERIAL_UART_INSTANCE
115+
#define SERIAL_UART_INSTANCE 101
116+
#endif
117+
118+
// Default pin used for generic 'Serial' instance
119+
// Mandatory for Firmata
120+
#ifndef PIN_SERIAL_RX
121+
#define PIN_SERIAL_RX PA3
122+
#endif
123+
#ifndef PIN_SERIAL_TX
124+
#define PIN_SERIAL_TX PA2
125+
#endif
126+
127+
// Alias
128+
#ifndef DEBUG_SUBGHZSPI_MOSI
129+
#define DEBUG_SUBGHZSPI_MOSI PA7_ALT1
130+
#endif
131+
#ifndef DEBUG_SUBGHZSPI_MISO
132+
#define DEBUG_SUBGHZSPI_MISO PA6_ALT1
133+
#endif
134+
#ifndef DEBUG_SUBGHZSPI_SCLK
135+
#define DEBUG_SUBGHZSPI_SCLK PA5_ALT1
136+
#endif
137+
#ifndef DEBUG_SUBGHZSPI_SS
138+
#define DEBUG_SUBGHZSPI_SS PA4_ALT1
139+
#endif
140+
141+
// Extra HAL modules
142+
#if !defined(HAL_DAC_MODULE_DISABLED)
143+
#define HAL_DAC_MODULE_ENABLED
144+
#endif
145+
146+
// LoRaWAN definitions
147+
#define LORAWAN_BOARD_HAS_TCXO 0U
148+
#define LORAWAN_BOARD_HAS_DCDC 1U
149+
#define LORAWAN_TX_CONFIG RBI_CONF_RFO_HP
150+
151+
#define LORAWAN_RFSWITCH_PINS PB8, PC13
152+
#define LORAWAN_RFSWITCH_PIN_COUNT 2
153+
#define LORAWAN_RFSWITCH_OFF_VALUES LOW, LOW
154+
#define LORAWAN_RFSWITCH_RX_VALUES HIGH, LOW
155+
#define LORAWAN_RFSWITCH_RFO_LP_VALUES LOW, HIGH
156+
#define LORAWAN_RFSWITCH_RFO_HP_VALUES LOW, HIGH
157+
158+
/*----------------------------------------------------------------------------
159+
* Arduino objects - C++ only
160+
*----------------------------------------------------------------------------*/
161+
162+
#ifdef __cplusplus
163+
// These serial port names are intended to allow libraries and architecture-neutral
164+
// sketches to automatically default to the correct port name for a particular type
165+
// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
166+
// the first hardware serial port whose RX/TX pins are not dedicated to another use.
167+
//
168+
// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor
169+
//
170+
// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial
171+
//
172+
// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library
173+
//
174+
// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins.
175+
//
176+
// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX
177+
// pins are NOT connected to anything by default.
178+
#ifndef SERIAL_PORT_MONITOR
179+
#define SERIAL_PORT_MONITOR Serial
180+
#endif
181+
#ifndef SERIAL_PORT_HARDWARE
182+
#define SERIAL_PORT_HARDWARE Serial
183+
#endif
184+
#endif

0 commit comments

Comments
 (0)