├── .gitignore
├── Inc
├── main.h
├── stm32f4xx_hal_conf.h
└── stm32f4xx_it.h
├── LICENSE
├── Makefile
├── README.md
├── STM32F411RETx_FLASH.ld
├── Src
├── gpio.tmp
├── license.tmp
├── main.c
├── stm32f4xx_hal_msp.c
├── stm32f4xx_it.c
├── system.tmp
└── system_stm32f4xx.c
├── startup_stm32f411xe.s
└── stm32-i2c-lcd-1602.ioc
/.gitignore:
--------------------------------------------------------------------------------
1 | build
2 | *.backup
3 |
--------------------------------------------------------------------------------
/Inc/main.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * File Name : main.hpp
4 | * Description : This file contains the common defines of the application
5 | ******************************************************************************
6 | ** This notice applies to any and all portions of this file
7 | * that are not between comment pairs USER CODE BEGIN and
8 | * USER CODE END. Other portions of this file, whether
9 | * inserted by the user or by software development tools
10 | * are owned by their respective copyright owners.
11 | *
12 | * COPYRIGHT(c) 2018 STMicroelectronics
13 | *
14 | * Redistribution and use in source and binary forms, with or without modification,
15 | * are permitted provided that the following conditions are met:
16 | * 1. Redistributions of source code must retain the above copyright notice,
17 | * this list of conditions and the following disclaimer.
18 | * 2. Redistributions in binary form must reproduce the above copyright notice,
19 | * this list of conditions and the following disclaimer in the documentation
20 | * and/or other materials provided with the distribution.
21 | * 3. Neither the name of STMicroelectronics nor the names of its contributors
22 | * may be used to endorse or promote products derived from this software
23 | * without specific prior written permission.
24 | *
25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
28 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
29 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
31 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
32 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
33 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 | *
36 | ******************************************************************************
37 | */
38 | /* Define to prevent recursive inclusion -------------------------------------*/
39 | #ifndef __MAIN_H
40 | #define __MAIN_H
41 | /* Includes ------------------------------------------------------------------*/
42 |
43 | /* Includes ------------------------------------------------------------------*/
44 | /* USER CODE BEGIN Includes */
45 |
46 | /* USER CODE END Includes */
47 |
48 | /* Private define ------------------------------------------------------------*/
49 |
50 | #define B1_Pin GPIO_PIN_13
51 | #define B1_GPIO_Port GPIOC
52 | #define USART_TX_Pin GPIO_PIN_2
53 | #define USART_TX_GPIO_Port GPIOA
54 | #define USART_RX_Pin GPIO_PIN_3
55 | #define USART_RX_GPIO_Port GPIOA
56 | #define LD2_Pin GPIO_PIN_5
57 | #define LD2_GPIO_Port GPIOA
58 | #define TMS_Pin GPIO_PIN_13
59 | #define TMS_GPIO_Port GPIOA
60 | #define TCK_Pin GPIO_PIN_14
61 | #define TCK_GPIO_Port GPIOA
62 | #define SWO_Pin GPIO_PIN_3
63 | #define SWO_GPIO_Port GPIOB
64 |
65 | /* ########################## Assert Selection ############################## */
66 | /**
67 | * @brief Uncomment the line below to expanse the "assert_param" macro in the
68 | * HAL drivers code
69 | */
70 | /* #define USE_FULL_ASSERT 1U */
71 |
72 | /* USER CODE BEGIN Private defines */
73 |
74 | /* USER CODE END Private defines */
75 |
76 | #ifdef __cplusplus
77 | extern "C" {
78 | #endif
79 | void _Error_Handler(char *, int);
80 |
81 | #define Error_Handler() _Error_Handler(__FILE__, __LINE__)
82 | #ifdef __cplusplus
83 | }
84 | #endif
85 |
86 | /**
87 | * @}
88 | */
89 |
90 | /**
91 | * @}
92 | */
93 |
94 | #endif /* __MAIN_H */
95 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
96 |
--------------------------------------------------------------------------------
/Inc/stm32f4xx_hal_conf.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32f4xx_hal_conf.h
4 | * @brief HAL configuration file.
5 | ******************************************************************************
6 | * @attention
7 | *
8 | *
© COPYRIGHT(c) 2018 STMicroelectronics
9 | *
10 | * Redistribution and use in source and binary forms, with or without modification,
11 | * are permitted provided that the following conditions are met:
12 | * 1. Redistributions of source code must retain the above copyright notice,
13 | * this list of conditions and the following disclaimer.
14 | * 2. Redistributions in binary form must reproduce the above copyright notice,
15 | * this list of conditions and the following disclaimer in the documentation
16 | * and/or other materials provided with the distribution.
17 | * 3. Neither the name of STMicroelectronics nor the names of its contributors
18 | * may be used to endorse or promote products derived from this software
19 | * without specific prior written permission.
20 | *
21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | *
32 | ******************************************************************************
33 | */
34 |
35 | /* Define to prevent recursive inclusion -------------------------------------*/
36 | #ifndef __STM32F4xx_HAL_CONF_H
37 | #define __STM32F4xx_HAL_CONF_H
38 |
39 | #ifdef __cplusplus
40 | extern "C" {
41 | #endif
42 |
43 | #include "main.h"
44 | /* Exported types ------------------------------------------------------------*/
45 | /* Exported constants --------------------------------------------------------*/
46 |
47 | /* ########################## Module Selection ############################## */
48 | /**
49 | * @brief This is the list of modules to be used in the HAL driver
50 | */
51 | #define HAL_MODULE_ENABLED
52 |
53 | /* #define HAL_ADC_MODULE_ENABLED */
54 | /* #define HAL_CRYP_MODULE_ENABLED */
55 | /* #define HAL_CAN_MODULE_ENABLED */
56 | /* #define HAL_CRC_MODULE_ENABLED */
57 | /* #define HAL_CRYP_MODULE_ENABLED */
58 | /* #define HAL_DAC_MODULE_ENABLED */
59 | /* #define HAL_DCMI_MODULE_ENABLED */
60 | /* #define HAL_DMA2D_MODULE_ENABLED */
61 | /* #define HAL_ETH_MODULE_ENABLED */
62 | /* #define HAL_NAND_MODULE_ENABLED */
63 | /* #define HAL_NOR_MODULE_ENABLED */
64 | /* #define HAL_PCCARD_MODULE_ENABLED */
65 | /* #define HAL_SRAM_MODULE_ENABLED */
66 | /* #define HAL_SDRAM_MODULE_ENABLED */
67 | /* #define HAL_HASH_MODULE_ENABLED */
68 | #define HAL_I2C_MODULE_ENABLED
69 | /* #define HAL_I2S_MODULE_ENABLED */
70 | /* #define HAL_IWDG_MODULE_ENABLED */
71 | /* #define HAL_LTDC_MODULE_ENABLED */
72 | /* #define HAL_RNG_MODULE_ENABLED */
73 | /* #define HAL_RTC_MODULE_ENABLED */
74 | /* #define HAL_SAI_MODULE_ENABLED */
75 | /* #define HAL_SD_MODULE_ENABLED */
76 | /* #define HAL_MMC_MODULE_ENABLED */
77 | /* #define HAL_SPI_MODULE_ENABLED */
78 | /* #define HAL_TIM_MODULE_ENABLED */
79 | #define HAL_UART_MODULE_ENABLED
80 | /* #define HAL_USART_MODULE_ENABLED */
81 | /* #define HAL_IRDA_MODULE_ENABLED */
82 | /* #define HAL_SMARTCARD_MODULE_ENABLED */
83 | /* #define HAL_WWDG_MODULE_ENABLED */
84 | /* #define HAL_PCD_MODULE_ENABLED */
85 | /* #define HAL_HCD_MODULE_ENABLED */
86 | /* #define HAL_DSI_MODULE_ENABLED */
87 | /* #define HAL_QSPI_MODULE_ENABLED */
88 | /* #define HAL_QSPI_MODULE_ENABLED */
89 | /* #define HAL_CEC_MODULE_ENABLED */
90 | /* #define HAL_FMPI2C_MODULE_ENABLED */
91 | /* #define HAL_SPDIFRX_MODULE_ENABLED */
92 | /* #define HAL_DFSDM_MODULE_ENABLED */
93 | /* #define HAL_LPTIM_MODULE_ENABLED */
94 | #define HAL_GPIO_MODULE_ENABLED
95 | #define HAL_DMA_MODULE_ENABLED
96 | #define HAL_RCC_MODULE_ENABLED
97 | #define HAL_FLASH_MODULE_ENABLED
98 | #define HAL_PWR_MODULE_ENABLED
99 | #define HAL_CORTEX_MODULE_ENABLED
100 |
101 | /* ########################## HSE/HSI Values adaptation ##################### */
102 | /**
103 | * @brief Adjust the value of External High Speed oscillator (HSE) used in your application.
104 | * This value is used by the RCC HAL module to compute the system frequency
105 | * (when HSE is used as system clock source, directly or through the PLL).
106 | */
107 | #if !defined (HSE_VALUE)
108 | #define HSE_VALUE ((uint32_t)8000000U) /*!< Value of the External oscillator in Hz */
109 | #endif /* HSE_VALUE */
110 |
111 | #if !defined (HSE_STARTUP_TIMEOUT)
112 | #define HSE_STARTUP_TIMEOUT ((uint32_t)100U) /*!< Time out for HSE start up, in ms */
113 | #endif /* HSE_STARTUP_TIMEOUT */
114 |
115 | /**
116 | * @brief Internal High Speed oscillator (HSI) value.
117 | * This value is used by the RCC HAL module to compute the system frequency
118 | * (when HSI is used as system clock source, directly or through the PLL).
119 | */
120 | #if !defined (HSI_VALUE)
121 | #define HSI_VALUE ((uint32_t)16000000U) /*!< Value of the Internal oscillator in Hz*/
122 | #endif /* HSI_VALUE */
123 |
124 | /**
125 | * @brief Internal Low Speed oscillator (LSI) value.
126 | */
127 | #if !defined (LSI_VALUE)
128 | #define LSI_VALUE ((uint32_t)32000U) /*!< LSI Typical Value in Hz*/
129 | #endif /* LSI_VALUE */ /*!< Value of the Internal Low Speed oscillator in Hz
130 | The real value may vary depending on the variations
131 | in voltage and temperature.*/
132 | /**
133 | * @brief External Low Speed oscillator (LSE) value.
134 | */
135 | #if !defined (LSE_VALUE)
136 | #define LSE_VALUE ((uint32_t)32768U) /*!< Value of the External Low Speed oscillator in Hz */
137 | #endif /* LSE_VALUE */
138 |
139 | #if !defined (LSE_STARTUP_TIMEOUT)
140 | #define LSE_STARTUP_TIMEOUT ((uint32_t)5000U) /*!< Time out for LSE start up, in ms */
141 | #endif /* LSE_STARTUP_TIMEOUT */
142 |
143 | /**
144 | * @brief External clock source for I2S peripheral
145 | * This value is used by the I2S HAL module to compute the I2S clock source
146 | * frequency, this source is inserted directly through I2S_CKIN pad.
147 | */
148 | #if !defined (EXTERNAL_CLOCK_VALUE)
149 | #define EXTERNAL_CLOCK_VALUE ((uint32_t)12288000U) /*!< Value of the External audio frequency in Hz*/
150 | #endif /* EXTERNAL_CLOCK_VALUE */
151 |
152 | /* Tip: To avoid modifying this file each time you need to use different HSE,
153 | === you can define the HSE value in your toolchain compiler preprocessor. */
154 |
155 | /* ########################### System Configuration ######################### */
156 | /**
157 | * @brief This is the HAL system configuration section
158 | */
159 | #define VDD_VALUE ((uint32_t)3300U) /*!< Value of VDD in mv */
160 | #define TICK_INT_PRIORITY ((uint32_t)0U) /*!< tick interrupt priority */
161 | #define USE_RTOS 0U
162 | #define PREFETCH_ENABLE 1U
163 | #define INSTRUCTION_CACHE_ENABLE 1U
164 | #define DATA_CACHE_ENABLE 1U
165 |
166 | /* ########################## Assert Selection ############################## */
167 | /**
168 | * @brief Uncomment the line below to expanse the "assert_param" macro in the
169 | * HAL drivers code
170 | */
171 | /* #define USE_FULL_ASSERT 1U */
172 |
173 | /* ################## Ethernet peripheral configuration ##################### */
174 |
175 | /* Section 1 : Ethernet peripheral configuration */
176 |
177 | /* MAC ADDRESS: MAC_ADDR0:MAC_ADDR1:MAC_ADDR2:MAC_ADDR3:MAC_ADDR4:MAC_ADDR5 */
178 | #define MAC_ADDR0 2U
179 | #define MAC_ADDR1 0U
180 | #define MAC_ADDR2 0U
181 | #define MAC_ADDR3 0U
182 | #define MAC_ADDR4 0U
183 | #define MAC_ADDR5 0U
184 |
185 | /* Definition of the Ethernet driver buffers size and count */
186 | #define ETH_RX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for receive */
187 | #define ETH_TX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for transmit */
188 | #define ETH_RXBUFNB ((uint32_t)4U) /* 4 Rx buffers of size ETH_RX_BUF_SIZE */
189 | #define ETH_TXBUFNB ((uint32_t)4U) /* 4 Tx buffers of size ETH_TX_BUF_SIZE */
190 |
191 | /* Section 2: PHY configuration section */
192 |
193 | /* DP83848_PHY_ADDRESS Address*/
194 | #define DP83848_PHY_ADDRESS 0x01U
195 | /* PHY Reset delay these values are based on a 1 ms Systick interrupt*/
196 | #define PHY_RESET_DELAY ((uint32_t)0x000000FFU)
197 | /* PHY Configuration delay */
198 | #define PHY_CONFIG_DELAY ((uint32_t)0x00000FFFU)
199 |
200 | #define PHY_READ_TO ((uint32_t)0x0000FFFFU)
201 | #define PHY_WRITE_TO ((uint32_t)0x0000FFFFU)
202 |
203 | /* Section 3: Common PHY Registers */
204 |
205 | #define PHY_BCR ((uint16_t)0x0000U) /*!< Transceiver Basic Control Register */
206 | #define PHY_BSR ((uint16_t)0x0001U) /*!< Transceiver Basic Status Register */
207 |
208 | #define PHY_RESET ((uint16_t)0x8000U) /*!< PHY Reset */
209 | #define PHY_LOOPBACK ((uint16_t)0x4000U) /*!< Select loop-back mode */
210 | #define PHY_FULLDUPLEX_100M ((uint16_t)0x2100U) /*!< Set the full-duplex mode at 100 Mb/s */
211 | #define PHY_HALFDUPLEX_100M ((uint16_t)0x2000U) /*!< Set the half-duplex mode at 100 Mb/s */
212 | #define PHY_FULLDUPLEX_10M ((uint16_t)0x0100U) /*!< Set the full-duplex mode at 10 Mb/s */
213 | #define PHY_HALFDUPLEX_10M ((uint16_t)0x0000U) /*!< Set the half-duplex mode at 10 Mb/s */
214 | #define PHY_AUTONEGOTIATION ((uint16_t)0x1000U) /*!< Enable auto-negotiation function */
215 | #define PHY_RESTART_AUTONEGOTIATION ((uint16_t)0x0200U) /*!< Restart auto-negotiation function */
216 | #define PHY_POWERDOWN ((uint16_t)0x0800U) /*!< Select the power down mode */
217 | #define PHY_ISOLATE ((uint16_t)0x0400U) /*!< Isolate PHY from MII */
218 |
219 | #define PHY_AUTONEGO_COMPLETE ((uint16_t)0x0020U) /*!< Auto-Negotiation process completed */
220 | #define PHY_LINKED_STATUS ((uint16_t)0x0004U) /*!< Valid link established */
221 | #define PHY_JABBER_DETECTION ((uint16_t)0x0002U) /*!< Jabber condition detected */
222 |
223 | /* Section 4: Extended PHY Registers */
224 | #define PHY_SR ((uint16_t)0x10U) /*!< PHY status register Offset */
225 |
226 | #define PHY_SPEED_STATUS ((uint16_t)0x0002U) /*!< PHY Speed mask */
227 | #define PHY_DUPLEX_STATUS ((uint16_t)0x0004U) /*!< PHY Duplex mask */
228 |
229 | /* ################## SPI peripheral configuration ########################## */
230 |
231 | /* CRC FEATURE: Use to activate CRC feature inside HAL SPI Driver
232 | * Activated: CRC code is present inside driver
233 | * Deactivated: CRC code cleaned from driver
234 | */
235 |
236 | #define USE_SPI_CRC 0U
237 |
238 | /* Includes ------------------------------------------------------------------*/
239 | /**
240 | * @brief Include module's header file
241 | */
242 |
243 | #ifdef HAL_RCC_MODULE_ENABLED
244 | #include "stm32f4xx_hal_rcc.h"
245 | #endif /* HAL_RCC_MODULE_ENABLED */
246 |
247 | #ifdef HAL_GPIO_MODULE_ENABLED
248 | #include "stm32f4xx_hal_gpio.h"
249 | #endif /* HAL_GPIO_MODULE_ENABLED */
250 |
251 | #ifdef HAL_DMA_MODULE_ENABLED
252 | #include "stm32f4xx_hal_dma.h"
253 | #endif /* HAL_DMA_MODULE_ENABLED */
254 |
255 | #ifdef HAL_CORTEX_MODULE_ENABLED
256 | #include "stm32f4xx_hal_cortex.h"
257 | #endif /* HAL_CORTEX_MODULE_ENABLED */
258 |
259 | #ifdef HAL_ADC_MODULE_ENABLED
260 | #include "stm32f4xx_hal_adc.h"
261 | #endif /* HAL_ADC_MODULE_ENABLED */
262 |
263 | #ifdef HAL_CAN_MODULE_ENABLED
264 | #include "stm32f4xx_hal_can.h"
265 | #endif /* HAL_CAN_MODULE_ENABLED */
266 |
267 | #ifdef HAL_CRC_MODULE_ENABLED
268 | #include "stm32f4xx_hal_crc.h"
269 | #endif /* HAL_CRC_MODULE_ENABLED */
270 |
271 | #ifdef HAL_CRYP_MODULE_ENABLED
272 | #include "stm32f4xx_hal_cryp.h"
273 | #endif /* HAL_CRYP_MODULE_ENABLED */
274 |
275 | #ifdef HAL_DMA2D_MODULE_ENABLED
276 | #include "stm32f4xx_hal_dma2d.h"
277 | #endif /* HAL_DMA2D_MODULE_ENABLED */
278 |
279 | #ifdef HAL_DAC_MODULE_ENABLED
280 | #include "stm32f4xx_hal_dac.h"
281 | #endif /* HAL_DAC_MODULE_ENABLED */
282 |
283 | #ifdef HAL_DCMI_MODULE_ENABLED
284 | #include "stm32f4xx_hal_dcmi.h"
285 | #endif /* HAL_DCMI_MODULE_ENABLED */
286 |
287 | #ifdef HAL_ETH_MODULE_ENABLED
288 | #include "stm32f4xx_hal_eth.h"
289 | #endif /* HAL_ETH_MODULE_ENABLED */
290 |
291 | #ifdef HAL_FLASH_MODULE_ENABLED
292 | #include "stm32f4xx_hal_flash.h"
293 | #endif /* HAL_FLASH_MODULE_ENABLED */
294 |
295 | #ifdef HAL_SRAM_MODULE_ENABLED
296 | #include "stm32f4xx_hal_sram.h"
297 | #endif /* HAL_SRAM_MODULE_ENABLED */
298 |
299 | #ifdef HAL_NOR_MODULE_ENABLED
300 | #include "stm32f4xx_hal_nor.h"
301 | #endif /* HAL_NOR_MODULE_ENABLED */
302 |
303 | #ifdef HAL_NAND_MODULE_ENABLED
304 | #include "stm32f4xx_hal_nand.h"
305 | #endif /* HAL_NAND_MODULE_ENABLED */
306 |
307 | #ifdef HAL_PCCARD_MODULE_ENABLED
308 | #include "stm32f4xx_hal_pccard.h"
309 | #endif /* HAL_PCCARD_MODULE_ENABLED */
310 |
311 | #ifdef HAL_SDRAM_MODULE_ENABLED
312 | #include "stm32f4xx_hal_sdram.h"
313 | #endif /* HAL_SDRAM_MODULE_ENABLED */
314 |
315 | #ifdef HAL_HASH_MODULE_ENABLED
316 | #include "stm32f4xx_hal_hash.h"
317 | #endif /* HAL_HASH_MODULE_ENABLED */
318 |
319 | #ifdef HAL_I2C_MODULE_ENABLED
320 | #include "stm32f4xx_hal_i2c.h"
321 | #endif /* HAL_I2C_MODULE_ENABLED */
322 |
323 | #ifdef HAL_I2S_MODULE_ENABLED
324 | #include "stm32f4xx_hal_i2s.h"
325 | #endif /* HAL_I2S_MODULE_ENABLED */
326 |
327 | #ifdef HAL_IWDG_MODULE_ENABLED
328 | #include "stm32f4xx_hal_iwdg.h"
329 | #endif /* HAL_IWDG_MODULE_ENABLED */
330 |
331 | #ifdef HAL_LTDC_MODULE_ENABLED
332 | #include "stm32f4xx_hal_ltdc.h"
333 | #endif /* HAL_LTDC_MODULE_ENABLED */
334 |
335 | #ifdef HAL_PWR_MODULE_ENABLED
336 | #include "stm32f4xx_hal_pwr.h"
337 | #endif /* HAL_PWR_MODULE_ENABLED */
338 |
339 | #ifdef HAL_RNG_MODULE_ENABLED
340 | #include "stm32f4xx_hal_rng.h"
341 | #endif /* HAL_RNG_MODULE_ENABLED */
342 |
343 | #ifdef HAL_RTC_MODULE_ENABLED
344 | #include "stm32f4xx_hal_rtc.h"
345 | #endif /* HAL_RTC_MODULE_ENABLED */
346 |
347 | #ifdef HAL_SAI_MODULE_ENABLED
348 | #include "stm32f4xx_hal_sai.h"
349 | #endif /* HAL_SAI_MODULE_ENABLED */
350 |
351 | #ifdef HAL_SD_MODULE_ENABLED
352 | #include "stm32f4xx_hal_sd.h"
353 | #endif /* HAL_SD_MODULE_ENABLED */
354 |
355 | #ifdef HAL_MMC_MODULE_ENABLED
356 | #include "stm32f4xx_hal_mmc.h"
357 | #endif /* HAL_MMC_MODULE_ENABLED */
358 |
359 | #ifdef HAL_SPI_MODULE_ENABLED
360 | #include "stm32f4xx_hal_spi.h"
361 | #endif /* HAL_SPI_MODULE_ENABLED */
362 |
363 | #ifdef HAL_TIM_MODULE_ENABLED
364 | #include "stm32f4xx_hal_tim.h"
365 | #endif /* HAL_TIM_MODULE_ENABLED */
366 |
367 | #ifdef HAL_UART_MODULE_ENABLED
368 | #include "stm32f4xx_hal_uart.h"
369 | #endif /* HAL_UART_MODULE_ENABLED */
370 |
371 | #ifdef HAL_USART_MODULE_ENABLED
372 | #include "stm32f4xx_hal_usart.h"
373 | #endif /* HAL_USART_MODULE_ENABLED */
374 |
375 | #ifdef HAL_IRDA_MODULE_ENABLED
376 | #include "stm32f4xx_hal_irda.h"
377 | #endif /* HAL_IRDA_MODULE_ENABLED */
378 |
379 | #ifdef HAL_SMARTCARD_MODULE_ENABLED
380 | #include "stm32f4xx_hal_smartcard.h"
381 | #endif /* HAL_SMARTCARD_MODULE_ENABLED */
382 |
383 | #ifdef HAL_WWDG_MODULE_ENABLED
384 | #include "stm32f4xx_hal_wwdg.h"
385 | #endif /* HAL_WWDG_MODULE_ENABLED */
386 |
387 | #ifdef HAL_PCD_MODULE_ENABLED
388 | #include "stm32f4xx_hal_pcd.h"
389 | #endif /* HAL_PCD_MODULE_ENABLED */
390 |
391 | #ifdef HAL_HCD_MODULE_ENABLED
392 | #include "stm32f4xx_hal_hcd.h"
393 | #endif /* HAL_HCD_MODULE_ENABLED */
394 |
395 | #ifdef HAL_DSI_MODULE_ENABLED
396 | #include "stm32f4xx_hal_dsi.h"
397 | #endif /* HAL_DSI_MODULE_ENABLED */
398 |
399 | #ifdef HAL_QSPI_MODULE_ENABLED
400 | #include "stm32f4xx_hal_qspi.h"
401 | #endif /* HAL_QSPI_MODULE_ENABLED */
402 |
403 | #ifdef HAL_CEC_MODULE_ENABLED
404 | #include "stm32f4xx_hal_cec.h"
405 | #endif /* HAL_CEC_MODULE_ENABLED */
406 |
407 | #ifdef HAL_FMPI2C_MODULE_ENABLED
408 | #include "stm32f4xx_hal_fmpi2c.h"
409 | #endif /* HAL_FMPI2C_MODULE_ENABLED */
410 |
411 | #ifdef HAL_SPDIFRX_MODULE_ENABLED
412 | #include "stm32f4xx_hal_spdifrx.h"
413 | #endif /* HAL_SPDIFRX_MODULE_ENABLED */
414 |
415 | #ifdef HAL_DFSDM_MODULE_ENABLED
416 | #include "stm32f4xx_hal_dfsdm.h"
417 | #endif /* HAL_DFSDM_MODULE_ENABLED */
418 |
419 | #ifdef HAL_LPTIM_MODULE_ENABLED
420 | #include "stm32f4xx_hal_lptim.h"
421 | #endif /* HAL_LPTIM_MODULE_ENABLED */
422 |
423 | /* Exported macro ------------------------------------------------------------*/
424 | #ifdef USE_FULL_ASSERT
425 | /**
426 | * @brief The assert_param macro is used for function's parameters check.
427 | * @param expr: If expr is false, it calls assert_failed function
428 | * which reports the name of the source file and the source
429 | * line number of the call that failed.
430 | * If expr is true, it returns no value.
431 | * @retval None
432 | */
433 | #define assert_param(expr) ((expr) ? (void)0U : assert_failed((uint8_t *)__FILE__, __LINE__))
434 | /* Exported functions ------------------------------------------------------- */
435 | void assert_failed(uint8_t* file, uint32_t line);
436 | #else
437 | #define assert_param(expr) ((void)0U)
438 | #endif /* USE_FULL_ASSERT */
439 |
440 | #ifdef __cplusplus
441 | }
442 | #endif
443 |
444 | #endif /* __STM32F4xx_HAL_CONF_H */
445 |
446 |
447 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
448 |
--------------------------------------------------------------------------------
/Inc/stm32f4xx_it.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32f4xx_it.h
4 | * @brief This file contains the headers of the interrupt handlers.
5 | ******************************************************************************
6 | *
7 | * COPYRIGHT(c) 2018 STMicroelectronics
8 | *
9 | * Redistribution and use in source and binary forms, with or without modification,
10 | * are permitted provided that the following conditions are met:
11 | * 1. Redistributions of source code must retain the above copyright notice,
12 | * this list of conditions and the following disclaimer.
13 | * 2. Redistributions in binary form must reproduce the above copyright notice,
14 | * this list of conditions and the following disclaimer in the documentation
15 | * and/or other materials provided with the distribution.
16 | * 3. Neither the name of STMicroelectronics nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software
18 | * without specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 | *
31 | ******************************************************************************
32 | */
33 |
34 | /* Define to prevent recursive inclusion -------------------------------------*/
35 | #ifndef __STM32F4xx_IT_H
36 | #define __STM32F4xx_IT_H
37 |
38 | #ifdef __cplusplus
39 | extern "C" {
40 | #endif
41 |
42 | /* Includes ------------------------------------------------------------------*/
43 | #include "stm32f4xx_hal.h"
44 | #include "main.h"
45 | /* Exported types ------------------------------------------------------------*/
46 | /* Exported constants --------------------------------------------------------*/
47 | /* Exported macro ------------------------------------------------------------*/
48 | /* Exported functions ------------------------------------------------------- */
49 |
50 | void SysTick_Handler(void);
51 |
52 | #ifdef __cplusplus
53 | }
54 | #endif
55 |
56 | #endif /* __STM32F4xx_IT_H */
57 |
58 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
59 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2018 Aleksander Alekseev
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | ##########################################################################################################################
2 | # File automatically-generated by tool: [projectgenerator] version: [2.26.0] date: [Thu Jan 04 15:34:05 MSK 2018]
3 | ##########################################################################################################################
4 |
5 | # ------------------------------------------------
6 | # Generic Makefile (based on gcc)
7 | #
8 | # ChangeLog :
9 | # 2017-02-10 - Several enhancements + project update mode
10 | # 2015-07-22 - first version
11 | # ------------------------------------------------
12 |
13 | ######################################
14 | # target
15 | ######################################
16 | TARGET = main
17 | FIRMWARE = $(HOME)/STM32Cube/Repository/STM32Cube_FW_F4_V1.18.0
18 |
19 |
20 | ######################################
21 | # building variables
22 | ######################################
23 | # debug build?
24 | DEBUG = 1
25 | # optimization
26 | OPT = -Og -Wall
27 |
28 |
29 | #######################################
30 | # paths
31 | #######################################
32 | # source path
33 | SOURCES_DIR = \
34 | Drivers/STM32F4xx_HAL_Driver \
35 | Application/User/Src/stm32f4xx_it.c \
36 | Application/User/Src/main.c \
37 | Drivers \
38 | Application \
39 | Application/User \
40 | Application/MAKEFILE \
41 | Drivers/CMSIS \
42 | Application/User/Src/stm32f4xx_hal_msp.c \
43 | Application/User/Src
44 |
45 | # firmware library path
46 | PERIFLIB_PATH =
47 |
48 | # Build path
49 | BUILD_DIR = build
50 |
51 | ######################################
52 | # source
53 | ######################################
54 | # C sources
55 | C_SOURCES = \
56 | Src/main.c \
57 | Src/stm32f4xx_it.c \
58 | Src/system_stm32f4xx.c \
59 | Src/stm32f4xx_hal_msp.c \
60 | $(FIRMWARE)/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.c \
61 | $(FIRMWARE)/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2c.c \
62 | $(FIRMWARE)/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2c_ex.c \
63 | $(FIRMWARE)/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr.c \
64 | $(FIRMWARE)/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.c \
65 | $(FIRMWARE)/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim_ex.c \
66 | $(FIRMWARE)/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc_ex.c \
67 | $(FIRMWARE)/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash.c \
68 | $(FIRMWARE)/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ramfunc.c \
69 | $(FIRMWARE)/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cortex.c \
70 | $(FIRMWARE)/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c \
71 | $(FIRMWARE)/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.c \
72 | $(FIRMWARE)/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr_ex.c \
73 | $(FIRMWARE)/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma_ex.c \
74 | $(FIRMWARE)/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc.c \
75 | $(FIRMWARE)/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ex.c \
76 | $(FIRMWARE)/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.c
77 |
78 | # ASM sources
79 | ASM_SOURCES = \
80 | startup_stm32f411xe.s
81 |
82 |
83 | ######################################
84 | # firmware library
85 | ######################################
86 | PERIFLIB_SOURCES =
87 |
88 |
89 | #######################################
90 | # binaries
91 | #######################################
92 | BINPATH=/usr/bin
93 | PREFIX=arm-none-eabi-
94 | CC = $(BINPATH)/$(PREFIX)gcc
95 | AS = $(BINPATH)/$(PREFIX)gcc -x assembler-with-cpp
96 | CP = $(BINPATH)/$(PREFIX)objcopy
97 | AR = $(BINPATH)/$(PREFIX)ar
98 | SZ = $(BINPATH)/$(PREFIX)size
99 | HEX = $(CP) -O ihex
100 | BIN = $(CP) -O binary -S
101 |
102 | #######################################
103 | # CFLAGS
104 | #######################################
105 | # cpu
106 | CPU = -mcpu=cortex-m4
107 |
108 | # fpu
109 | FPU = -mfpu=fpv4-sp-d16
110 |
111 | # float-abi
112 | FLOAT-ABI = -mfloat-abi=hard
113 |
114 | # mcu
115 | MCU = $(CPU) -mthumb $(FPU) $(FLOAT-ABI)
116 |
117 | # macros for gcc
118 | # AS defines
119 | AS_DEFS =
120 |
121 | # C defines
122 | C_DEFS = \
123 | -DUSE_HAL_DRIVER \
124 | -DSTM32F411xE
125 |
126 |
127 | # AS includes
128 | AS_INCLUDES =
129 |
130 | # C includes
131 | C_INCLUDES = \
132 | -IInc \
133 | -I$(FIRMWARE)/Drivers/STM32F4xx_HAL_Driver/Inc \
134 | -I$(FIRMWARE)/Drivers/STM32F4xx_HAL_Driver/Inc/Legacy \
135 | -I$(FIRMWARE)/Drivers/CMSIS/Device/ST/STM32F4xx/Include \
136 | -I$(FIRMWARE)/Drivers/CMSIS/Include
137 |
138 |
139 | # compile gcc flags
140 | ASFLAGS = $(MCU) $(AS_DEFS) $(AS_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
141 |
142 | CFLAGS = $(MCU) $(C_DEFS) $(C_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections
143 |
144 | ifeq ($(DEBUG), 1)
145 | CFLAGS += -g -gdwarf-2
146 | endif
147 |
148 |
149 | # Generate dependency information
150 | CFLAGS += -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)"
151 |
152 |
153 | #######################################
154 | # LDFLAGS
155 | #######################################
156 | # link script
157 | LDSCRIPT = STM32F411RETx_FLASH.ld
158 |
159 | # libraries
160 | LIBS = -lc -lm -lnosys
161 | LIBDIR =
162 | LDFLAGS = $(MCU) -specs=nano.specs -T$(LDSCRIPT) $(LIBDIR) $(LIBS) -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref -Wl,--gc-sections
163 |
164 | # default action: build all
165 | all: $(BUILD_DIR)/$(TARGET).elf $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).bin
166 |
167 |
168 | #######################################
169 | # build the application
170 | #######################################
171 | # list of objects
172 | OBJECTS = $(addprefix $(BUILD_DIR)/,$(notdir $(C_SOURCES:.c=.o)))
173 | vpath %.c $(sort $(dir $(C_SOURCES)))
174 | # list of ASM program objects
175 | OBJECTS += $(addprefix $(BUILD_DIR)/,$(notdir $(ASM_SOURCES:.s=.o)))
176 | vpath %.s $(sort $(dir $(ASM_SOURCES)))
177 |
178 | $(BUILD_DIR)/%.o: %.c Makefile | $(BUILD_DIR)
179 | $(CC) -c $(CFLAGS) -Wa,-a,-ad,-alms=$(BUILD_DIR)/$(notdir $(<:.c=.lst)) $< -o $@
180 |
181 | $(BUILD_DIR)/%.o: %.s Makefile | $(BUILD_DIR)
182 | $(AS) -c $(CFLAGS) $< -o $@
183 |
184 | $(BUILD_DIR)/$(TARGET).elf: $(OBJECTS) Makefile
185 | $(CC) $(OBJECTS) $(LDFLAGS) -o $@
186 | $(SZ) $@
187 |
188 | $(BUILD_DIR)/%.hex: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
189 | $(HEX) $< $@
190 |
191 | $(BUILD_DIR)/%.bin: $(BUILD_DIR)/%.elf | $(BUILD_DIR)
192 | $(BIN) $< $@
193 |
194 | $(BUILD_DIR):
195 | mkdir $@
196 |
197 | #######################################
198 | # clean up
199 | #######################################
200 | clean:
201 | -rm -fR .dep $(BUILD_DIR)
202 |
203 | flash: all
204 | st-flash --reset write build/$(TARGET).bin 0x8000000
205 |
206 | erase:
207 | st-flash --reset erase
208 |
209 | uart:
210 | screen /dev/ttyACM0
211 |
212 | #######################################
213 | # dependencies
214 | #######################################
215 | -include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
216 |
217 | # *** EOF ***
218 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # stm32-i2c-lcd-1602
2 | STM32: LCD 1602 w/ I2C adapter usage example
3 |
4 | See also:
5 |
6 | * https://github.com/afiskon/stm32-ssd1306
7 | * https://github.com/afiskon/stm32-ssd1351
8 | * https://github.com/afiskon/stm32-st7735
9 | * https://github.com/afiskon/stm32-ili9341
10 |
--------------------------------------------------------------------------------
/STM32F411RETx_FLASH.ld:
--------------------------------------------------------------------------------
1 | /*
2 | *****************************************************************************
3 | **
4 |
5 | ** File : LinkerScript.ld
6 | **
7 | ** Abstract : Linker script for STM32F411RETx Device with
8 | ** 512KByte FLASH, 128KByte RAM
9 | **
10 | ** Set heap size, stack size and stack location according
11 | ** to application requirements.
12 | **
13 | ** Set memory bank area and size if external memory is used.
14 | **
15 | ** Target : STMicroelectronics STM32
16 | **
17 | **
18 | ** Distribution: The file is distributed as is, without any warranty
19 | ** of any kind.
20 | **
21 | ** (c)Copyright Ac6.
22 | ** You may use this file as-is or modify it according to the needs of your
23 | ** project. Distribution of this file (unmodified or modified) is not
24 | ** permitted. Ac6 permit registered System Workbench for MCU users the
25 | ** rights to distribute the assembled, compiled & linked contents of this
26 | ** file as part of an application binary file, provided that it is built
27 | ** using the System Workbench for MCU toolchain.
28 | **
29 | *****************************************************************************
30 | */
31 |
32 | /* Entry Point */
33 | ENTRY(Reset_Handler)
34 |
35 | /* Highest address of the user mode stack */
36 | _estack = 0x20020000; /* end of RAM */
37 | /* Generate a link error if heap and stack don't fit into RAM */
38 | _Min_Heap_Size = 0x200; /* required amount of heap */
39 | _Min_Stack_Size = 0x400; /* required amount of stack */
40 |
41 | /* Specify the memory areas */
42 | MEMORY
43 | {
44 | RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
45 | FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 512K
46 | }
47 |
48 | /* Define output sections */
49 | SECTIONS
50 | {
51 | /* The startup code goes first into FLASH */
52 | .isr_vector :
53 | {
54 | . = ALIGN(4);
55 | KEEP(*(.isr_vector)) /* Startup code */
56 | . = ALIGN(4);
57 | } >FLASH
58 |
59 | /* The program code and other data goes into FLASH */
60 | .text :
61 | {
62 | . = ALIGN(4);
63 | *(.text) /* .text sections (code) */
64 | *(.text*) /* .text* sections (code) */
65 | *(.glue_7) /* glue arm to thumb code */
66 | *(.glue_7t) /* glue thumb to arm code */
67 | *(.eh_frame)
68 |
69 | KEEP (*(.init))
70 | KEEP (*(.fini))
71 |
72 | . = ALIGN(4);
73 | _etext = .; /* define a global symbols at end of code */
74 | } >FLASH
75 |
76 | /* Constant data goes into FLASH */
77 | .rodata :
78 | {
79 | . = ALIGN(4);
80 | *(.rodata) /* .rodata sections (constants, strings, etc.) */
81 | *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
82 | . = ALIGN(4);
83 | } >FLASH
84 |
85 | .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
86 | .ARM : {
87 | __exidx_start = .;
88 | *(.ARM.exidx*)
89 | __exidx_end = .;
90 | } >FLASH
91 |
92 | .preinit_array :
93 | {
94 | PROVIDE_HIDDEN (__preinit_array_start = .);
95 | KEEP (*(.preinit_array*))
96 | PROVIDE_HIDDEN (__preinit_array_end = .);
97 | } >FLASH
98 | .init_array :
99 | {
100 | PROVIDE_HIDDEN (__init_array_start = .);
101 | KEEP (*(SORT(.init_array.*)))
102 | KEEP (*(.init_array*))
103 | PROVIDE_HIDDEN (__init_array_end = .);
104 | } >FLASH
105 | .fini_array :
106 | {
107 | PROVIDE_HIDDEN (__fini_array_start = .);
108 | KEEP (*(SORT(.fini_array.*)))
109 | KEEP (*(.fini_array*))
110 | PROVIDE_HIDDEN (__fini_array_end = .);
111 | } >FLASH
112 |
113 | /* used by the startup to initialize data */
114 | _sidata = LOADADDR(.data);
115 |
116 | /* Initialized data sections goes into RAM, load LMA copy after code */
117 | .data :
118 | {
119 | . = ALIGN(4);
120 | _sdata = .; /* create a global symbol at data start */
121 | *(.data) /* .data sections */
122 | *(.data*) /* .data* sections */
123 |
124 | . = ALIGN(4);
125 | _edata = .; /* define a global symbol at data end */
126 | } >RAM AT> FLASH
127 |
128 |
129 | /* Uninitialized data section */
130 | . = ALIGN(4);
131 | .bss :
132 | {
133 | /* This is used by the startup in order to initialize the .bss secion */
134 | _sbss = .; /* define a global symbol at bss start */
135 | __bss_start__ = _sbss;
136 | *(.bss)
137 | *(.bss*)
138 | *(COMMON)
139 |
140 | . = ALIGN(4);
141 | _ebss = .; /* define a global symbol at bss end */
142 | __bss_end__ = _ebss;
143 | } >RAM
144 |
145 | /* User_heap_stack section, used to check that there is enough RAM left */
146 | ._user_heap_stack :
147 | {
148 | . = ALIGN(8);
149 | PROVIDE ( end = . );
150 | PROVIDE ( _end = . );
151 | . = . + _Min_Heap_Size;
152 | . = . + _Min_Stack_Size;
153 | . = ALIGN(8);
154 | } >RAM
155 |
156 |
157 |
158 | /* Remove information from the standard libraries */
159 | /DISCARD/ :
160 | {
161 | libc.a ( * )
162 | libm.a ( * )
163 | libgcc.a ( * )
164 | }
165 |
166 | .ARM.attributes 0 : { *(.ARM.attributes) }
167 | }
168 |
169 |
170 |
--------------------------------------------------------------------------------
/Src/gpio.tmp:
--------------------------------------------------------------------------------
1 |
2 | #n/** Configure pins as #n #t#t #t* Analog #n #t#t #t* Input #n #t#t #t* Output#n #t#t #t* EVENT_OUT#n #t#t #t* EXTI
3 | */
4 | static void MX_GPIO_Init(void)
5 | {
6 | #n
7 | #tGPIO_InitTypeDef GPIO_InitStruct;
8 | #n#t/* GPIO Ports Clock Enable */
9 | #t__HAL_RCC_GPIOC_CLK_ENABLE();
10 | #t__HAL_RCC_GPIOH_CLK_ENABLE();
11 | #t__HAL_RCC_GPIOA_CLK_ENABLE();
12 | #t__HAL_RCC_GPIOB_CLK_ENABLE();
13 | #n#t/*Configure GPIO pin Output Level */
14 | #tHAL_GPIO_WritePin(LD2_GPIO_Port, LD2_Pin, GPIO_PIN_RESET);
15 | #n#t/*Configure GPIO pin : B1_Pin */
16 | #tGPIO_InitStruct.Pin = B1_Pin;
17 | #tGPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;
18 | #tGPIO_InitStruct.Pull = GPIO_NOPULL;
19 | #tHAL_GPIO_Init(B1_GPIO_Port, &GPIO_InitStruct);
20 | #n#t/*Configure GPIO pin : LD2_Pin */
21 | #tGPIO_InitStruct.Pin = LD2_Pin;
22 | #tGPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
23 | #tGPIO_InitStruct.Pull = GPIO_NOPULL;
24 | #tGPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
25 | #tHAL_GPIO_Init(LD2_GPIO_Port, &GPIO_InitStruct);
26 | #n
27 | }
28 | #n
29 |
--------------------------------------------------------------------------------
/Src/license.tmp:
--------------------------------------------------------------------------------
1 | ** This notice applies to any and all portions of this file
2 | * that are not between comment pairs USER CODE BEGIN and
3 | * USER CODE END. Other portions of this file, whether
4 | * inserted by the user or by software development tools
5 | * are owned by their respective copyright owners.
6 | *
7 | * COPYRIGHT(c) 2018 STMicroelectronics
8 | *
9 | * Redistribution and use in source and binary forms, with or without modification,
10 | * are permitted provided that the following conditions are met:
11 | * 1. Redistributions of source code must retain the above copyright notice,
12 | * this list of conditions and the following disclaimer.
13 | * 2. Redistributions in binary form must reproduce the above copyright notice,
14 | * this list of conditions and the following disclaimer in the documentation
15 | * and/or other materials provided with the distribution.
16 | * 3. Neither the name of STMicroelectronics nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software
18 | * without specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 | *
31 |
--------------------------------------------------------------------------------
/Src/main.c:
--------------------------------------------------------------------------------
1 | /* Includes ------------------------------------------------------------------*/
2 | #include "main.h"
3 | #include "stm32f4xx_hal.h"
4 |
5 | /* USER CODE BEGIN Includes */
6 |
7 | /* USER CODE END Includes */
8 |
9 | /* Private variables ---------------------------------------------------------*/
10 | I2C_HandleTypeDef hi2c1;
11 |
12 | UART_HandleTypeDef huart2;
13 |
14 | /* USER CODE BEGIN PV */
15 | /* Private variables ---------------------------------------------------------*/
16 |
17 | /* USER CODE END PV */
18 |
19 | /* Private function prototypes -----------------------------------------------*/
20 | void SystemClock_Config(void);
21 | static void MX_GPIO_Init(void);
22 | static void MX_I2C1_Init(void);
23 | static void MX_USART2_UART_Init(void);
24 |
25 | /* USER CODE BEGIN PFP */
26 | /* Private function prototypes -----------------------------------------------*/
27 |
28 | /* USER CODE END PFP */
29 |
30 | /* USER CODE BEGIN 0 */
31 | #include
32 |
33 | #define LCD_ADDR (0x27 << 1)
34 |
35 | #define PIN_RS (1 << 0)
36 | #define PIN_EN (1 << 2)
37 | #define BACKLIGHT (1 << 3)
38 |
39 | #define LCD_DELAY_MS 5
40 |
41 | void I2C_Scan() {
42 | char info[] = "Scanning I2C bus...\r\n";
43 | HAL_UART_Transmit(&huart2, (uint8_t*)info, strlen(info), HAL_MAX_DELAY);
44 |
45 | HAL_StatusTypeDef res;
46 | for(uint16_t i = 0; i < 128; i++) {
47 | res = HAL_I2C_IsDeviceReady(&hi2c1, i << 1, 1, 10);
48 | if(res == HAL_OK) {
49 | char msg[64];
50 | snprintf(msg, sizeof(msg), "0x%02X", i);
51 | HAL_UART_Transmit(&huart2, (uint8_t*)msg, strlen(msg), HAL_MAX_DELAY);
52 | } else {
53 | HAL_UART_Transmit(&huart2, (uint8_t*)".", 1, HAL_MAX_DELAY);
54 | }
55 | }
56 |
57 | HAL_UART_Transmit(&huart2, (uint8_t*)"\r\n", 2, HAL_MAX_DELAY);
58 | }
59 |
60 | HAL_StatusTypeDef LCD_SendInternal(uint8_t lcd_addr, uint8_t data, uint8_t flags) {
61 | HAL_StatusTypeDef res;
62 | for(;;) {
63 | res = HAL_I2C_IsDeviceReady(&hi2c1, lcd_addr, 1, HAL_MAX_DELAY);
64 | if(res == HAL_OK)
65 | break;
66 | }
67 |
68 | uint8_t up = data & 0xF0;
69 | uint8_t lo = (data << 4) & 0xF0;
70 |
71 | uint8_t data_arr[4];
72 | data_arr[0] = up|flags|BACKLIGHT|PIN_EN;
73 | data_arr[1] = up|flags|BACKLIGHT;
74 | data_arr[2] = lo|flags|BACKLIGHT|PIN_EN;
75 | data_arr[3] = lo|flags|BACKLIGHT;
76 |
77 | res = HAL_I2C_Master_Transmit(&hi2c1, lcd_addr, data_arr, sizeof(data_arr), HAL_MAX_DELAY);
78 | HAL_Delay(LCD_DELAY_MS);
79 | return res;
80 | }
81 |
82 | void LCD_SendCommand(uint8_t lcd_addr, uint8_t cmd) {
83 | LCD_SendInternal(lcd_addr, cmd, 0);
84 | }
85 |
86 | void LCD_SendData(uint8_t lcd_addr, uint8_t data) {
87 | LCD_SendInternal(lcd_addr, data, PIN_RS);
88 | }
89 |
90 | void LCD_Init(uint8_t lcd_addr) {
91 | // 4-bit mode, 2 lines, 5x7 format
92 | LCD_SendCommand(lcd_addr, 0b00110000);
93 | // display & cursor home (keep this!)
94 | LCD_SendCommand(lcd_addr, 0b00000010);
95 | // display on, right shift, underline off, blink off
96 | LCD_SendCommand(lcd_addr, 0b00001100);
97 | // clear display (optional here)
98 | LCD_SendCommand(lcd_addr, 0b00000001);
99 | }
100 |
101 | void LCD_SendString(uint8_t lcd_addr, char *str) {
102 | while(*str) {
103 | LCD_SendData(lcd_addr, (uint8_t)(*str));
104 | str++;
105 | }
106 | }
107 |
108 | void init() {
109 | I2C_Scan();
110 | LCD_Init(LCD_ADDR);
111 |
112 | // set address to 0x00
113 | LCD_SendCommand(LCD_ADDR, 0b10000000);
114 | LCD_SendString(LCD_ADDR, " Using 1602 LCD");
115 |
116 | // set address to 0x40
117 | LCD_SendCommand(LCD_ADDR, 0b11000000);
118 | LCD_SendString(LCD_ADDR, " over I2C bus");
119 | }
120 |
121 | void loop() {
122 | HAL_Delay(100);
123 | }
124 |
125 | /* USER CODE END 0 */
126 |
127 | int main(void)
128 | {
129 |
130 | /* USER CODE BEGIN 1 */
131 |
132 | /* USER CODE END 1 */
133 |
134 | /* MCU Configuration----------------------------------------------------------*/
135 |
136 | /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
137 | HAL_Init();
138 |
139 | /* USER CODE BEGIN Init */
140 |
141 | /* USER CODE END Init */
142 |
143 | /* Configure the system clock */
144 | SystemClock_Config();
145 |
146 | /* USER CODE BEGIN SysInit */
147 |
148 | /* USER CODE END SysInit */
149 |
150 | /* Initialize all configured peripherals */
151 | MX_GPIO_Init();
152 | MX_I2C1_Init();
153 | MX_USART2_UART_Init();
154 |
155 | /* USER CODE BEGIN 2 */
156 |
157 | /* USER CODE END 2 */
158 |
159 | /* Infinite loop */
160 | /* USER CODE BEGIN WHILE */
161 | init();
162 | while (1)
163 | {
164 | loop();
165 | /* USER CODE END WHILE */
166 |
167 | /* USER CODE BEGIN 3 */
168 |
169 | }
170 | /* USER CODE END 3 */
171 |
172 | }
173 |
174 | /** System Clock Configuration
175 | */
176 | void SystemClock_Config(void)
177 | {
178 |
179 | RCC_OscInitTypeDef RCC_OscInitStruct;
180 | RCC_ClkInitTypeDef RCC_ClkInitStruct;
181 |
182 | /**Configure the main internal regulator output voltage
183 | */
184 | __HAL_RCC_PWR_CLK_ENABLE();
185 |
186 | __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
187 |
188 | /**Initializes the CPU, AHB and APB busses clocks
189 | */
190 | RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
191 | RCC_OscInitStruct.HSIState = RCC_HSI_ON;
192 | RCC_OscInitStruct.HSICalibrationValue = 16;
193 | RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
194 | RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI;
195 | RCC_OscInitStruct.PLL.PLLM = 16;
196 | RCC_OscInitStruct.PLL.PLLN = 336;
197 | RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV4;
198 | RCC_OscInitStruct.PLL.PLLQ = 4;
199 | if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
200 | {
201 | _Error_Handler(__FILE__, __LINE__);
202 | }
203 |
204 | /**Initializes the CPU, AHB and APB busses clocks
205 | */
206 | RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
207 | |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
208 | RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
209 | RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
210 | RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2;
211 | RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
212 |
213 | if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK)
214 | {
215 | _Error_Handler(__FILE__, __LINE__);
216 | }
217 |
218 | /**Configure the Systick interrupt time
219 | */
220 | HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/1000);
221 |
222 | /**Configure the Systick
223 | */
224 | HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);
225 |
226 | /* SysTick_IRQn interrupt configuration */
227 | HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
228 | }
229 |
230 | /* I2C1 init function */
231 | static void MX_I2C1_Init(void)
232 | {
233 |
234 | hi2c1.Instance = I2C1;
235 | hi2c1.Init.ClockSpeed = 100000;
236 | hi2c1.Init.DutyCycle = I2C_DUTYCYCLE_2;
237 | hi2c1.Init.OwnAddress1 = 0;
238 | hi2c1.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT;
239 | hi2c1.Init.DualAddressMode = I2C_DUALADDRESS_DISABLE;
240 | hi2c1.Init.OwnAddress2 = 0;
241 | hi2c1.Init.GeneralCallMode = I2C_GENERALCALL_DISABLE;
242 | hi2c1.Init.NoStretchMode = I2C_NOSTRETCH_DISABLE;
243 | if (HAL_I2C_Init(&hi2c1) != HAL_OK)
244 | {
245 | _Error_Handler(__FILE__, __LINE__);
246 | }
247 |
248 | }
249 |
250 | /* USART2 init function */
251 | static void MX_USART2_UART_Init(void)
252 | {
253 |
254 | huart2.Instance = USART2;
255 | huart2.Init.BaudRate = 9600;
256 | huart2.Init.WordLength = UART_WORDLENGTH_8B;
257 | huart2.Init.StopBits = UART_STOPBITS_1;
258 | huart2.Init.Parity = UART_PARITY_NONE;
259 | huart2.Init.Mode = UART_MODE_TX_RX;
260 | huart2.Init.HwFlowCtl = UART_HWCONTROL_NONE;
261 | huart2.Init.OverSampling = UART_OVERSAMPLING_16;
262 | if (HAL_UART_Init(&huart2) != HAL_OK)
263 | {
264 | _Error_Handler(__FILE__, __LINE__);
265 | }
266 |
267 | }
268 |
269 | /** Configure pins as
270 | * Analog
271 | * Input
272 | * Output
273 | * EVENT_OUT
274 | * EXTI
275 | */
276 | static void MX_GPIO_Init(void)
277 | {
278 |
279 | GPIO_InitTypeDef GPIO_InitStruct;
280 |
281 | /* GPIO Ports Clock Enable */
282 | __HAL_RCC_GPIOC_CLK_ENABLE();
283 | __HAL_RCC_GPIOH_CLK_ENABLE();
284 | __HAL_RCC_GPIOA_CLK_ENABLE();
285 | __HAL_RCC_GPIOB_CLK_ENABLE();
286 |
287 | /*Configure GPIO pin Output Level */
288 | HAL_GPIO_WritePin(LD2_GPIO_Port, LD2_Pin, GPIO_PIN_RESET);
289 |
290 | /*Configure GPIO pin : B1_Pin */
291 | GPIO_InitStruct.Pin = B1_Pin;
292 | GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;
293 | GPIO_InitStruct.Pull = GPIO_NOPULL;
294 | HAL_GPIO_Init(B1_GPIO_Port, &GPIO_InitStruct);
295 |
296 | /*Configure GPIO pin : LD2_Pin */
297 | GPIO_InitStruct.Pin = LD2_Pin;
298 | GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
299 | GPIO_InitStruct.Pull = GPIO_NOPULL;
300 | GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
301 | HAL_GPIO_Init(LD2_GPIO_Port, &GPIO_InitStruct);
302 |
303 | }
304 |
305 | /* USER CODE BEGIN 4 */
306 |
307 | /* USER CODE END 4 */
308 |
309 | /**
310 | * @brief This function is executed in case of error occurrence.
311 | * @param None
312 | * @retval None
313 | */
314 | void _Error_Handler(char * file, int line)
315 | {
316 | /* USER CODE BEGIN Error_Handler_Debug */
317 | /* User can add his own implementation to report the HAL error return state */
318 | while(1)
319 | {
320 | }
321 | /* USER CODE END Error_Handler_Debug */
322 | }
323 |
324 | #ifdef USE_FULL_ASSERT
325 |
326 | /**
327 | * @brief Reports the name of the source file and the source line number
328 | * where the assert_param error has occurred.
329 | * @param file: pointer to the source file name
330 | * @param line: assert_param error line source number
331 | * @retval None
332 | */
333 | void assert_failed(uint8_t* file, uint32_t line)
334 | {
335 | /* USER CODE BEGIN 6 */
336 | /* User can add his own implementation to report the file name and line number,
337 | ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
338 | /* USER CODE END 6 */
339 |
340 | }
341 |
342 | #endif
343 |
344 | /**
345 | * @}
346 | */
347 |
348 | /**
349 | * @}
350 | */
351 |
352 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
353 |
--------------------------------------------------------------------------------
/Src/stm32f4xx_hal_msp.c:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * File Name : stm32f4xx_hal_msp.c
4 | * Description : This file provides code for the MSP Initialization
5 | * and de-Initialization codes.
6 | ******************************************************************************
7 | ** This notice applies to any and all portions of this file
8 | * that are not between comment pairs USER CODE BEGIN and
9 | * USER CODE END. Other portions of this file, whether
10 | * inserted by the user or by software development tools
11 | * are owned by their respective copyright owners.
12 | *
13 | * COPYRIGHT(c) 2018 STMicroelectronics
14 | *
15 | * Redistribution and use in source and binary forms, with or without modification,
16 | * are permitted provided that the following conditions are met:
17 | * 1. Redistributions of source code must retain the above copyright notice,
18 | * this list of conditions and the following disclaimer.
19 | * 2. Redistributions in binary form must reproduce the above copyright notice,
20 | * this list of conditions and the following disclaimer in the documentation
21 | * and/or other materials provided with the distribution.
22 | * 3. Neither the name of STMicroelectronics nor the names of its contributors
23 | * may be used to endorse or promote products derived from this software
24 | * without specific prior written permission.
25 | *
26 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
27 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
29 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
30 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
32 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
33 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
34 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 | *
37 | ******************************************************************************
38 | */
39 | /* Includes ------------------------------------------------------------------*/
40 | #include "stm32f4xx_hal.h"
41 |
42 | extern void _Error_Handler(char *, int);
43 | /* USER CODE BEGIN 0 */
44 |
45 | /* USER CODE END 0 */
46 | /**
47 | * Initializes the Global MSP.
48 | */
49 | void HAL_MspInit(void)
50 | {
51 | /* USER CODE BEGIN MspInit 0 */
52 |
53 | /* USER CODE END MspInit 0 */
54 |
55 | HAL_NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_0);
56 |
57 | /* System interrupt init*/
58 | /* MemoryManagement_IRQn interrupt configuration */
59 | HAL_NVIC_SetPriority(MemoryManagement_IRQn, 0, 0);
60 | /* BusFault_IRQn interrupt configuration */
61 | HAL_NVIC_SetPriority(BusFault_IRQn, 0, 0);
62 | /* UsageFault_IRQn interrupt configuration */
63 | HAL_NVIC_SetPriority(UsageFault_IRQn, 0, 0);
64 | /* SVCall_IRQn interrupt configuration */
65 | HAL_NVIC_SetPriority(SVCall_IRQn, 0, 0);
66 | /* DebugMonitor_IRQn interrupt configuration */
67 | HAL_NVIC_SetPriority(DebugMonitor_IRQn, 0, 0);
68 | /* PendSV_IRQn interrupt configuration */
69 | HAL_NVIC_SetPriority(PendSV_IRQn, 0, 0);
70 | /* SysTick_IRQn interrupt configuration */
71 | HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
72 |
73 | /* USER CODE BEGIN MspInit 1 */
74 |
75 | /* USER CODE END MspInit 1 */
76 | }
77 |
78 | void HAL_I2C_MspInit(I2C_HandleTypeDef* hi2c)
79 | {
80 |
81 | GPIO_InitTypeDef GPIO_InitStruct;
82 | if(hi2c->Instance==I2C1)
83 | {
84 | /* USER CODE BEGIN I2C1_MspInit 0 */
85 |
86 | /* USER CODE END I2C1_MspInit 0 */
87 |
88 | /**I2C1 GPIO Configuration
89 | PB8 ------> I2C1_SCL
90 | PB9 ------> I2C1_SDA
91 | */
92 | GPIO_InitStruct.Pin = GPIO_PIN_8|GPIO_PIN_9;
93 | GPIO_InitStruct.Mode = GPIO_MODE_AF_OD;
94 | GPIO_InitStruct.Pull = GPIO_PULLUP;
95 | GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
96 | GPIO_InitStruct.Alternate = GPIO_AF4_I2C1;
97 | HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
98 |
99 | /* Peripheral clock enable */
100 | __HAL_RCC_I2C1_CLK_ENABLE();
101 | /* USER CODE BEGIN I2C1_MspInit 1 */
102 |
103 | /* USER CODE END I2C1_MspInit 1 */
104 | }
105 |
106 | }
107 |
108 | void HAL_I2C_MspDeInit(I2C_HandleTypeDef* hi2c)
109 | {
110 |
111 | if(hi2c->Instance==I2C1)
112 | {
113 | /* USER CODE BEGIN I2C1_MspDeInit 0 */
114 |
115 | /* USER CODE END I2C1_MspDeInit 0 */
116 | /* Peripheral clock disable */
117 | __HAL_RCC_I2C1_CLK_DISABLE();
118 |
119 | /**I2C1 GPIO Configuration
120 | PB8 ------> I2C1_SCL
121 | PB9 ------> I2C1_SDA
122 | */
123 | HAL_GPIO_DeInit(GPIOB, GPIO_PIN_8|GPIO_PIN_9);
124 |
125 | /* USER CODE BEGIN I2C1_MspDeInit 1 */
126 |
127 | /* USER CODE END I2C1_MspDeInit 1 */
128 | }
129 |
130 | }
131 |
132 | void HAL_UART_MspInit(UART_HandleTypeDef* huart)
133 | {
134 |
135 | GPIO_InitTypeDef GPIO_InitStruct;
136 | if(huart->Instance==USART2)
137 | {
138 | /* USER CODE BEGIN USART2_MspInit 0 */
139 |
140 | /* USER CODE END USART2_MspInit 0 */
141 | /* Peripheral clock enable */
142 | __HAL_RCC_USART2_CLK_ENABLE();
143 |
144 | /**USART2 GPIO Configuration
145 | PA2 ------> USART2_TX
146 | PA3 ------> USART2_RX
147 | */
148 | GPIO_InitStruct.Pin = USART_TX_Pin|USART_RX_Pin;
149 | GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
150 | GPIO_InitStruct.Pull = GPIO_PULLUP;
151 | GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
152 | GPIO_InitStruct.Alternate = GPIO_AF7_USART2;
153 | HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
154 |
155 | /* USER CODE BEGIN USART2_MspInit 1 */
156 |
157 | /* USER CODE END USART2_MspInit 1 */
158 | }
159 |
160 | }
161 |
162 | void HAL_UART_MspDeInit(UART_HandleTypeDef* huart)
163 | {
164 |
165 | if(huart->Instance==USART2)
166 | {
167 | /* USER CODE BEGIN USART2_MspDeInit 0 */
168 |
169 | /* USER CODE END USART2_MspDeInit 0 */
170 | /* Peripheral clock disable */
171 | __HAL_RCC_USART2_CLK_DISABLE();
172 |
173 | /**USART2 GPIO Configuration
174 | PA2 ------> USART2_TX
175 | PA3 ------> USART2_RX
176 | */
177 | HAL_GPIO_DeInit(GPIOA, USART_TX_Pin|USART_RX_Pin);
178 |
179 | /* USER CODE BEGIN USART2_MspDeInit 1 */
180 |
181 | /* USER CODE END USART2_MspDeInit 1 */
182 | }
183 |
184 | }
185 |
186 | /* USER CODE BEGIN 1 */
187 |
188 | /* USER CODE END 1 */
189 |
190 | /**
191 | * @}
192 | */
193 |
194 | /**
195 | * @}
196 | */
197 |
198 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
199 |
--------------------------------------------------------------------------------
/Src/stm32f4xx_it.c:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32f4xx_it.c
4 | * @brief Interrupt Service Routines.
5 | ******************************************************************************
6 | *
7 | * COPYRIGHT(c) 2018 STMicroelectronics
8 | *
9 | * Redistribution and use in source and binary forms, with or without modification,
10 | * are permitted provided that the following conditions are met:
11 | * 1. Redistributions of source code must retain the above copyright notice,
12 | * this list of conditions and the following disclaimer.
13 | * 2. Redistributions in binary form must reproduce the above copyright notice,
14 | * this list of conditions and the following disclaimer in the documentation
15 | * and/or other materials provided with the distribution.
16 | * 3. Neither the name of STMicroelectronics nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software
18 | * without specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 | *
31 | ******************************************************************************
32 | */
33 | /* Includes ------------------------------------------------------------------*/
34 | #include "stm32f4xx_hal.h"
35 | #include "stm32f4xx.h"
36 | #include "stm32f4xx_it.h"
37 |
38 | /* USER CODE BEGIN 0 */
39 |
40 | /* USER CODE END 0 */
41 |
42 | /* External variables --------------------------------------------------------*/
43 |
44 | /******************************************************************************/
45 | /* Cortex-M4 Processor Interruption and Exception Handlers */
46 | /******************************************************************************/
47 |
48 | /**
49 | * @brief This function handles System tick timer.
50 | */
51 | void SysTick_Handler(void)
52 | {
53 | /* USER CODE BEGIN SysTick_IRQn 0 */
54 |
55 | /* USER CODE END SysTick_IRQn 0 */
56 | HAL_IncTick();
57 | HAL_SYSTICK_IRQHandler();
58 | /* USER CODE BEGIN SysTick_IRQn 1 */
59 |
60 | /* USER CODE END SysTick_IRQn 1 */
61 | }
62 |
63 | /******************************************************************************/
64 | /* STM32F4xx Peripheral Interrupt Handlers */
65 | /* Add here the Interrupt Handlers for the used peripherals. */
66 | /* For the available peripheral interrupt handler names, */
67 | /* please refer to the startup file (startup_stm32f4xx.s). */
68 | /******************************************************************************/
69 |
70 | /* USER CODE BEGIN 1 */
71 |
72 | /* USER CODE END 1 */
73 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
74 |
--------------------------------------------------------------------------------
/Src/system.tmp:
--------------------------------------------------------------------------------
1 | #n
2 | #n
3 | #tHAL_NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_0);#n
4 | #t/* System interrupt init*/
5 | #t/* MemoryManagement_IRQn interrupt configuration */
6 | #tNVIC_SetPriority(MemoryManagement_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0));
7 | #t/* BusFault_IRQn interrupt configuration */
8 | #tNVIC_SetPriority(BusFault_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0));
9 | #t/* UsageFault_IRQn interrupt configuration */
10 | #tNVIC_SetPriority(UsageFault_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0));
11 | #t/* SVCall_IRQn interrupt configuration */
12 | #tNVIC_SetPriority(SVCall_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0));
13 | #t/* DebugMonitor_IRQn interrupt configuration */
14 | #tNVIC_SetPriority(DebugMonitor_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0));
15 | #t/* PendSV_IRQn interrupt configuration */
16 | #tNVIC_SetPriority(PendSV_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0));
17 | #t/* SysTick_IRQn interrupt configuration */
18 | #tNVIC_SetPriority(SysTick_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0));
19 | #n
20 | #n
21 |
--------------------------------------------------------------------------------
/Src/system_stm32f4xx.c:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file system_stm32f4xx.c
4 | * @author MCD Application Team
5 | * @brief CMSIS Cortex-M4 Device Peripheral Access Layer System Source File.
6 | *
7 | * This file provides two functions and one global variable to be called from
8 | * user application:
9 | * - SystemInit(): This function is called at startup just after reset and
10 | * before branch to main program. This call is made inside
11 | * the "startup_stm32f4xx.s" file.
12 | *
13 | * - SystemCoreClock variable: Contains the core clock (HCLK), it can be used
14 | * by the user application to setup the SysTick
15 | * timer or configure other parameters.
16 | *
17 | * - SystemCoreClockUpdate(): Updates the variable SystemCoreClock and must
18 | * be called whenever the core clock is changed
19 | * during program execution.
20 | *
21 | *
22 | ******************************************************************************
23 | * @attention
24 | *
25 | * © COPYRIGHT 2017 STMicroelectronics
26 | *
27 | * Redistribution and use in source and binary forms, with or without modification,
28 | * are permitted provided that the following conditions are met:
29 | * 1. Redistributions of source code must retain the above copyright notice,
30 | * this list of conditions and the following disclaimer.
31 | * 2. Redistributions in binary form must reproduce the above copyright notice,
32 | * this list of conditions and the following disclaimer in the documentation
33 | * and/or other materials provided with the distribution.
34 | * 3. Neither the name of STMicroelectronics nor the names of its contributors
35 | * may be used to endorse or promote products derived from this software
36 | * without specific prior written permission.
37 | *
38 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
39 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
40 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
41 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
42 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
43 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
44 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
45 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
46 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
47 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
48 | *
49 | ******************************************************************************
50 | */
51 |
52 | /** @addtogroup CMSIS
53 | * @{
54 | */
55 |
56 | /** @addtogroup stm32f4xx_system
57 | * @{
58 | */
59 |
60 | /** @addtogroup STM32F4xx_System_Private_Includes
61 | * @{
62 | */
63 |
64 |
65 | #include "stm32f4xx.h"
66 |
67 | #if !defined (HSE_VALUE)
68 | #define HSE_VALUE ((uint32_t)25000000) /*!< Default value of the External oscillator in Hz */
69 | #endif /* HSE_VALUE */
70 |
71 | #if !defined (HSI_VALUE)
72 | #define HSI_VALUE ((uint32_t)16000000) /*!< Value of the Internal oscillator in Hz*/
73 | #endif /* HSI_VALUE */
74 |
75 | /**
76 | * @}
77 | */
78 |
79 | /** @addtogroup STM32F4xx_System_Private_TypesDefinitions
80 | * @{
81 | */
82 |
83 | /**
84 | * @}
85 | */
86 |
87 | /** @addtogroup STM32F4xx_System_Private_Defines
88 | * @{
89 | */
90 |
91 | /************************* Miscellaneous Configuration ************************/
92 | /*!< Uncomment the following line if you need to use external SRAM or SDRAM as data memory */
93 | #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx)\
94 | || defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx)\
95 | || defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx)
96 | /* #define DATA_IN_ExtSRAM */
97 | #endif /* STM32F40xxx || STM32F41xxx || STM32F42xxx || STM32F43xxx || STM32F469xx || STM32F479xx ||\
98 | STM32F412Zx || STM32F412Vx */
99 |
100 | #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx)\
101 | || defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx)
102 | /* #define DATA_IN_ExtSDRAM */
103 | #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx ||\
104 | STM32F479xx */
105 |
106 | /*!< Uncomment the following line if you need to relocate your vector Table in
107 | Internal SRAM. */
108 | /* #define VECT_TAB_SRAM */
109 | #define VECT_TAB_OFFSET 0x00 /*!< Vector Table base offset field.
110 | This value must be a multiple of 0x200. */
111 | /******************************************************************************/
112 |
113 | /**
114 | * @}
115 | */
116 |
117 | /** @addtogroup STM32F4xx_System_Private_Macros
118 | * @{
119 | */
120 |
121 | /**
122 | * @}
123 | */
124 |
125 | /** @addtogroup STM32F4xx_System_Private_Variables
126 | * @{
127 | */
128 | /* This variable is updated in three ways:
129 | 1) by calling CMSIS function SystemCoreClockUpdate()
130 | 2) by calling HAL API function HAL_RCC_GetHCLKFreq()
131 | 3) each time HAL_RCC_ClockConfig() is called to configure the system clock frequency
132 | Note: If you use this function to configure the system clock; then there
133 | is no need to call the 2 first functions listed above, since SystemCoreClock
134 | variable is updated automatically.
135 | */
136 | uint32_t SystemCoreClock = 16000000;
137 | const uint8_t AHBPrescTable[16] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 6, 7, 8, 9};
138 | const uint8_t APBPrescTable[8] = {0, 0, 0, 0, 1, 2, 3, 4};
139 | /**
140 | * @}
141 | */
142 |
143 | /** @addtogroup STM32F4xx_System_Private_FunctionPrototypes
144 | * @{
145 | */
146 |
147 | #if defined (DATA_IN_ExtSRAM) || defined (DATA_IN_ExtSDRAM)
148 | static void SystemInit_ExtMemCtl(void);
149 | #endif /* DATA_IN_ExtSRAM || DATA_IN_ExtSDRAM */
150 |
151 | /**
152 | * @}
153 | */
154 |
155 | /** @addtogroup STM32F4xx_System_Private_Functions
156 | * @{
157 | */
158 |
159 | /**
160 | * @brief Setup the microcontroller system
161 | * Initialize the FPU setting, vector table location and External memory
162 | * configuration.
163 | * @param None
164 | * @retval None
165 | */
166 | void SystemInit(void)
167 | {
168 | /* FPU settings ------------------------------------------------------------*/
169 | #if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
170 | SCB->CPACR |= ((3UL << 10*2)|(3UL << 11*2)); /* set CP10 and CP11 Full Access */
171 | #endif
172 | /* Reset the RCC clock configuration to the default reset state ------------*/
173 | /* Set HSION bit */
174 | RCC->CR |= (uint32_t)0x00000001;
175 |
176 | /* Reset CFGR register */
177 | RCC->CFGR = 0x00000000;
178 |
179 | /* Reset HSEON, CSSON and PLLON bits */
180 | RCC->CR &= (uint32_t)0xFEF6FFFF;
181 |
182 | /* Reset PLLCFGR register */
183 | RCC->PLLCFGR = 0x24003010;
184 |
185 | /* Reset HSEBYP bit */
186 | RCC->CR &= (uint32_t)0xFFFBFFFF;
187 |
188 | /* Disable all interrupts */
189 | RCC->CIR = 0x00000000;
190 |
191 | #if defined (DATA_IN_ExtSRAM) || defined (DATA_IN_ExtSDRAM)
192 | SystemInit_ExtMemCtl();
193 | #endif /* DATA_IN_ExtSRAM || DATA_IN_ExtSDRAM */
194 |
195 | /* Configure the Vector Table location add offset address ------------------*/
196 | #ifdef VECT_TAB_SRAM
197 | SCB->VTOR = SRAM_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM */
198 | #else
199 | SCB->VTOR = FLASH_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal FLASH */
200 | #endif
201 | }
202 |
203 | /**
204 | * @brief Update SystemCoreClock variable according to Clock Register Values.
205 | * The SystemCoreClock variable contains the core clock (HCLK), it can
206 | * be used by the user application to setup the SysTick timer or configure
207 | * other parameters.
208 | *
209 | * @note Each time the core clock (HCLK) changes, this function must be called
210 | * to update SystemCoreClock variable value. Otherwise, any configuration
211 | * based on this variable will be incorrect.
212 | *
213 | * @note - The system frequency computed by this function is not the real
214 | * frequency in the chip. It is calculated based on the predefined
215 | * constant and the selected clock source:
216 | *
217 | * - If SYSCLK source is HSI, SystemCoreClock will contain the HSI_VALUE(*)
218 | *
219 | * - If SYSCLK source is HSE, SystemCoreClock will contain the HSE_VALUE(**)
220 | *
221 | * - If SYSCLK source is PLL, SystemCoreClock will contain the HSE_VALUE(**)
222 | * or HSI_VALUE(*) multiplied/divided by the PLL factors.
223 | *
224 | * (*) HSI_VALUE is a constant defined in stm32f4xx_hal_conf.h file (default value
225 | * 16 MHz) but the real value may vary depending on the variations
226 | * in voltage and temperature.
227 | *
228 | * (**) HSE_VALUE is a constant defined in stm32f4xx_hal_conf.h file (its value
229 | * depends on the application requirements), user has to ensure that HSE_VALUE
230 | * is same as the real frequency of the crystal used. Otherwise, this function
231 | * may have wrong result.
232 | *
233 | * - The result of this function could be not correct when using fractional
234 | * value for HSE crystal.
235 | *
236 | * @param None
237 | * @retval None
238 | */
239 | void SystemCoreClockUpdate(void)
240 | {
241 | uint32_t tmp = 0, pllvco = 0, pllp = 2, pllsource = 0, pllm = 2;
242 |
243 | /* Get SYSCLK source -------------------------------------------------------*/
244 | tmp = RCC->CFGR & RCC_CFGR_SWS;
245 |
246 | switch (tmp)
247 | {
248 | case 0x00: /* HSI used as system clock source */
249 | SystemCoreClock = HSI_VALUE;
250 | break;
251 | case 0x04: /* HSE used as system clock source */
252 | SystemCoreClock = HSE_VALUE;
253 | break;
254 | case 0x08: /* PLL used as system clock source */
255 |
256 | /* PLL_VCO = (HSE_VALUE or HSI_VALUE / PLL_M) * PLL_N
257 | SYSCLK = PLL_VCO / PLL_P
258 | */
259 | pllsource = (RCC->PLLCFGR & RCC_PLLCFGR_PLLSRC) >> 22;
260 | pllm = RCC->PLLCFGR & RCC_PLLCFGR_PLLM;
261 |
262 | if (pllsource != 0)
263 | {
264 | /* HSE used as PLL clock source */
265 | pllvco = (HSE_VALUE / pllm) * ((RCC->PLLCFGR & RCC_PLLCFGR_PLLN) >> 6);
266 | }
267 | else
268 | {
269 | /* HSI used as PLL clock source */
270 | pllvco = (HSI_VALUE / pllm) * ((RCC->PLLCFGR & RCC_PLLCFGR_PLLN) >> 6);
271 | }
272 |
273 | pllp = (((RCC->PLLCFGR & RCC_PLLCFGR_PLLP) >>16) + 1 ) *2;
274 | SystemCoreClock = pllvco/pllp;
275 | break;
276 | default:
277 | SystemCoreClock = HSI_VALUE;
278 | break;
279 | }
280 | /* Compute HCLK frequency --------------------------------------------------*/
281 | /* Get HCLK prescaler */
282 | tmp = AHBPrescTable[((RCC->CFGR & RCC_CFGR_HPRE) >> 4)];
283 | /* HCLK frequency */
284 | SystemCoreClock >>= tmp;
285 | }
286 |
287 | #if defined (DATA_IN_ExtSRAM) && defined (DATA_IN_ExtSDRAM)
288 | #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx)\
289 | || defined(STM32F469xx) || defined(STM32F479xx)
290 | /**
291 | * @brief Setup the external memory controller.
292 | * Called in startup_stm32f4xx.s before jump to main.
293 | * This function configures the external memories (SRAM/SDRAM)
294 | * This SRAM/SDRAM will be used as program data memory (including heap and stack).
295 | * @param None
296 | * @retval None
297 | */
298 | void SystemInit_ExtMemCtl(void)
299 | {
300 | __IO uint32_t tmp = 0x00;
301 |
302 | register uint32_t tmpreg = 0, timeout = 0xFFFF;
303 | register __IO uint32_t index;
304 |
305 | /* Enable GPIOC, GPIOD, GPIOE, GPIOF, GPIOG, GPIOH and GPIOI interface clock */
306 | RCC->AHB1ENR |= 0x000001F8;
307 |
308 | /* Delay after an RCC peripheral clock enabling */
309 | tmp = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOCEN);
310 |
311 | /* Connect PDx pins to FMC Alternate function */
312 | GPIOD->AFR[0] = 0x00CCC0CC;
313 | GPIOD->AFR[1] = 0xCCCCCCCC;
314 | /* Configure PDx pins in Alternate function mode */
315 | GPIOD->MODER = 0xAAAA0A8A;
316 | /* Configure PDx pins speed to 100 MHz */
317 | GPIOD->OSPEEDR = 0xFFFF0FCF;
318 | /* Configure PDx pins Output type to push-pull */
319 | GPIOD->OTYPER = 0x00000000;
320 | /* No pull-up, pull-down for PDx pins */
321 | GPIOD->PUPDR = 0x00000000;
322 |
323 | /* Connect PEx pins to FMC Alternate function */
324 | GPIOE->AFR[0] = 0xC00CC0CC;
325 | GPIOE->AFR[1] = 0xCCCCCCCC;
326 | /* Configure PEx pins in Alternate function mode */
327 | GPIOE->MODER = 0xAAAA828A;
328 | /* Configure PEx pins speed to 100 MHz */
329 | GPIOE->OSPEEDR = 0xFFFFC3CF;
330 | /* Configure PEx pins Output type to push-pull */
331 | GPIOE->OTYPER = 0x00000000;
332 | /* No pull-up, pull-down for PEx pins */
333 | GPIOE->PUPDR = 0x00000000;
334 |
335 | /* Connect PFx pins to FMC Alternate function */
336 | GPIOF->AFR[0] = 0xCCCCCCCC;
337 | GPIOF->AFR[1] = 0xCCCCCCCC;
338 | /* Configure PFx pins in Alternate function mode */
339 | GPIOF->MODER = 0xAA800AAA;
340 | /* Configure PFx pins speed to 50 MHz */
341 | GPIOF->OSPEEDR = 0xAA800AAA;
342 | /* Configure PFx pins Output type to push-pull */
343 | GPIOF->OTYPER = 0x00000000;
344 | /* No pull-up, pull-down for PFx pins */
345 | GPIOF->PUPDR = 0x00000000;
346 |
347 | /* Connect PGx pins to FMC Alternate function */
348 | GPIOG->AFR[0] = 0xCCCCCCCC;
349 | GPIOG->AFR[1] = 0xCCCCCCCC;
350 | /* Configure PGx pins in Alternate function mode */
351 | GPIOG->MODER = 0xAAAAAAAA;
352 | /* Configure PGx pins speed to 50 MHz */
353 | GPIOG->OSPEEDR = 0xAAAAAAAA;
354 | /* Configure PGx pins Output type to push-pull */
355 | GPIOG->OTYPER = 0x00000000;
356 | /* No pull-up, pull-down for PGx pins */
357 | GPIOG->PUPDR = 0x00000000;
358 |
359 | /* Connect PHx pins to FMC Alternate function */
360 | GPIOH->AFR[0] = 0x00C0CC00;
361 | GPIOH->AFR[1] = 0xCCCCCCCC;
362 | /* Configure PHx pins in Alternate function mode */
363 | GPIOH->MODER = 0xAAAA08A0;
364 | /* Configure PHx pins speed to 50 MHz */
365 | GPIOH->OSPEEDR = 0xAAAA08A0;
366 | /* Configure PHx pins Output type to push-pull */
367 | GPIOH->OTYPER = 0x00000000;
368 | /* No pull-up, pull-down for PHx pins */
369 | GPIOH->PUPDR = 0x00000000;
370 |
371 | /* Connect PIx pins to FMC Alternate function */
372 | GPIOI->AFR[0] = 0xCCCCCCCC;
373 | GPIOI->AFR[1] = 0x00000CC0;
374 | /* Configure PIx pins in Alternate function mode */
375 | GPIOI->MODER = 0x0028AAAA;
376 | /* Configure PIx pins speed to 50 MHz */
377 | GPIOI->OSPEEDR = 0x0028AAAA;
378 | /* Configure PIx pins Output type to push-pull */
379 | GPIOI->OTYPER = 0x00000000;
380 | /* No pull-up, pull-down for PIx pins */
381 | GPIOI->PUPDR = 0x00000000;
382 |
383 | /*-- FMC Configuration -------------------------------------------------------*/
384 | /* Enable the FMC interface clock */
385 | RCC->AHB3ENR |= 0x00000001;
386 | /* Delay after an RCC peripheral clock enabling */
387 | tmp = READ_BIT(RCC->AHB3ENR, RCC_AHB3ENR_FMCEN);
388 |
389 | FMC_Bank5_6->SDCR[0] = 0x000019E4;
390 | FMC_Bank5_6->SDTR[0] = 0x01115351;
391 |
392 | /* SDRAM initialization sequence */
393 | /* Clock enable command */
394 | FMC_Bank5_6->SDCMR = 0x00000011;
395 | tmpreg = FMC_Bank5_6->SDSR & 0x00000020;
396 | while((tmpreg != 0) && (timeout-- > 0))
397 | {
398 | tmpreg = FMC_Bank5_6->SDSR & 0x00000020;
399 | }
400 |
401 | /* Delay */
402 | for (index = 0; index<1000; index++);
403 |
404 | /* PALL command */
405 | FMC_Bank5_6->SDCMR = 0x00000012;
406 | timeout = 0xFFFF;
407 | while((tmpreg != 0) && (timeout-- > 0))
408 | {
409 | tmpreg = FMC_Bank5_6->SDSR & 0x00000020;
410 | }
411 |
412 | /* Auto refresh command */
413 | FMC_Bank5_6->SDCMR = 0x00000073;
414 | timeout = 0xFFFF;
415 | while((tmpreg != 0) && (timeout-- > 0))
416 | {
417 | tmpreg = FMC_Bank5_6->SDSR & 0x00000020;
418 | }
419 |
420 | /* MRD register program */
421 | FMC_Bank5_6->SDCMR = 0x00046014;
422 | timeout = 0xFFFF;
423 | while((tmpreg != 0) && (timeout-- > 0))
424 | {
425 | tmpreg = FMC_Bank5_6->SDSR & 0x00000020;
426 | }
427 |
428 | /* Set refresh count */
429 | tmpreg = FMC_Bank5_6->SDRTR;
430 | FMC_Bank5_6->SDRTR = (tmpreg | (0x0000027C<<1));
431 |
432 | /* Disable write protection */
433 | tmpreg = FMC_Bank5_6->SDCR[0];
434 | FMC_Bank5_6->SDCR[0] = (tmpreg & 0xFFFFFDFF);
435 |
436 | #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx)
437 | /* Configure and enable Bank1_SRAM2 */
438 | FMC_Bank1->BTCR[2] = 0x00001011;
439 | FMC_Bank1->BTCR[3] = 0x00000201;
440 | FMC_Bank1E->BWTR[2] = 0x0fffffff;
441 | #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx */
442 | #if defined(STM32F469xx) || defined(STM32F479xx)
443 | /* Configure and enable Bank1_SRAM2 */
444 | FMC_Bank1->BTCR[2] = 0x00001091;
445 | FMC_Bank1->BTCR[3] = 0x00110212;
446 | FMC_Bank1E->BWTR[2] = 0x0fffffff;
447 | #endif /* STM32F469xx || STM32F479xx */
448 |
449 | (void)(tmp);
450 | }
451 | #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */
452 | #elif defined (DATA_IN_ExtSRAM) || defined (DATA_IN_ExtSDRAM)
453 | /**
454 | * @brief Setup the external memory controller.
455 | * Called in startup_stm32f4xx.s before jump to main.
456 | * This function configures the external memories (SRAM/SDRAM)
457 | * This SRAM/SDRAM will be used as program data memory (including heap and stack).
458 | * @param None
459 | * @retval None
460 | */
461 | void SystemInit_ExtMemCtl(void)
462 | {
463 | __IO uint32_t tmp = 0x00;
464 | #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx)\
465 | || defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx)
466 | #if defined (DATA_IN_ExtSDRAM)
467 | register uint32_t tmpreg = 0, timeout = 0xFFFF;
468 | register __IO uint32_t index;
469 |
470 | #if defined(STM32F446xx)
471 | /* Enable GPIOA, GPIOC, GPIOD, GPIOE, GPIOF, GPIOG interface
472 | clock */
473 | RCC->AHB1ENR |= 0x0000007D;
474 | #else
475 | /* Enable GPIOC, GPIOD, GPIOE, GPIOF, GPIOG, GPIOH and GPIOI interface
476 | clock */
477 | RCC->AHB1ENR |= 0x000001F8;
478 | #endif /* STM32F446xx */
479 | /* Delay after an RCC peripheral clock enabling */
480 | tmp = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIOCEN);
481 |
482 | #if defined(STM32F446xx)
483 | /* Connect PAx pins to FMC Alternate function */
484 | GPIOA->AFR[0] |= 0xC0000000;
485 | GPIOA->AFR[1] |= 0x00000000;
486 | /* Configure PDx pins in Alternate function mode */
487 | GPIOA->MODER |= 0x00008000;
488 | /* Configure PDx pins speed to 50 MHz */
489 | GPIOA->OSPEEDR |= 0x00008000;
490 | /* Configure PDx pins Output type to push-pull */
491 | GPIOA->OTYPER |= 0x00000000;
492 | /* No pull-up, pull-down for PDx pins */
493 | GPIOA->PUPDR |= 0x00000000;
494 |
495 | /* Connect PCx pins to FMC Alternate function */
496 | GPIOC->AFR[0] |= 0x00CC0000;
497 | GPIOC->AFR[1] |= 0x00000000;
498 | /* Configure PDx pins in Alternate function mode */
499 | GPIOC->MODER |= 0x00000A00;
500 | /* Configure PDx pins speed to 50 MHz */
501 | GPIOC->OSPEEDR |= 0x00000A00;
502 | /* Configure PDx pins Output type to push-pull */
503 | GPIOC->OTYPER |= 0x00000000;
504 | /* No pull-up, pull-down for PDx pins */
505 | GPIOC->PUPDR |= 0x00000000;
506 | #endif /* STM32F446xx */
507 |
508 | /* Connect PDx pins to FMC Alternate function */
509 | GPIOD->AFR[0] = 0x000000CC;
510 | GPIOD->AFR[1] = 0xCC000CCC;
511 | /* Configure PDx pins in Alternate function mode */
512 | GPIOD->MODER = 0xA02A000A;
513 | /* Configure PDx pins speed to 50 MHz */
514 | GPIOD->OSPEEDR = 0xA02A000A;
515 | /* Configure PDx pins Output type to push-pull */
516 | GPIOD->OTYPER = 0x00000000;
517 | /* No pull-up, pull-down for PDx pins */
518 | GPIOD->PUPDR = 0x00000000;
519 |
520 | /* Connect PEx pins to FMC Alternate function */
521 | GPIOE->AFR[0] = 0xC00000CC;
522 | GPIOE->AFR[1] = 0xCCCCCCCC;
523 | /* Configure PEx pins in Alternate function mode */
524 | GPIOE->MODER = 0xAAAA800A;
525 | /* Configure PEx pins speed to 50 MHz */
526 | GPIOE->OSPEEDR = 0xAAAA800A;
527 | /* Configure PEx pins Output type to push-pull */
528 | GPIOE->OTYPER = 0x00000000;
529 | /* No pull-up, pull-down for PEx pins */
530 | GPIOE->PUPDR = 0x00000000;
531 |
532 | /* Connect PFx pins to FMC Alternate function */
533 | GPIOF->AFR[0] = 0xCCCCCCCC;
534 | GPIOF->AFR[1] = 0xCCCCCCCC;
535 | /* Configure PFx pins in Alternate function mode */
536 | GPIOF->MODER = 0xAA800AAA;
537 | /* Configure PFx pins speed to 50 MHz */
538 | GPIOF->OSPEEDR = 0xAA800AAA;
539 | /* Configure PFx pins Output type to push-pull */
540 | GPIOF->OTYPER = 0x00000000;
541 | /* No pull-up, pull-down for PFx pins */
542 | GPIOF->PUPDR = 0x00000000;
543 |
544 | /* Connect PGx pins to FMC Alternate function */
545 | GPIOG->AFR[0] = 0xCCCCCCCC;
546 | GPIOG->AFR[1] = 0xCCCCCCCC;
547 | /* Configure PGx pins in Alternate function mode */
548 | GPIOG->MODER = 0xAAAAAAAA;
549 | /* Configure PGx pins speed to 50 MHz */
550 | GPIOG->OSPEEDR = 0xAAAAAAAA;
551 | /* Configure PGx pins Output type to push-pull */
552 | GPIOG->OTYPER = 0x00000000;
553 | /* No pull-up, pull-down for PGx pins */
554 | GPIOG->PUPDR = 0x00000000;
555 |
556 | #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx)\
557 | || defined(STM32F469xx) || defined(STM32F479xx)
558 | /* Connect PHx pins to FMC Alternate function */
559 | GPIOH->AFR[0] = 0x00C0CC00;
560 | GPIOH->AFR[1] = 0xCCCCCCCC;
561 | /* Configure PHx pins in Alternate function mode */
562 | GPIOH->MODER = 0xAAAA08A0;
563 | /* Configure PHx pins speed to 50 MHz */
564 | GPIOH->OSPEEDR = 0xAAAA08A0;
565 | /* Configure PHx pins Output type to push-pull */
566 | GPIOH->OTYPER = 0x00000000;
567 | /* No pull-up, pull-down for PHx pins */
568 | GPIOH->PUPDR = 0x00000000;
569 |
570 | /* Connect PIx pins to FMC Alternate function */
571 | GPIOI->AFR[0] = 0xCCCCCCCC;
572 | GPIOI->AFR[1] = 0x00000CC0;
573 | /* Configure PIx pins in Alternate function mode */
574 | GPIOI->MODER = 0x0028AAAA;
575 | /* Configure PIx pins speed to 50 MHz */
576 | GPIOI->OSPEEDR = 0x0028AAAA;
577 | /* Configure PIx pins Output type to push-pull */
578 | GPIOI->OTYPER = 0x00000000;
579 | /* No pull-up, pull-down for PIx pins */
580 | GPIOI->PUPDR = 0x00000000;
581 | #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx */
582 |
583 | /*-- FMC Configuration -------------------------------------------------------*/
584 | /* Enable the FMC interface clock */
585 | RCC->AHB3ENR |= 0x00000001;
586 | /* Delay after an RCC peripheral clock enabling */
587 | tmp = READ_BIT(RCC->AHB3ENR, RCC_AHB3ENR_FMCEN);
588 |
589 | /* Configure and enable SDRAM bank1 */
590 | #if defined(STM32F446xx)
591 | FMC_Bank5_6->SDCR[0] = 0x00001954;
592 | #else
593 | FMC_Bank5_6->SDCR[0] = 0x000019E4;
594 | #endif /* STM32F446xx */
595 | FMC_Bank5_6->SDTR[0] = 0x01115351;
596 |
597 | /* SDRAM initialization sequence */
598 | /* Clock enable command */
599 | FMC_Bank5_6->SDCMR = 0x00000011;
600 | tmpreg = FMC_Bank5_6->SDSR & 0x00000020;
601 | while((tmpreg != 0) && (timeout-- > 0))
602 | {
603 | tmpreg = FMC_Bank5_6->SDSR & 0x00000020;
604 | }
605 |
606 | /* Delay */
607 | for (index = 0; index<1000; index++);
608 |
609 | /* PALL command */
610 | FMC_Bank5_6->SDCMR = 0x00000012;
611 | timeout = 0xFFFF;
612 | while((tmpreg != 0) && (timeout-- > 0))
613 | {
614 | tmpreg = FMC_Bank5_6->SDSR & 0x00000020;
615 | }
616 |
617 | /* Auto refresh command */
618 | #if defined(STM32F446xx)
619 | FMC_Bank5_6->SDCMR = 0x000000F3;
620 | #else
621 | FMC_Bank5_6->SDCMR = 0x00000073;
622 | #endif /* STM32F446xx */
623 | timeout = 0xFFFF;
624 | while((tmpreg != 0) && (timeout-- > 0))
625 | {
626 | tmpreg = FMC_Bank5_6->SDSR & 0x00000020;
627 | }
628 |
629 | /* MRD register program */
630 | #if defined(STM32F446xx)
631 | FMC_Bank5_6->SDCMR = 0x00044014;
632 | #else
633 | FMC_Bank5_6->SDCMR = 0x00046014;
634 | #endif /* STM32F446xx */
635 | timeout = 0xFFFF;
636 | while((tmpreg != 0) && (timeout-- > 0))
637 | {
638 | tmpreg = FMC_Bank5_6->SDSR & 0x00000020;
639 | }
640 |
641 | /* Set refresh count */
642 | tmpreg = FMC_Bank5_6->SDRTR;
643 | #if defined(STM32F446xx)
644 | FMC_Bank5_6->SDRTR = (tmpreg | (0x0000050C<<1));
645 | #else
646 | FMC_Bank5_6->SDRTR = (tmpreg | (0x0000027C<<1));
647 | #endif /* STM32F446xx */
648 |
649 | /* Disable write protection */
650 | tmpreg = FMC_Bank5_6->SDCR[0];
651 | FMC_Bank5_6->SDCR[0] = (tmpreg & 0xFFFFFDFF);
652 | #endif /* DATA_IN_ExtSDRAM */
653 | #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx */
654 |
655 | #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx)\
656 | || defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx)\
657 | || defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx)
658 |
659 | #if defined(DATA_IN_ExtSRAM)
660 | /*-- GPIOs Configuration -----------------------------------------------------*/
661 | /* Enable GPIOD, GPIOE, GPIOF and GPIOG interface clock */
662 | RCC->AHB1ENR |= 0x00000078;
663 | /* Delay after an RCC peripheral clock enabling */
664 | tmp = READ_BIT(RCC->AHB1ENR, RCC_AHB1ENR_GPIODEN);
665 |
666 | /* Connect PDx pins to FMC Alternate function */
667 | GPIOD->AFR[0] = 0x00CCC0CC;
668 | GPIOD->AFR[1] = 0xCCCCCCCC;
669 | /* Configure PDx pins in Alternate function mode */
670 | GPIOD->MODER = 0xAAAA0A8A;
671 | /* Configure PDx pins speed to 100 MHz */
672 | GPIOD->OSPEEDR = 0xFFFF0FCF;
673 | /* Configure PDx pins Output type to push-pull */
674 | GPIOD->OTYPER = 0x00000000;
675 | /* No pull-up, pull-down for PDx pins */
676 | GPIOD->PUPDR = 0x00000000;
677 |
678 | /* Connect PEx pins to FMC Alternate function */
679 | GPIOE->AFR[0] = 0xC00CC0CC;
680 | GPIOE->AFR[1] = 0xCCCCCCCC;
681 | /* Configure PEx pins in Alternate function mode */
682 | GPIOE->MODER = 0xAAAA828A;
683 | /* Configure PEx pins speed to 100 MHz */
684 | GPIOE->OSPEEDR = 0xFFFFC3CF;
685 | /* Configure PEx pins Output type to push-pull */
686 | GPIOE->OTYPER = 0x00000000;
687 | /* No pull-up, pull-down for PEx pins */
688 | GPIOE->PUPDR = 0x00000000;
689 |
690 | /* Connect PFx pins to FMC Alternate function */
691 | GPIOF->AFR[0] = 0x00CCCCCC;
692 | GPIOF->AFR[1] = 0xCCCC0000;
693 | /* Configure PFx pins in Alternate function mode */
694 | GPIOF->MODER = 0xAA000AAA;
695 | /* Configure PFx pins speed to 100 MHz */
696 | GPIOF->OSPEEDR = 0xFF000FFF;
697 | /* Configure PFx pins Output type to push-pull */
698 | GPIOF->OTYPER = 0x00000000;
699 | /* No pull-up, pull-down for PFx pins */
700 | GPIOF->PUPDR = 0x00000000;
701 |
702 | /* Connect PGx pins to FMC Alternate function */
703 | GPIOG->AFR[0] = 0x00CCCCCC;
704 | GPIOG->AFR[1] = 0x000000C0;
705 | /* Configure PGx pins in Alternate function mode */
706 | GPIOG->MODER = 0x00085AAA;
707 | /* Configure PGx pins speed to 100 MHz */
708 | GPIOG->OSPEEDR = 0x000CAFFF;
709 | /* Configure PGx pins Output type to push-pull */
710 | GPIOG->OTYPER = 0x00000000;
711 | /* No pull-up, pull-down for PGx pins */
712 | GPIOG->PUPDR = 0x00000000;
713 |
714 | /*-- FMC/FSMC Configuration --------------------------------------------------*/
715 | /* Enable the FMC/FSMC interface clock */
716 | RCC->AHB3ENR |= 0x00000001;
717 |
718 | #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx)
719 | /* Delay after an RCC peripheral clock enabling */
720 | tmp = READ_BIT(RCC->AHB3ENR, RCC_AHB3ENR_FMCEN);
721 | /* Configure and enable Bank1_SRAM2 */
722 | FMC_Bank1->BTCR[2] = 0x00001011;
723 | FMC_Bank1->BTCR[3] = 0x00000201;
724 | FMC_Bank1E->BWTR[2] = 0x0fffffff;
725 | #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx */
726 | #if defined(STM32F469xx) || defined(STM32F479xx)
727 | /* Delay after an RCC peripheral clock enabling */
728 | tmp = READ_BIT(RCC->AHB3ENR, RCC_AHB3ENR_FMCEN);
729 | /* Configure and enable Bank1_SRAM2 */
730 | FMC_Bank1->BTCR[2] = 0x00001091;
731 | FMC_Bank1->BTCR[3] = 0x00110212;
732 | FMC_Bank1E->BWTR[2] = 0x0fffffff;
733 | #endif /* STM32F469xx || STM32F479xx */
734 | #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx)|| defined(STM32F417xx)\
735 | || defined(STM32F412Zx) || defined(STM32F412Vx)
736 | /* Delay after an RCC peripheral clock enabling */
737 | tmp = READ_BIT(RCC->AHB3ENR, RCC_AHB3ENR_FSMCEN);
738 | /* Configure and enable Bank1_SRAM2 */
739 | FSMC_Bank1->BTCR[2] = 0x00001011;
740 | FSMC_Bank1->BTCR[3] = 0x00000201;
741 | FSMC_Bank1E->BWTR[2] = 0x0FFFFFFF;
742 | #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F412Zx || STM32F412Vx */
743 |
744 | #endif /* DATA_IN_ExtSRAM */
745 | #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx ||\
746 | STM32F429xx || STM32F439xx || STM32F469xx || STM32F479xx || STM32F412Zx || STM32F412Vx */
747 | (void)(tmp);
748 | }
749 | #endif /* DATA_IN_ExtSRAM && DATA_IN_ExtSDRAM */
750 | /**
751 | * @}
752 | */
753 |
754 | /**
755 | * @}
756 | */
757 |
758 | /**
759 | * @}
760 | */
761 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
762 |
--------------------------------------------------------------------------------
/startup_stm32f411xe.s:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file startup_stm32f411xe.s
4 | * @author MCD Application Team
5 | * @brief STM32F411xExx Devices vector table for GCC based toolchains.
6 | * This module performs:
7 | * - Set the initial SP
8 | * - Set the initial PC == Reset_Handler,
9 | * - Set the vector table entries with the exceptions ISR address
10 | * - Branches to main in the C library (which eventually
11 | * calls main()).
12 | * After Reset the Cortex-M4 processor is in Thread mode,
13 | * priority is Privileged, and the Stack is set to Main.
14 | ******************************************************************************
15 | * @attention
16 | *
17 | * © COPYRIGHT 2017 STMicroelectronics
18 | *
19 | * Redistribution and use in source and binary forms, with or without modification,
20 | * are permitted provided that the following conditions are met:
21 | * 1. Redistributions of source code must retain the above copyright notice,
22 | * this list of conditions and the following disclaimer.
23 | * 2. Redistributions in binary form must reproduce the above copyright notice,
24 | * this list of conditions and the following disclaimer in the documentation
25 | * and/or other materials provided with the distribution.
26 | * 3. Neither the name of STMicroelectronics nor the names of its contributors
27 | * may be used to endorse or promote products derived from this software
28 | * without specific prior written permission.
29 | *
30 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
31 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
32 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
33 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
34 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
35 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
36 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
37 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
38 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
39 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40 | *
41 | ******************************************************************************
42 | */
43 |
44 | .syntax unified
45 | .cpu cortex-m4
46 | .fpu softvfp
47 | .thumb
48 |
49 | .global g_pfnVectors
50 | .global Default_Handler
51 |
52 | /* start address for the initialization values of the .data section.
53 | defined in linker script */
54 | .word _sidata
55 | /* start address for the .data section. defined in linker script */
56 | .word _sdata
57 | /* end address for the .data section. defined in linker script */
58 | .word _edata
59 | /* start address for the .bss section. defined in linker script */
60 | .word _sbss
61 | /* end address for the .bss section. defined in linker script */
62 | .word _ebss
63 | /* stack used for SystemInit_ExtMemCtl; always internal RAM used */
64 |
65 | /**
66 | * @brief This is the code that gets called when the processor first
67 | * starts execution following a reset event. Only the absolutely
68 | * necessary set is performed, after which the application
69 | * supplied main() routine is called.
70 | * @param None
71 | * @retval : None
72 | */
73 |
74 | .section .text.Reset_Handler
75 | .weak Reset_Handler
76 | .type Reset_Handler, %function
77 | Reset_Handler:
78 | ldr sp, =_estack /* set stack pointer */
79 |
80 | /* Copy the data segment initializers from flash to SRAM */
81 | movs r1, #0
82 | b LoopCopyDataInit
83 |
84 | CopyDataInit:
85 | ldr r3, =_sidata
86 | ldr r3, [r3, r1]
87 | str r3, [r0, r1]
88 | adds r1, r1, #4
89 |
90 | LoopCopyDataInit:
91 | ldr r0, =_sdata
92 | ldr r3, =_edata
93 | adds r2, r0, r1
94 | cmp r2, r3
95 | bcc CopyDataInit
96 | ldr r2, =_sbss
97 | b LoopFillZerobss
98 | /* Zero fill the bss segment. */
99 | FillZerobss:
100 | movs r3, #0
101 | str r3, [r2], #4
102 |
103 | LoopFillZerobss:
104 | ldr r3, = _ebss
105 | cmp r2, r3
106 | bcc FillZerobss
107 |
108 | /* Call the clock system intitialization function.*/
109 | bl SystemInit
110 | /* Call static constructors */
111 | bl __libc_init_array
112 | /* Call the application's entry point.*/
113 | bl main
114 | bx lr
115 | .size Reset_Handler, .-Reset_Handler
116 |
117 | /**
118 | * @brief This is the code that gets called when the processor receives an
119 | * unexpected interrupt. This simply enters an infinite loop, preserving
120 | * the system state for examination by a debugger.
121 | * @param None
122 | * @retval None
123 | */
124 | .section .text.Default_Handler,"ax",%progbits
125 | Default_Handler:
126 | Infinite_Loop:
127 | b Infinite_Loop
128 | .size Default_Handler, .-Default_Handler
129 | /******************************************************************************
130 | *
131 | * The minimal vector table for a Cortex M3. Note that the proper constructs
132 | * must be placed on this to ensure that it ends up at physical address
133 | * 0x0000.0000.
134 | *
135 | *******************************************************************************/
136 | .section .isr_vector,"a",%progbits
137 | .type g_pfnVectors, %object
138 | .size g_pfnVectors, .-g_pfnVectors
139 |
140 | g_pfnVectors:
141 | .word _estack
142 | .word Reset_Handler
143 | .word NMI_Handler
144 | .word HardFault_Handler
145 | .word MemManage_Handler
146 | .word BusFault_Handler
147 | .word UsageFault_Handler
148 | .word 0
149 | .word 0
150 | .word 0
151 | .word 0
152 | .word SVC_Handler
153 | .word DebugMon_Handler
154 | .word 0
155 | .word PendSV_Handler
156 | .word SysTick_Handler
157 |
158 | /* External Interrupts */
159 | .word WWDG_IRQHandler /* Window WatchDog */
160 | .word PVD_IRQHandler /* PVD through EXTI Line detection */
161 | .word TAMP_STAMP_IRQHandler /* Tamper and TimeStamps through the EXTI line */
162 | .word RTC_WKUP_IRQHandler /* RTC Wakeup through the EXTI line */
163 | .word FLASH_IRQHandler /* FLASH */
164 | .word RCC_IRQHandler /* RCC */
165 | .word EXTI0_IRQHandler /* EXTI Line0 */
166 | .word EXTI1_IRQHandler /* EXTI Line1 */
167 | .word EXTI2_IRQHandler /* EXTI Line2 */
168 | .word EXTI3_IRQHandler /* EXTI Line3 */
169 | .word EXTI4_IRQHandler /* EXTI Line4 */
170 | .word DMA1_Stream0_IRQHandler /* DMA1 Stream 0 */
171 | .word DMA1_Stream1_IRQHandler /* DMA1 Stream 1 */
172 | .word DMA1_Stream2_IRQHandler /* DMA1 Stream 2 */
173 | .word DMA1_Stream3_IRQHandler /* DMA1 Stream 3 */
174 | .word DMA1_Stream4_IRQHandler /* DMA1 Stream 4 */
175 | .word DMA1_Stream5_IRQHandler /* DMA1 Stream 5 */
176 | .word DMA1_Stream6_IRQHandler /* DMA1 Stream 6 */
177 | .word ADC_IRQHandler /* ADC1, ADC2 and ADC3s */
178 | .word 0 /* Reserved */
179 | .word 0 /* Reserved */
180 | .word 0 /* Reserved */
181 | .word 0 /* Reserved */
182 | .word EXTI9_5_IRQHandler /* External Line[9:5]s */
183 | .word TIM1_BRK_TIM9_IRQHandler /* TIM1 Break and TIM9 */
184 | .word TIM1_UP_TIM10_IRQHandler /* TIM1 Update and TIM10 */
185 | .word TIM1_TRG_COM_TIM11_IRQHandler /* TIM1 Trigger and Commutation and TIM11 */
186 | .word TIM1_CC_IRQHandler /* TIM1 Capture Compare */
187 | .word TIM2_IRQHandler /* TIM2 */
188 | .word TIM3_IRQHandler /* TIM3 */
189 | .word TIM4_IRQHandler /* TIM4 */
190 | .word I2C1_EV_IRQHandler /* I2C1 Event */
191 | .word I2C1_ER_IRQHandler /* I2C1 Error */
192 | .word I2C2_EV_IRQHandler /* I2C2 Event */
193 | .word I2C2_ER_IRQHandler /* I2C2 Error */
194 | .word SPI1_IRQHandler /* SPI1 */
195 | .word SPI2_IRQHandler /* SPI2 */
196 | .word USART1_IRQHandler /* USART1 */
197 | .word USART2_IRQHandler /* USART2 */
198 | .word 0 /* Reserved */
199 | .word EXTI15_10_IRQHandler /* External Line[15:10]s */
200 | .word RTC_Alarm_IRQHandler /* RTC Alarm (A and B) through EXTI Line */
201 | .word OTG_FS_WKUP_IRQHandler /* USB OTG FS Wakeup through EXTI line */
202 | .word 0 /* Reserved */
203 | .word 0 /* Reserved */
204 | .word 0 /* Reserved */
205 | .word 0 /* Reserved */
206 | .word DMA1_Stream7_IRQHandler /* DMA1 Stream7 */
207 | .word 0 /* Reserved */
208 | .word SDIO_IRQHandler /* SDIO */
209 | .word TIM5_IRQHandler /* TIM5 */
210 | .word SPI3_IRQHandler /* SPI3 */
211 | .word 0 /* Reserved */
212 | .word 0 /* Reserved */
213 | .word 0 /* Reserved */
214 | .word 0 /* Reserved */
215 | .word DMA2_Stream0_IRQHandler /* DMA2 Stream 0 */
216 | .word DMA2_Stream1_IRQHandler /* DMA2 Stream 1 */
217 | .word DMA2_Stream2_IRQHandler /* DMA2 Stream 2 */
218 | .word DMA2_Stream3_IRQHandler /* DMA2 Stream 3 */
219 | .word DMA2_Stream4_IRQHandler /* DMA2 Stream 4 */
220 | .word 0 /* Reserved */
221 | .word 0 /* Reserved */
222 | .word 0 /* Reserved */
223 | .word 0 /* Reserved */
224 | .word 0 /* Reserved */
225 | .word 0 /* Reserved */
226 | .word OTG_FS_IRQHandler /* USB OTG FS */
227 | .word DMA2_Stream5_IRQHandler /* DMA2 Stream 5 */
228 | .word DMA2_Stream6_IRQHandler /* DMA2 Stream 6 */
229 | .word DMA2_Stream7_IRQHandler /* DMA2 Stream 7 */
230 | .word USART6_IRQHandler /* USART6 */
231 | .word I2C3_EV_IRQHandler /* I2C3 event */
232 | .word I2C3_ER_IRQHandler /* I2C3 error */
233 | .word 0 /* Reserved */
234 | .word 0 /* Reserved */
235 | .word 0 /* Reserved */
236 | .word 0 /* Reserved */
237 | .word 0 /* Reserved */
238 | .word 0 /* Reserved */
239 | .word 0 /* Reserved */
240 | .word FPU_IRQHandler /* FPU */
241 | .word 0 /* Reserved */
242 | .word 0 /* Reserved */
243 | .word SPI4_IRQHandler /* SPI4 */
244 | .word SPI5_IRQHandler /* SPI5 */
245 |
246 | /*******************************************************************************
247 | *
248 | * Provide weak aliases for each Exception handler to the Default_Handler.
249 | * As they are weak aliases, any function with the same name will override
250 | * this definition.
251 | *
252 | *******************************************************************************/
253 | .weak NMI_Handler
254 | .thumb_set NMI_Handler,Default_Handler
255 |
256 | .weak HardFault_Handler
257 | .thumb_set HardFault_Handler,Default_Handler
258 |
259 | .weak MemManage_Handler
260 | .thumb_set MemManage_Handler,Default_Handler
261 |
262 | .weak BusFault_Handler
263 | .thumb_set BusFault_Handler,Default_Handler
264 |
265 | .weak UsageFault_Handler
266 | .thumb_set UsageFault_Handler,Default_Handler
267 |
268 | .weak SVC_Handler
269 | .thumb_set SVC_Handler,Default_Handler
270 |
271 | .weak DebugMon_Handler
272 | .thumb_set DebugMon_Handler,Default_Handler
273 |
274 | .weak PendSV_Handler
275 | .thumb_set PendSV_Handler,Default_Handler
276 |
277 | .weak SysTick_Handler
278 | .thumb_set SysTick_Handler,Default_Handler
279 |
280 | .weak WWDG_IRQHandler
281 | .thumb_set WWDG_IRQHandler,Default_Handler
282 |
283 | .weak PVD_IRQHandler
284 | .thumb_set PVD_IRQHandler,Default_Handler
285 |
286 | .weak TAMP_STAMP_IRQHandler
287 | .thumb_set TAMP_STAMP_IRQHandler,Default_Handler
288 |
289 | .weak RTC_WKUP_IRQHandler
290 | .thumb_set RTC_WKUP_IRQHandler,Default_Handler
291 |
292 | .weak FLASH_IRQHandler
293 | .thumb_set FLASH_IRQHandler,Default_Handler
294 |
295 | .weak RCC_IRQHandler
296 | .thumb_set RCC_IRQHandler,Default_Handler
297 |
298 | .weak EXTI0_IRQHandler
299 | .thumb_set EXTI0_IRQHandler,Default_Handler
300 |
301 | .weak EXTI1_IRQHandler
302 | .thumb_set EXTI1_IRQHandler,Default_Handler
303 |
304 | .weak EXTI2_IRQHandler
305 | .thumb_set EXTI2_IRQHandler,Default_Handler
306 |
307 | .weak EXTI3_IRQHandler
308 | .thumb_set EXTI3_IRQHandler,Default_Handler
309 |
310 | .weak EXTI4_IRQHandler
311 | .thumb_set EXTI4_IRQHandler,Default_Handler
312 |
313 | .weak DMA1_Stream0_IRQHandler
314 | .thumb_set DMA1_Stream0_IRQHandler,Default_Handler
315 |
316 | .weak DMA1_Stream1_IRQHandler
317 | .thumb_set DMA1_Stream1_IRQHandler,Default_Handler
318 |
319 | .weak DMA1_Stream2_IRQHandler
320 | .thumb_set DMA1_Stream2_IRQHandler,Default_Handler
321 |
322 | .weak DMA1_Stream3_IRQHandler
323 | .thumb_set DMA1_Stream3_IRQHandler,Default_Handler
324 |
325 | .weak DMA1_Stream4_IRQHandler
326 | .thumb_set DMA1_Stream4_IRQHandler,Default_Handler
327 |
328 | .weak DMA1_Stream5_IRQHandler
329 | .thumb_set DMA1_Stream5_IRQHandler,Default_Handler
330 |
331 | .weak DMA1_Stream6_IRQHandler
332 | .thumb_set DMA1_Stream6_IRQHandler,Default_Handler
333 |
334 | .weak ADC_IRQHandler
335 | .thumb_set ADC_IRQHandler,Default_Handler
336 |
337 | .weak EXTI9_5_IRQHandler
338 | .thumb_set EXTI9_5_IRQHandler,Default_Handler
339 |
340 | .weak TIM1_BRK_TIM9_IRQHandler
341 | .thumb_set TIM1_BRK_TIM9_IRQHandler,Default_Handler
342 |
343 | .weak TIM1_UP_TIM10_IRQHandler
344 | .thumb_set TIM1_UP_TIM10_IRQHandler,Default_Handler
345 |
346 | .weak TIM1_TRG_COM_TIM11_IRQHandler
347 | .thumb_set TIM1_TRG_COM_TIM11_IRQHandler,Default_Handler
348 |
349 | .weak TIM1_CC_IRQHandler
350 | .thumb_set TIM1_CC_IRQHandler,Default_Handler
351 |
352 | .weak TIM2_IRQHandler
353 | .thumb_set TIM2_IRQHandler,Default_Handler
354 |
355 | .weak TIM3_IRQHandler
356 | .thumb_set TIM3_IRQHandler,Default_Handler
357 |
358 | .weak TIM4_IRQHandler
359 | .thumb_set TIM4_IRQHandler,Default_Handler
360 |
361 | .weak I2C1_EV_IRQHandler
362 | .thumb_set I2C1_EV_IRQHandler,Default_Handler
363 |
364 | .weak I2C1_ER_IRQHandler
365 | .thumb_set I2C1_ER_IRQHandler,Default_Handler
366 |
367 | .weak I2C2_EV_IRQHandler
368 | .thumb_set I2C2_EV_IRQHandler,Default_Handler
369 |
370 | .weak I2C2_ER_IRQHandler
371 | .thumb_set I2C2_ER_IRQHandler,Default_Handler
372 |
373 | .weak SPI1_IRQHandler
374 | .thumb_set SPI1_IRQHandler,Default_Handler
375 |
376 | .weak SPI2_IRQHandler
377 | .thumb_set SPI2_IRQHandler,Default_Handler
378 |
379 | .weak USART1_IRQHandler
380 | .thumb_set USART1_IRQHandler,Default_Handler
381 |
382 | .weak USART2_IRQHandler
383 | .thumb_set USART2_IRQHandler,Default_Handler
384 |
385 | .weak EXTI15_10_IRQHandler
386 | .thumb_set EXTI15_10_IRQHandler,Default_Handler
387 |
388 | .weak RTC_Alarm_IRQHandler
389 | .thumb_set RTC_Alarm_IRQHandler,Default_Handler
390 |
391 | .weak OTG_FS_WKUP_IRQHandler
392 | .thumb_set OTG_FS_WKUP_IRQHandler,Default_Handler
393 |
394 | .weak DMA1_Stream7_IRQHandler
395 | .thumb_set DMA1_Stream7_IRQHandler,Default_Handler
396 |
397 | .weak SDIO_IRQHandler
398 | .thumb_set SDIO_IRQHandler,Default_Handler
399 |
400 | .weak TIM5_IRQHandler
401 | .thumb_set TIM5_IRQHandler,Default_Handler
402 |
403 | .weak SPI3_IRQHandler
404 | .thumb_set SPI3_IRQHandler,Default_Handler
405 |
406 | .weak DMA2_Stream0_IRQHandler
407 | .thumb_set DMA2_Stream0_IRQHandler,Default_Handler
408 |
409 | .weak DMA2_Stream1_IRQHandler
410 | .thumb_set DMA2_Stream1_IRQHandler,Default_Handler
411 |
412 | .weak DMA2_Stream2_IRQHandler
413 | .thumb_set DMA2_Stream2_IRQHandler,Default_Handler
414 |
415 | .weak DMA2_Stream3_IRQHandler
416 | .thumb_set DMA2_Stream3_IRQHandler,Default_Handler
417 |
418 | .weak DMA2_Stream4_IRQHandler
419 | .thumb_set DMA2_Stream4_IRQHandler,Default_Handler
420 |
421 | .weak OTG_FS_IRQHandler
422 | .thumb_set OTG_FS_IRQHandler,Default_Handler
423 |
424 | .weak DMA2_Stream5_IRQHandler
425 | .thumb_set DMA2_Stream5_IRQHandler,Default_Handler
426 |
427 | .weak DMA2_Stream6_IRQHandler
428 | .thumb_set DMA2_Stream6_IRQHandler,Default_Handler
429 |
430 | .weak DMA2_Stream7_IRQHandler
431 | .thumb_set DMA2_Stream7_IRQHandler,Default_Handler
432 |
433 | .weak USART6_IRQHandler
434 | .thumb_set USART6_IRQHandler,Default_Handler
435 |
436 | .weak I2C3_EV_IRQHandler
437 | .thumb_set I2C3_EV_IRQHandler,Default_Handler
438 |
439 | .weak I2C3_ER_IRQHandler
440 | .thumb_set I2C3_ER_IRQHandler,Default_Handler
441 |
442 | .weak FPU_IRQHandler
443 | .thumb_set FPU_IRQHandler,Default_Handler
444 |
445 | .weak SPI4_IRQHandler
446 | .thumb_set SPI4_IRQHandler,Default_Handler
447 |
448 | .weak SPI5_IRQHandler
449 | .thumb_set SPI5_IRQHandler,Default_Handler
450 |
451 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
452 |
453 |
--------------------------------------------------------------------------------
/stm32-i2c-lcd-1602.ioc:
--------------------------------------------------------------------------------
1 | #MicroXplorer Configuration settings - do not modify
2 | File.Version=6
3 | KeepUserPlacement=true
4 | Mcu.Family=STM32F4
5 | Mcu.IP0=I2C1
6 | Mcu.IP1=NVIC
7 | Mcu.IP2=RCC
8 | Mcu.IP3=SYS
9 | Mcu.IP4=USART2
10 | Mcu.IPNb=5
11 | Mcu.Name=STM32F411R(C-E)Tx
12 | Mcu.Package=LQFP64
13 | Mcu.Pin0=PC13-ANTI_TAMP
14 | Mcu.Pin1=PC14-OSC32_IN
15 | Mcu.Pin10=PB3
16 | Mcu.Pin11=PB8
17 | Mcu.Pin12=PB9
18 | Mcu.Pin13=VP_SYS_VS_Systick
19 | Mcu.Pin2=PC15-OSC32_OUT
20 | Mcu.Pin3=PH0 - OSC_IN
21 | Mcu.Pin4=PH1 - OSC_OUT
22 | Mcu.Pin5=PA2
23 | Mcu.Pin6=PA3
24 | Mcu.Pin7=PA5
25 | Mcu.Pin8=PA13
26 | Mcu.Pin9=PA14
27 | Mcu.PinsNb=14
28 | Mcu.UserConstants=
29 | Mcu.UserName=STM32F411RETx
30 | MxCube.Version=4.23.0
31 | MxDb.Version=DB.4.0.230
32 | NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:false\:false
33 | NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:false\:false
34 | NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:false\:false
35 | NVIC.MemoryManagement_IRQn=true\:0\:0\:false\:false\:false\:false
36 | NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:false\:false
37 | NVIC.PendSV_IRQn=true\:0\:0\:false\:false\:false\:false
38 | NVIC.PriorityGroup=NVIC_PRIORITYGROUP_0
39 | NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:false\:false
40 | NVIC.SysTick_IRQn=true\:0\:0\:false\:false\:true\:true
41 | NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:false\:false
42 | PA13.GPIOParameters=GPIO_Label
43 | PA13.GPIO_Label=TMS
44 | PA13.Locked=true
45 | PA13.Signal=SYS_JTMS-SWDIO
46 | PA14.GPIOParameters=GPIO_Label
47 | PA14.GPIO_Label=TCK
48 | PA14.Locked=true
49 | PA14.Signal=SYS_JTCK-SWCLK
50 | PA2.GPIOParameters=GPIO_Label
51 | PA2.GPIO_Label=USART_TX
52 | PA2.Locked=true
53 | PA2.Mode=Asynchronous
54 | PA2.Signal=USART2_TX
55 | PA3.GPIOParameters=GPIO_Label
56 | PA3.GPIO_Label=USART_RX
57 | PA3.Locked=true
58 | PA3.Mode=Asynchronous
59 | PA3.Signal=USART2_RX
60 | PA5.GPIOParameters=GPIO_Label
61 | PA5.GPIO_Label=LD2 [Green Led]
62 | PA5.Locked=true
63 | PA5.Signal=GPIO_Output
64 | PB3.GPIOParameters=GPIO_Label
65 | PB3.GPIO_Label=SWO
66 | PB3.Locked=true
67 | PB3.Signal=SYS_JTDO-SWO
68 | PB8.Locked=true
69 | PB8.Mode=I2C
70 | PB8.Signal=I2C1_SCL
71 | PB9.Locked=true
72 | PB9.Mode=I2C
73 | PB9.Signal=I2C1_SDA
74 | PC13-ANTI_TAMP.GPIOParameters=GPIO_Label,GPIO_ModeDefaultEXTI
75 | PC13-ANTI_TAMP.GPIO_Label=B1 [Blue PushButton]
76 | PC13-ANTI_TAMP.GPIO_ModeDefaultEXTI=GPIO_MODE_IT_FALLING
77 | PC13-ANTI_TAMP.Locked=true
78 | PC13-ANTI_TAMP.Signal=GPXTI13
79 | PC14-OSC32_IN.Locked=true
80 | PC14-OSC32_IN.Signal=RCC_OSC32_IN
81 | PC15-OSC32_OUT.Locked=true
82 | PC15-OSC32_OUT.Signal=RCC_OSC32_OUT
83 | PCC.Checker=false
84 | PCC.Line=STM32F411
85 | PCC.MCU=STM32F411R(C-E)Tx
86 | PCC.PartNumber=STM32F411RETx
87 | PCC.Seq0=0
88 | PCC.Series=STM32F4
89 | PCC.Temperature=25
90 | PCC.Vdd=null
91 | PH0\ -\ OSC_IN.Locked=true
92 | PH0\ -\ OSC_IN.Signal=RCC_OSC_IN
93 | PH1\ -\ OSC_OUT.Locked=true
94 | PH1\ -\ OSC_OUT.Signal=RCC_OSC_OUT
95 | PinOutPanel.RotationAngle=0
96 | ProjectManager.AskForMigrate=true
97 | ProjectManager.BackupPrevious=false
98 | ProjectManager.CompilerOptimize=2
99 | ProjectManager.ComputerToolchain=false
100 | ProjectManager.CoupleFile=false
101 | ProjectManager.CustomerFirmwarePackage=/home/eax/STM32Cube/Repository/STM32Cube_FW_F4_V1.18.0
102 | ProjectManager.DefaultFWLocation=true
103 | ProjectManager.DeletePrevious=true
104 | ProjectManager.DeviceId=STM32F411RETx
105 | ProjectManager.FirmwarePackage=STM32Cube FW_F4 V1.18.0
106 | ProjectManager.FreePins=false
107 | ProjectManager.HalAssertFull=false
108 | ProjectManager.HeapSize=0x200
109 | ProjectManager.KeepUserCode=true
110 | ProjectManager.LastFirmware=true
111 | ProjectManager.LibraryCopy=2
112 | ProjectManager.PreviousToolchain=
113 | ProjectManager.ProjectBuild=false
114 | ProjectManager.ProjectFileName=stm32-i2c-lcd-1602.ioc
115 | ProjectManager.ProjectName=stm32-i2c-lcd-1602
116 | ProjectManager.StackSize=0x400
117 | ProjectManager.TargetToolchain=Makefile
118 | ProjectManager.ToolChainLocation=
119 | ProjectManager.UnderRoot=false
120 | ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL,2-SystemClock_Config-RCC-false-HAL,3-MX_I2C1_Init-I2C1-false-HAL,4-MX_USART2_UART_Init-USART2-false-HAL
121 | RCC.48MHZClocksFreq_Value=84000000
122 | RCC.AHBFreq_Value=84000000
123 | RCC.APB1CLKDivider=RCC_HCLK_DIV2
124 | RCC.APB1Freq_Value=42000000
125 | RCC.APB1TimFreq_Value=84000000
126 | RCC.APB2Freq_Value=84000000
127 | RCC.APB2TimFreq_Value=84000000
128 | RCC.CortexFreq_Value=84000000
129 | RCC.EthernetFreq_Value=84000000
130 | RCC.FCLKCortexFreq_Value=84000000
131 | RCC.FLatency-AdvancedSettings=FLASH_LATENCY_2
132 | RCC.FamilyName=M
133 | RCC.HCLKFreq_Value=84000000
134 | RCC.HSE_VALUE=8000000
135 | RCC.HSI_VALUE=16000000
136 | RCC.I2SClocksFreq_Value=96000000
137 | RCC.IPParameters=48MHZClocksFreq_Value,AHBFreq_Value,APB1CLKDivider,APB1Freq_Value,APB1TimFreq_Value,APB2Freq_Value,APB2TimFreq_Value,CortexFreq_Value,EthernetFreq_Value,FCLKCortexFreq_Value,FLatency-AdvancedSettings,FamilyName,HCLKFreq_Value,HSE_VALUE,HSI_VALUE,I2SClocksFreq_Value,LSE_VALUE,LSI_VALUE,MCO2PinFreq_Value,PLLCLKFreq_Value,PLLN,PLLP,PLLQCLKFreq_Value,RTCFreq_Value,RTCHSEDivFreq_Value,SYSCLKFreq_VALUE,SYSCLKSource,VCOI2SOutputFreq_Value,VCOInputFreq_Value,VCOInputMFreq_Value,VCOOutputFreq_Value,VcooutputI2S
138 | RCC.LSE_VALUE=32768
139 | RCC.LSI_VALUE=32000
140 | RCC.MCO2PinFreq_Value=84000000
141 | RCC.PLLCLKFreq_Value=84000000
142 | RCC.PLLN=336
143 | RCC.PLLP=RCC_PLLP_DIV4
144 | RCC.PLLQCLKFreq_Value=84000000
145 | RCC.RTCFreq_Value=32000
146 | RCC.RTCHSEDivFreq_Value=4000000
147 | RCC.SYSCLKFreq_VALUE=84000000
148 | RCC.SYSCLKSource=RCC_SYSCLKSOURCE_PLLCLK
149 | RCC.VCOI2SOutputFreq_Value=192000000
150 | RCC.VCOInputFreq_Value=1000000
151 | RCC.VCOInputMFreq_Value=1000000
152 | RCC.VCOOutputFreq_Value=336000000
153 | RCC.VcooutputI2S=96000000
154 | SH.GPXTI13.0=GPIO_EXTI13
155 | SH.GPXTI13.ConfNb=1
156 | USART2.BaudRate=9600
157 | USART2.IPParameters=VirtualMode,BaudRate
158 | USART2.VirtualMode=VM_ASYNC
159 | VP_SYS_VS_Systick.Mode=SysTick
160 | VP_SYS_VS_Systick.Signal=SYS_VS_Systick
161 | board=NUCLEO-F411RE
162 | boardIOC=true
163 |
--------------------------------------------------------------------------------