Skip to content

Commit fce99f3

Browse files
megamind4089MariappanMariappan Ramasamysadekbaroudi
authored
[Controller] Added board config for custom controller STeMCell (#16287)
Co-authored-by: Mariappan Ramasamy <947300+Mariappan@users.noreply.github.com> Co-authored-by: Mariappan Ramasamy <maari@basis-ai.com> Co-authored-by: Sadek Baroudi <sadekbaroudi@gmail.com>
1 parent ba04ecf commit fce99f3

File tree

11 files changed

+411
-1
lines changed

11 files changed

+411
-1
lines changed

builddefs/common_features.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ else
212212
ifeq ($(PLATFORM),AVR)
213213
# Automatically provided by avr-libc, nothing required
214214
else ifeq ($(PLATFORM),CHIBIOS)
215-
ifneq ($(filter STM32F3xx_% STM32F1xx_% %_STM32F401xC %_STM32F401xE %_STM32F405xG %_STM32F411xE %_STM32F072xB %_STM32F042x6 %_GD32VF103xB %_GD32VF103x8, $(MCU_SERIES)_$(MCU_LDSCRIPT)),)
215+
ifneq ($(filter STM32F3xx_% STM32F1xx_% STM32F4xx_% %_STM32F401xC %_STM32F401xE %_STM32F405xG %_STM32F411xE %_STM32F072xB %_STM32F042x6 %_GD32VF103xB %_GD32VF103x8, $(MCU_SERIES)_$(MCU_LDSCRIPT)),)
216216
# Emulated EEPROM
217217
OPT_DEFS += -DEEPROM_DRIVER -DEEPROM_STM32_FLASH_EMULATED
218218
COMMON_VPATH += $(PLATFORM_PATH)/$(PLATFORM_KEY)/$(DRIVER_DIR)/flash

data/mappings/defaults.json

+6
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@
5454
"processor": "STM32F411",
5555
"bootloader": "stm32-dfu",
5656
"board": "BLACKPILL_STM32_F411"
57+
},
58+
"stemcell": {
59+
"processor": "STM32F411",
60+
"bootloader": "tinyuf2",
61+
"board": "STEMCELL",
62+
"pin_compatible": "promicro"
5763
}
5864
}
5965
}

docs/feature_converters.md

+22
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Currently the following converters are available:
1515
| `promicro` | `promicro_rp2040` |
1616
| `promicro` | `blok` |
1717
| `promicro` | `bit_c_pro` |
18+
| `promicro` | `stemcell` |
1819

1920
See below for more in depth information on each converter.
2021

