Skip to content

Commit 13d24b4

Browse files
authored
Merge pull request #413 from qmk-arterytek/at32f415_patch
Another update for AT32F415
2 parents b643aad + e23c474 commit 13d24b4

File tree

95 files changed

+5739
-248
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+5739
-248
lines changed

demos/AT32/RT-AT-START-F415/.cproject

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
</cconfiguration>
3838
</storageModule>
3939
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
40-
<project id="RT-STM32F103-MAPLEMINI.null.1831709739" name="RT-STM32F103-MAPLEMINI"/>
40+
<project id="RT-AT-START-F415.null.1831709739" name="RT-AT-START-F415"/>
4141
</storageModule>
4242
<storageModule moduleId="scannerConfiguration">
4343
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
@@ -48,7 +48,7 @@
4848
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
4949
<storageModule moduleId="refreshScope" versionNumber="2">
5050
<configuration configurationName="Default">
51-
<resource resourceType="PROJECT" workspacePath="/RT-STM32F103-MAPLEMINI"/>
51+
<resource resourceType="PROJECT" workspacePath="/RT-AT-START-F415"/>
5252
</configuration>
5353
</storageModule>
5454
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>

demos/AT32/RT-AT-START-F415/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ include $(CHIBIOS)/os/license/license.mk
105105
# Startup files.
106106
include $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_at32f415.mk
107107
# HAL-OSAL files (optional).
108-
include $(CHIBIOS)/os/hal/hal.mk
108+
include $(CHIBIOS_CONTRIB)/os/hal/hal.mk
109109
include $(CHIBIOS_CONTRIB)/os/hal/ports/AT32/AT32F415/platform.mk
110110
include $(CHIBIOS_CONTRIB)/os/hal/boards/AT_START_F415/board.mk
111111
include $(CHIBIOS)/os/hal/osal/rt-nil/osal.mk

demos/AT32/RT-AT-START-F415/cfg/config.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/*
2-
ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
32
ChibiOS - Copyright (C) 2023..2024 HorrorTroll
43
ChibiOS - Copyright (C) 2023..2024 Zhaqian
54
@@ -16,6 +15,16 @@
1615
limitations under the License.
1716
*/
1817

18+
/*
19+
* CRC driver system settings.
20+
*/
21+
#define AT32_CRC_USE_CRC1 FALSE
22+
23+
#define CRC_USE_DMA FALSE
24+
#define AT32_CRC_CRC1_DMA_PRIORITY 2
25+
#define AT32_CRC_CRC1_IRQ_PRIORITY 5
26+
#define AT32_CRC_CRC1_DMA_STREAM AT32_DMA1_STREAM2
27+
1928
/*
2029
* I2C fallback driver system settings.
2130
*/

demos/AT32/RT-AT-START-F415/cfg/halconf.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,8 @@
550550
#define WSPI_USE_MUTUAL_EXCLUSION TRUE
551551
#endif
552552

553+
#include "halconf_community.h"
554+
553555
#endif /* HALCONF_H */
554556