@@ -56,6 +57,7 @@ If a board currently supported in QMK uses a [Pro Micro](https://www.sparkfun.co
5657
| [SparkFun Pro Micro - RP2040](https://www.sparkfun.com/products/18288) | `promicro_rp2040` |
5758
| [Blok](https://boardsource.xyz/store/628b95b494dfa308a6581622) | `blok` |
5859
| [Bit-C PRO](https://nullbits.co/bit-c-pro) | `bit_c_pro` |
60+
| [STeMCell](https://github.com/megamind4089/STeMCell) | `stemcell` |
5961

6062
Converter summary:
6163

@@ -66,6 +68,7 @@ Converter summary:
6668
| `promicro_rp2040` | `-e CONVERT_TO=promicro_rp2040` | `CONVERT_TO=promicro_rp2040` | `#ifdef CONVERT_TO_PROMICRO_RP2040` |
6769
| `blok` | `-e CONVERT_TO=blok` | `CONVERT_TO=blok` | `#ifdef CONVERT_TO_BLOK` |
6870
| `bit_c_pro` | `-e CONVERT_TO=bit_c_pro` | `CONVERT_TO=bit_c_pro` | `#ifdef CONVERT_TO_BIT_C_PRO` |
71+
| `stemcell` | `-e CONVERT_TO=stemcell` | `CONVERT_TO=stemcell` | `#ifdef CONVERT_TO_STEMCELL` |
6972

7073
### Proton C :id=proton_c
7174

@@ -99,3 +102,22 @@ The following defaults are based on what has been implemented for [RP2040](platf
99102
### SparkFun Pro Micro - RP2040, Blok, and Bit-C PRO :id=promicro_rp2040
100103

101104
Currently identical to [Adafruit KB2040](#kb2040).
105+
106+
### STeMCell :id=stemcell
107+
108+
Feature set currently identical to [Proton C](#proton_c).
109+
There are two versions of STeMCell available, with different pinouts:
110+
- v1.0.0
111+
- v2.0.0 (pre-release v1.0.1, v1.0.2)
112+
Default official firmware only supports v2.0.0 STeMCell.
113+
114+
STeMCell has support to swap UART and I2C pins, to enable single-wire uart communication in STM chips.
115+
116+
The following additional flags has to be used while compiling, based on the pin used for split communication.
117+
118+
| Split Pin | Compile flags |
119+
|-----------|---------------|
120+
| D3 | -e STMC_US=yes|
121+
| D2 | Not needed |
122+
| D1 | -e STMC_IS=yes|
123+
| D0 | Not needed |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Copyright 2022 Mega Mind (@megamind4089)
2+
# SPDX-License-Identifier: GPL-2.0-or-later
3+
4+
# Default pin config of nucleo64_411re has most pins in input pull up mode
5+
6+
# List of all the board related files.
7+
BOARDSRC = $(CHIBIOS)/os/hal/boards/ST_NUCLEO64_F411RE/board.c
8+
9+
# Required include directories
10+
BOARDINC = $(CHIBIOS)/os/hal/boards/ST_NUCLEO64_F411RE
11+
12+
13+
# Shared variables
14+
ALLCSRC += $(BOARDSRC)
15+
ALLINC += $(BOARDINC)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Copyright 2022 Mega Mind (@megamind4089)
2+
// SPDX-License-Identifier: GPL-2.0-or-later
3+
4+
#pragma once
5+
6+
#include_next "board.h"
7+
8+
#undef STM32_HSE_BYPASS
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Copyright 2022 Mega Mind (@megamind4089)
2+
// SPDX-License-Identifier: GPL-2.0-or-later
3+
4+
#pragma once
5+
6+
#define CH_CFG_ST_RESOLUTION 16
7+
#define CH_CFG_ST_FREQUENCY 10000
8+
9+
#include_next <chconf.h>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Copyright 2022 Mega Mind(@megamind4089)
2+
// SPDX-License-Identifier: GPL-2.0-or-later
3+
4+
#pragma once
5+
6+
#ifndef EARLY_INIT_PERFORM_BOOTLOADER_JUMP
7+
# define EARLY_INIT_PERFORM_BOOTLOADER_JUMP TRUE
8+
#endif
9+
10+
/**======================
11+
** I2C Driver
12+
*========================**/
13+
14+
#if !defined(I2C1_SDA_PIN)
15+
# define I2C1_SDA_PIN D0
16+
#endif
17+
18+
#if !defined(I2C1_SCL_PIN)
19+
# define I2C1_SCL_PIN D1
20+
#endif
21+
22+
/**======================
23+
** SERIAL Driver
24+
*========================**/
25+
26+
#if !defined(SERIAL_USART_DRIVER)
27+
# define SERIAL_USART_DRIVER SD2
28+
#endif
29+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Copyright 2022 Mega Mind (@megamind4089)
2+
// SPDX-License-Identifier: GPL-2.0-or-later
3+
4+
#pragma once
5+
6+
#define PAL_USE_WAIT TRUE
7+
#define PAL_USE_CALLBACKS TRUE
8+
#define HAL_USE_I2C TRUE
9+
#define HAL_USE_SERIAL TRUE
10+
11+
#include_next <halconf.h>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,231 @@
1+
// Copyright 2022 Mega Mind (@megamind4089)
2+
// SPDX-License-Identifier: GPL-2.0-or-later
3+
4+
#ifndef MCUCONF_H
5+
#define MCUCONF_H
6+
7+
/*
8+
* STM32F4xx drivers configuration.
9+
* The following settings override the default settings present in
10+
* the various device driver implementation headers.
11+
* Note that the settings for each driver only have effect if the whole
12+
* driver is enabled in halconf.h.
13+
*
14+
* IRQ priorities:
15+
* 15...0 Lowest...Highest.
16+
*
17+
* DMA priorities:
18+
* 0...3 Lowest...Highest.
19+
*/
20+
21+
#define STM32F4xx_MCUCONF
22+
#define STM32F411_MCUCONF
23+
24+
/*
25+
* HAL driver system settings.
26+
*/
27+
#define STM32_NO_INIT FALSE
28+
#define STM32_PVD_ENABLE FALSE
29+
#define STM32_PLS STM32_PLS_LEV0
30+
#define STM32_BKPRAM_ENABLE FALSE
31+
#define STM32_HSI_ENABLED TRUE
32+
#define STM32_LSI_ENABLED TRUE
33+
#define STM32_HSE_ENABLED TRUE
34+
#define STM32_LSE_ENABLED FALSE
35+
#define STM32_CLOCK48_REQUIRED TRUE
36+
#define STM32_SW STM32_SW_PLL
37+
#define STM32_PLLSRC STM32_PLLSRC_HSE
38+
#define STM32_PLLM_VALUE 8
39+
#define STM32_PLLN_VALUE 336
40+
#define STM32_PLLP_VALUE 4
41+
#define STM32_PLLQ_VALUE 7
42+
#define STM32_HPRE STM32_HPRE_DIV1
43+
#define STM32_PPRE1 STM32_PPRE1_DIV2
44+
#define STM32_PPRE2 STM32_PPRE2_DIV1
45+
#define STM32_RTCSEL STM32_RTCSEL_LSI
46+
#define STM32_RTCPRE_VALUE 8
47+
#define STM32_MCO1SEL STM32_MCO1SEL_HSI
48+
#define STM32_MCO1PRE STM32_MCO1PRE_DIV1
49+
#define STM32_MCO2SEL STM32_MCO2SEL_SYSCLK
50+
#define STM32_MCO2PRE STM32_MCO2PRE_DIV5
51+
#define STM32_I2SSRC STM32_I2SSRC_CKIN
52+
#define STM32_PLLI2SN_VALUE 192
53+
#define STM32_PLLI2SR_VALUE 5
54+
55+
/*
56+
* IRQ system settings.
57+
*/
58+
#define STM32_IRQ_EXTI0_PRIORITY 6
59+
#define STM32_IRQ_EXTI1_PRIORITY 6
60+
#define STM32_IRQ_EXTI2_PRIORITY 6
61+
#define STM32_IRQ_EXTI3_PRIORITY 6
62+
#define STM32_IRQ_EXTI4_PRIORITY 6
63+
#define STM32_IRQ_EXTI5_9_PRIORITY 6
64+
#define STM32_IRQ_EXTI10_15_PRIORITY 6
65+
#define STM32_IRQ_EXTI16_PRIORITY 6
66+
#define STM32_IRQ_EXTI17_PRIORITY 15
67+
#define STM32_IRQ_EXTI18_PRIORITY 6
68+
#define STM32_IRQ_EXTI19_PRIORITY 6
69+
#define STM32_IRQ_EXTI20_PRIORITY 6
70+
#define STM32_IRQ_EXTI21_PRIORITY 15
71+
#define STM32_IRQ_EXTI22_PRIORITY 15
72+
73+
#define STM32_IRQ_TIM1_BRK_TIM9_PRIORITY 7
74+
#define STM32_IRQ_TIM1_UP_TIM10_PRIORITY 7
75+
#define STM32_IRQ_TIM1_TRGCO_TIM11_PRIORITY 7
76+
#define STM32_IRQ_TIM1_CC_PRIORITY 7
77+
#define STM32_IRQ_TIM2_PRIORITY 7
78+
#define STM32_IRQ_TIM3_PRIORITY 7
79+
#define STM32_IRQ_TIM4_PRIORITY 7
80+
#define STM32_IRQ_TIM5_PRIORITY 7
81+
82+
#define STM32_IRQ_USART1_PRIORITY 12
83+
#define STM32_IRQ_USART2_PRIORITY 12
84+
#define STM32_IRQ_USART6_PRIORITY 12
85+
86+
/*
87+
* ADC driver system settings.
88+
*/
89+
#define STM32_ADC_ADCPRE ADC_CCR_ADCPRE_DIV4
90+
#define STM32_ADC_USE_ADC1 FALSE
91+
#define STM32_ADC_ADC1_DMA_STREAM STM32_DMA_STREAM_ID(2, 4)
92+
#define STM32_ADC_ADC1_DMA_PRIORITY 2
93+
#define STM32_ADC_IRQ_PRIORITY 6
94+
#define STM32_ADC_ADC1_DMA_IRQ_PRIORITY 6
95+
96+
/*
97+
* GPT driver system settings.
98+
*/
99+
#define STM32_GPT_USE_TIM1 FALSE
100+
#define STM32_GPT_USE_TIM2 FALSE
101+
#define STM32_GPT_USE_TIM3 FALSE
102+
#define STM32_GPT_USE_TIM4 FALSE
103+
#define STM32_GPT_USE_TIM5 FALSE
104+
#define STM32_GPT_USE_TIM9 FALSE
105+
#define STM32_GPT_USE_TIM10 FALSE
106+
#define STM32_GPT_USE_TIM11 FALSE
107+
108+
/*
109+
* I2C driver system settings.
110+
*/
111+
#define STM32_I2C_USE_I2C1 TRUE
112+
#define STM32_I2C_USE_I2C2 FALSE
113+
#define STM32_I2C_USE_I2C3 FALSE
114+
#define STM32_I2C_BUSY_TIMEOUT 50
115+
#define STM32_I2C_I2C1_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 0)
116+
#define STM32_I2C_I2C1_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 6)
117+
#define STM32_I2C_I2C2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 2)
118+
#define STM32_I2C_I2C2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7)
119+
#define STM32_I2C_I2C3_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 2)
120+
#define STM32_I2C_I2C3_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4)
121+
#define STM32_I2C_I2C1_IRQ_PRIORITY 5
122+
#define STM32_I2C_I2C2_IRQ_PRIORITY 5
123+
#define STM32_I2C_I2C3_IRQ_PRIORITY 5
124+
#define STM32_I2C_I2C1_DMA_PRIORITY 3
125+
#define STM32_I2C_I2C2_DMA_PRIORITY 3
126+
#define STM32_I2C_I2C3_DMA_PRIORITY 3
127+
#define STM32_I2C_DMA_ERROR_HOOK(i2cp) osalSysHalt("DMA failure")
128+
129+
/*
130+
* I2S driver system settings.
131+
*/
132+
#define STM32_I2S_USE_SPI2 FALSE
133+
#define STM32_I2S_USE_SPI3 FALSE
134+
#define STM32_I2S_SPI2_IRQ_PRIORITY 10
135+
#define STM32_I2S_SPI3_IRQ_PRIORITY 10
136+
#define STM32_I2S_SPI2_DMA_PRIORITY 1
137+
#define STM32_I2S_SPI3_DMA_PRIORITY 1
138+
#define STM32_I2S_SPI2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3)
139+
#define STM32_I2S_SPI2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4)
140+
#define STM32_I2S_SPI3_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 0)
141+
#define STM32_I2S_SPI3_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7)
142+
#define STM32_I2S_DMA_ERROR_HOOK(i2sp) osalSysHalt("DMA failure")
143+
144+
/*
145+
* ICU driver system settings.
146+
*/
147+
#define STM32_ICU_USE_TIM1 FALSE
148+
#define STM32_ICU_USE_TIM2 FALSE
149+
#define STM32_ICU_USE_TIM3 FALSE
150+
#define STM32_ICU_USE_TIM4 FALSE
151+
#define STM32_ICU_USE_TIM5 FALSE
152+
#define STM32_ICU_USE_TIM9 FALSE
153+
#define STM32_ICU_USE_TIM10 FALSE
154+
#define STM32_ICU_USE_TIM11 FALSE
155+
156+
/*
157+
* PWM driver system settings.
158+
*/
159+
#define STM32_PWM_USE_TIM1 FALSE
160+
#define STM32_PWM_USE_TIM2 FALSE
161+
#define STM32_PWM_USE_TIM3 FALSE
162+
#define STM32_PWM_USE_TIM4 FALSE
163+
#define STM32_PWM_USE_TIM5 FALSE
164+
#define STM32_PWM_USE_TIM9 FALSE
165+
#define STM32_PWM_USE_TIM10 FALSE
166+
#define STM32_PWM_USE_TIM11 FALSE
167+
168+
/*
169+
* SERIAL driver system settings.
170+
*/
171+
#define STM32_SERIAL_USE_USART1 TRUE
172+
#define STM32_SERIAL_USE_USART2 TRUE
173+
#define STM32_SERIAL_USE_USART6 FALSE
174+
175+
/*
176+
* SPI driver system settings.
177+
*/
178+
#define STM32_SPI_USE_SPI1 FALSE
179+
#define STM32_SPI_USE_SPI2 FALSE
180+
#define STM32_SPI_USE_SPI3 FALSE
181+
#define STM32_SPI_SPI1_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 0)
182+
#define STM32_SPI_SPI1_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 3)
183+
#define STM32_SPI_SPI2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3)
184+
#define STM32_SPI_SPI2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4)
185+
#define STM32_SPI_SPI3_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 0)
186+
#define STM32_SPI_SPI3_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7)
187+
#define STM32_SPI_SPI1_DMA_PRIORITY 1
188+
#define STM32_SPI_SPI2_DMA_PRIORITY 1
189+
#define STM32_SPI_SPI3_DMA_PRIORITY 1
190+
#define STM32_SPI_SPI1_IRQ_PRIORITY 10
191+
#define STM32_SPI_SPI2_IRQ_PRIORITY 10
192+
#define STM32_SPI_SPI3_IRQ_PRIORITY 10
193+
#define STM32_SPI_DMA_ERROR_HOOK(spip) osalSysHalt("DMA failure")
194+
195+
/*
196+
* ST driver system settings.
197+
*/
198+
#define STM32_ST_IRQ_PRIORITY 8
199+
#define STM32_ST_USE_TIMER 2
200+
201+
/*
202+
* UART driver system settings.
203+
*/
204+
#define STM32_UART_USE_USART1 FALSE
205+
#define STM32_UART_USE_USART2 FALSE
206+
#define STM32_UART_USE_USART6 FALSE
207+
#define STM32_UART_USART1_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 5)
208+
#define STM32_UART_USART1_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 7)
209+
#define STM32_UART_USART2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 5)
210+
#define STM32_UART_USART2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 6)
211+
#define STM32_UART_USART6_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 2)
212+
#define STM32_UART_USART6_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 7)
213+
#define STM32_UART_USART1_DMA_PRIORITY 0
214+
#define STM32_UART_USART2_DMA_PRIORITY 0
215+
#define STM32_UART_USART6_DMA_PRIORITY 0
216+
#define STM32_UART_DMA_ERROR_HOOK(uartp) osalSysHalt("DMA failure")
217+
218+
/*
219+
* USB driver system settings.
220+
*/
221+
#define STM32_USB_USE_OTG1 TRUE
222+
#define STM32_USB_OTG1_IRQ_PRIORITY 14
223+
#define STM32_USB_OTG1_RX_FIFO_SIZE 512
224+
#define STM32_USB_HOST_WAKEUP_DURATION 2
225+
226+
/*
227+
* WDG driver system settings.
228+
*/
229+
#define STM32_WDG_USE_IWDG FALSE
230+
231+
#endif /* MCUCONF_H */

0 commit comments

Comments
 (0)