555557
/** @} */
Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
/*
2+
ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess
3+
ChibiOS - Copyright (C) 2023..2024 HorrorTroll
4+
ChibiOS - Copyright (C) 2023..2024 Zhaqian
5+
6+
Licensed under the Apache License, Version 2.0 (the "License");
7+
you may not use this file except in compliance with the License.
8+
You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing, software
13+
distributed under the License is distributed on an "AS IS" BASIS,
14+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
See the License for the specific language governing permissions and
16+
limitations under the License.
17+
*/
18+
19+
#ifndef HALCONF_COMMUNITY_H
20+
#define HALCONF_COMMUNITY_H
21+
22+
/**
23+
* @brief Enables the community overlay.
24+
*/
25+
#if !defined(HAL_USE_COMMUNITY) || defined(__DOXYGEN__)
26+
#define HAL_USE_COMMUNITY TRUE
27+
#endif
28+
29+
/**
30+
* @brief Enables the FSMC subsystem.
31+
*/
32+
#if !defined(HAL_USE_FSMC) || defined(__DOXYGEN__)
33+
#define HAL_USE_FSMC FALSE
34+
#endif
35+
36+
/**
37+
* @brief Enables the NAND subsystem.
38+
*/
39+
#if !defined(HAL_USE_NAND) || defined(__DOXYGEN__)
40+
#define HAL_USE_NAND FALSE
41+
#endif
42+
43+
/**
44+
* @brief Enables the 1-wire subsystem.
45+
*/
46+
#if !defined(HAL_USE_ONEWIRE) || defined(__DOXYGEN__)
47+
#define HAL_USE_ONEWIRE FALSE
48+
#endif
49+
50+
/**
51+
* @brief Enables the EICU subsystem.
52+
*/
53+
#if !defined(HAL_USE_EICU) || defined(__DOXYGEN__)
54+
#define HAL_USE_EICU FALSE
55+
#endif
56+
57+
/**
58+
* @brief Enables the CRC subsystem.
59+
*/
60+
#if !defined(HAL_USE_CRC) || defined(__DOXYGEN__)
61+
#define HAL_USE_CRC FALSE
62+
#endif
63+
64+
/**
65+
* @brief Enables the RNG subsystem.
66+
*/
67+
#if !defined(HAL_USE_RNG) || defined(__DOXYGEN__)
68+
#define HAL_USE_RNG FALSE
69+
#endif
70+
71+
/**
72+
* @brief Enables the EEPROM subsystem.
73+
*/
74+
#if !defined(HAL_USE_EEPROM) || defined(__DOXYGEN__)
75+
#define HAL_USE_EEPROM FALSE
76+
#endif
77+
78+
/**
79+
* @brief Enables the TIMCAP subsystem.
80+
*/
81+
#if !defined(HAL_USE_TIMCAP) || defined(__DOXYGEN__)
82+
#define HAL_USE_TIMCAP FALSE
83+
#endif
84+
85+
/**
86+
* @brief Enables the COMP subsystem.
87+
*/
88+
#if !defined(HAL_USE_COMP) || defined(__DOXYGEN__)
89+
#define HAL_USE_COMP FALSE
90+
#endif
91+
92+
/**
93+
* @brief Enables the OPAMP subsystem.
94+
*/
95+
#if !defined(HAL_USE_OPAMP) || defined(__DOXYGEN__)
96+
#define HAL_USE_OPAMP FALSE
97+
#endif
98+
99+
/**
100+
* @brief Enables the QEI subsystem.
101+
*/
102+
#if !defined(HAL_USE_QEI) || defined(__DOXYGEN__)
103+
#define HAL_USE_QEI FALSE
104+
#endif
105+
106+
/**
107+
* @brief Enables the USBH subsystem.
108+
*/
109+
#if !defined(HAL_USE_USBH) || defined(__DOXYGEN__)
110+
#define HAL_USE_USBH FALSE
111+
#endif
112+
113+
/**
114+
* @brief Enables the USB_MSD subsystem.
115+
*/
116+
#if !defined(HAL_USE_USB_MSD) || defined(__DOXYGEN__)
117+
#define HAL_USE_USB_MSD FALSE
118+
#endif
119+
120+
/*===========================================================================*/
121+
/* FSMCNAND driver related settings. */
122+
/*===========================================================================*/
123+
124+
/**
125+
* @brief Enables the @p nandAcquireBus() and @p nanReleaseBus() APIs.
126+
* @note Disabling this option saves both code and data space.
127+
*/
128+
#if !defined(NAND_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
129+
#define NAND_USE_MUTUAL_EXCLUSION TRUE
130+
#endif
131+
132+
/*===========================================================================*/
133+
/* 1-wire driver related settings. */
134+
/*===========================================================================*/
135+
/**
136+
* @brief Enables strong pull up feature.
137+
* @note Disabling this option saves both code and data space.
138+
*/
139+
#define ONEWIRE_USE_STRONG_PULLUP FALSE
140+
141+
/**
142+
* @brief Enables search ROM feature.
143+
* @note Disabling this option saves both code and data space.
144+
*/
145+
#define ONEWIRE_USE_SEARCH_ROM TRUE
146+
147+
/*===========================================================================*/
148+
/* QEI driver related settings. */
149+
/*===========================================================================*/
150+
151+
/**
152+
* @brief Enables discard of overlow
153+
*/
154+
#if !defined(QEI_USE_OVERFLOW_DISCARD) || defined(__DOXYGEN__)
155+
#define QEI_USE_OVERFLOW_DISCARD FALSE
156+
#endif
157+
158+
/**
159+
* @brief Enables min max of overlow
160+
*/
161+
#if !defined(QEI_USE_OVERFLOW_MINMAX) || defined(__DOXYGEN__)
162+
#define QEI_USE_OVERFLOW_MINMAX FALSE
163+
#endif
164+
165+
/*===========================================================================*/
166+
/* EEProm driver related settings. */
167+
/*===========================================================================*/
168+
169+
/**
170+
* @brief Enables 24xx series I2C eeprom device driver.
171+
* @note Disabling this option saves both code and data space.
172+
*/
173+
#define EEPROM_USE_EE24XX FALSE
174+
/**
175+
* @brief Enables 25xx series SPI eeprom device driver.
176+
* @note Disabling this option saves both code and data space.
177+
*/
178+
#define EEPROM_USE_EE25XX FALSE
179+
180+
#endif /* HALCONF_COMMUNITY_H */
181+
182+
/** @} */

demos/AT32/RT-AT-START-F415/cfg/mcuconf.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
#define AT32_USBDIV AT32_USBDIV_DIV3
6464
#define AT32_CLKOUT_SEL AT32_CLKOUT_SEL_NOCLOCK
6565
#define AT32_CLKOUTDIV AT32_CLKOUTDIV_DIV1
66-
#define AT32_ERTCSEL AT32_ERTCSEL_HEXTDIV
66+
#define AT32_ERTCSEL AT32_ERTCSEL_NOCLOCK
6767
#define AT32_PVM_ENABLE FALSE
6868
#define AT32_PVMSEL AT32_PVMSEL_LEV1
6969

@@ -136,10 +136,10 @@
136136
#define AT32_I2C_USE_I2C1 FALSE
137137
#define AT32_I2C_USE_I2C2 FALSE
138138
#define AT32_I2C_BUSY_TIMEOUT 50
139-
#define AT32_I2C_I2C1_IRQ_PRIORITY 5
140-
#define AT32_I2C_I2C2_IRQ_PRIORITY 5
141139
#define AT32_I2C_I2C1_DMA_PRIORITY 3
142140
#define AT32_I2C_I2C2_DMA_PRIORITY 3
141+
#define AT32_I2C_I2C1_IRQ_PRIORITY 5
142+
#define AT32_I2C_I2C2_IRQ_PRIORITY 5
143143
#define AT32_I2C_DMA_ERROR_HOOK(i2cp) osalSysHalt("DMA failure")
144144

145145
/*
@@ -216,9 +216,13 @@
216216
#define AT32_UART_USE_USART1 FALSE
217217
#define AT32_UART_USE_USART2 FALSE
218218
#define AT32_UART_USE_USART3 FALSE
219+
#define AT32_UART_USE_UART4 FALSE
220+
#define AT32_UART_USE_UART5 FALSE
219221
#define AT32_UART_USART1_DMA_PRIORITY 0
220222
#define AT32_UART_USART2_DMA_PRIORITY 0
221223
#define AT32_UART_USART3_DMA_PRIORITY 0
224+
#define AT32_UART_UART4_DMA_PRIORITY 0
225+
#define AT32_UART_UART5_DMA_PRIORITY 0
222226
#define AT32_UART_DMA_ERROR_HOOK(uartp) osalSysHalt("DMA failure")
223227

224228
/*

demos/AT32/RT-AT-START-F415/main.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,11 @@ static THD_FUNCTION(Thread1, arg) {
3131
(void)arg;
3232
chRegSetThreadName("blinker");
3333
while (true) {
34-
palSetLine(LINE_LED_RED);
34+
palToggleLine(LINE_LED_RED);
3535
chThdSleepMilliseconds(250);
36-
palSetLine(LINE_LED_YELLOW);
36+
palToggleLine(LINE_LED_YELLOW);
3737
chThdSleepMilliseconds(250);
38-
palSetLine(LINE_LED_GREEN);
39-
chThdSleepMilliseconds(250);
40-
palClearLine(LINE_LED_RED);
41-
chThdSleepMilliseconds(250);
42-
palClearLine(LINE_LED_YELLOW);
43-
chThdSleepMilliseconds(250);
44-
palClearLine(LINE_LED_GREEN);
38+
palToggleLine(LINE_LED_GREEN);
4539
chThdSleepMilliseconds(250);
4640
}
4741
}

os/hal/boards/AT_START_F415/board.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ bool sdc_lld_is_card_inserted(SDCDriver *sdcp) {
7979

8080
if (blkIsTransferring(sdcp))
8181
return last_status;
82-
return last_status = (bool)palReadPad(GPIOA, GPIOA_ARD_A2);
82+
return last_status = (bool)palReadPad(GPIOC, GPIOC_PIN11);
8383
}
8484

8585
/**

os/hal/boards/AT_START_F415/board.h

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -183,21 +183,21 @@
183183
* 6 - Open Drain output 2MHz.
184184
* 7 - Open Drain output 50MHz.
185185
* 8 - Digital input with Pull-Up or Pull-Down resistor depending on ODT.
186-
* 9 - Alternate Push Pull output 10MHz.
187-
* A - Alternate Push Pull output 2MHz.
188-
* B - Alternate Push Pull output 50MHz.
186+
* 9 - Multiplexing Push Pull output 10MHz.
187+
* A - Multiplexing Push Pull output 2MHz.
188+
* B - Multiplexing Push Pull output 50MHz.
189189
* C - Reserved.
190-
* D - Alternate Open Drain output 10MHz.
191-
* E - Alternate Open Drain output 2MHz.
192-
* F - Alternate Open Drain output 50MHz.
190+
* D - Multiplexing Open Drain output 10MHz.
191+
* E - Multiplexing Open Drain output 2MHz.
192+
* F - Multiplexing Open Drain output 50MHz.
193193
* Please refer to the AT32 Reference Manual for details.
194194
*/
195195

196196
/*
197197
* Port A setup.
198198
* Everything input with pull-up except:
199199
* PA0 - Normal input (GPIOA_BUTTON).
200-
* PA9 - Alternate output (GPIOA_ARD_D8).
200+
* PA9 - Multiplexing output (GPIOA_ARD_D8).
201201
* PA10 - Normal input (GPIOA_ARD_D2).
202202
*/
203203
#define VAL_GPIOACFGLR 0x88888884 /* PA7...PA0 */
@@ -217,19 +217,25 @@
217217
* PC2 - Push Pull output (GPIOC_LED_RED).
218218
* PC3 - Push Pull output (GPIOC_LED_YELLOW).
219219
* PC5 - Push Pull output (GPIOC_LED_GREEN).
220+
* PC8 - Multiplexing output (GPIOC_PIN8).
221+
* PC9 - Multiplexing output (GPIOC_PIN9).
222+
* PC10 - Multiplexing output (GPIOC_PIN10).
223+
* PC11 - Multiplexing output (GPIOC_PIN11).
224+
* PC12 - Multiplexing output (GPIOC_PIN12).
220225
* PC13 - Normal input (GPIOC_BUTTON).
221226
*/
222227
#define VAL_GPIOCCFGLR 0x88383388 /* PC7...PC0 */
223-
#define VAL_GPIOCCFGHR 0x88488888 /* PC15...PC8 */
228+
#define VAL_GPIOCCFGHR 0x884BBBBB /* PC15...PC8 */
224229
#define VAL_GPIOCODT 0xFFFFFFFF
225230

226231
/*
227232
* Port D setup.
228233
* Everything input with pull-up except:
229234
* PD0 - Normal input (GPIOD_HEXT_IN).
230235
* PD1 - Normal input (GPIOD_HEXT_OUT).
236+
* PD2 - Multiplexing output (GPIOD_PIN2).
231237
*/
232-
#define VAL_GPIODCFGLR 0x88888844 /* PD7...PD0 */
238+
#define VAL_GPIODCFGLR 0x88888B44 /* PD7...PD0 */
233239
#define VAL_GPIODCFGHR 0x88888888 /* PD15...PD8 */
234240
#define VAL_GPIODODT 0xFFFFFFFF
235241

os/hal/include/hal_crc.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,7 @@ typedef enum {
7474

7575
#if STM32_CRC_USE_CRC1 == TRUE
7676
#include "hal_crc_lld.h"
77-
#endif
78-
79-
#if CRCSW_USE_CRC1 == TRUE
77+
#else
8078
#include "crcsw.h" /* Include software LL driver */
8179
#endif
8280

0 commit comments

Comments
 (0)