precision-converters-firmware
Loading...
Searching...
No Matches
app_config_stm32.h
Go to the documentation of this file.
1/***************************************************************************/
13#ifndef APP_CONFIG_STM32_H_
14#define APP_CONFIG_STM32_H_
15
16/******************************************************************************/
17/***************************** Include Files **********************************/
18/******************************************************************************/
19
20#include "main.h"
21#include "stm32_uart.h"
22#include "stm32_spi.h"
23#include "stm32_gpio.h"
24#include "stm32_i2c.h"
25#include "stm32_dma.h"
26
27#if defined (STM32F469xx) || defined (STM32H563xx)
28#include "stm32_usb_uart.h"
29#endif
30
31#ifdef USE_QUAD_SPI
32#include "stm32_xspi.h"
33#endif
34
35/******************************************************************************/
36/********************** Macros and Constants Definition ***********************/
37/******************************************************************************/
38
39#if defined (STM32F469xx)
40/* The below configurations are specific to STM32F469NIH6 MCU on SDP-K1 Board. */
41#define HW_CARRIER_NAME SDP_K1
42
43/**** SPI Parameters ****/
44/* Pin mapping for AD4080 DCS w.r.t. Arduino Headers */
45#define SPI_DEVICE_ID 1 // SPI1
46#define SPI_CS_PORT 6 // GPIO Port G
47#define SPI_CSB 11 // PG11 (ARDUINO_UNO_D8)
48#define SPI_DCS_CSB_PORT 0 // GPIO Port A
49#define SPI_DCS_CSB 15 // PA15 (ARDUINO_UNO_D10)
50#define SPI_CFG_SPEED 11250000
51#define SPI_DATA_SPEED 11250000
52/**** End SPI Parameters ****/
53
54/**** I2C Parameters ****/
55#define I2C_DEVICE_ID 1 // I2C1
56#define I2C_TIMING 0 // (Unused)
57/**** End I2C Parameters ****/
58
59/**** UART Parameters ****/
60#define UART_DEVICE_ID 5
61#define APP_UART_HANDLE huart5
62#define UART_IRQ_ID UART5_IRQn
63#define APP_UART_USB_HANDLE hUsbDeviceHS
64/**** End UART Parameters ****/
65
66/**** GPIO Parameters ****/
67/* Pins used for monitoring ADC status information */
68/* AFE CTRL GPIO (ARDUINO UNO D9) */
69#define GPIO_AFE_CTRL_PORT 1
70#define GPIO_AFE_CTRL 15 // PB_15
71
72/* AD4080 GP1 GPIO (ARDUINO UNO D7) (input to ADC) */
73#define GPIO_GP1_PORT 6
74#define GPIO_GP1 10 // PG10
75
76/* AD4080 GP2 GPIO (ARDUINO UNO D5) (output from ADC) */
77#define GPIO_GP2_PORT 0
78#define GPIO_GP2 11 // PA11
79
80/* Pin used to trigger external conversion clock (ARDUINO UNO D4) */
81#define GPIO_XTAL_OSC_EN_PORT 6
82#define GPIO_XTAL_OSC_EN 9 // PG9
83
84/* AD4080 GP3 GPIO (ARDUINO UNO D3) (output from ADC) */
85#define GPIO_GP3_PORT 3
86#define GPIO_GP3 12 // PD12
87
88/* Oscillator enable GPIO (40M - D2, 20M - D1, 10M - D0) */
89#define GPIO_OSC_EN_40M_PORT 6
90#define GPIO_OSC_EN_40M 7 // PG7
91#define GPIO_OSC_EN_20M_PORT 0
92#define GPIO_OSC_EN_20M 0 // PA0
93#define GPIO_OSC_EN_10M_PORT 0
94#define GPIO_OSC_EN_10M 1 // PA1
95/**** End GPIO Parameters ****/
96#else
97/* The below configurations are specific to STM32H563ZIT6 MCU on NUCLEO-H563ZI Board. */
98#define HW_CARRIER_NAME NUCLEO_H563ZI
99
100/**** SPI Parameters ****/
101/* Pin mapping for AD4080 DCS w.r.t. Arduino Headers */
102#define SPI_DEVICE_ID 1 // SPI1
103#define SPI_CS_PORT 5 // GPIO Port F
104#define SPI_CSB 3 // PF3 (ARDUINO UNO D8)
105#define SPI_DCS_CSB_PORT 3 // GPIO Port D
106#define SPI_DCS_CSB 14 // PD14 (ARDUINO UNO D10)
107#define SPI_CFG_SPEED 15625000
108#define SPI_DATA_SPEED 15625000
109/**** End SPI Parameters ****/
110
111/**** QSPI Parameters ****/
112#define QSPI_DEVICE_ID 1
113#define QSPI_SPEED 15625000
114#define QSPI_DMA_HANDLE handle_GPDMA1_Channel0
115#define QSPI_DMA_CH GPDMA1_Channel0
116#define QSPI_DMA_IRQ GPDMA1_Channel0_IRQn
117#define QSPI_DMA_NUM_CH 1
118/**** End OCTOSPI Parameters ****/
119
120/**** I2C Parameters ****/
121#define I2C_DEVICE_ID 1 // I2C1
122
123/* I2C timing register value for standard mode of operation
124 * Check here for more understanding on I2C timing register
125 * configuration: https://wiki.analog.com/resources/no-os/drivers/i2c */
126#define I2C_TIMING 0x00000E14
127/**** End I2C Parameters ****/
128
129/**** UART Parameters ****/
130#define UART_DEVICE_ID 3
131#define APP_UART_HANDLE huart3
132#define UART_IRQ_ID USART3_IRQn
133#define APP_UART_USB_HANDLE hpcd_USB_DRD_FS
134/**** End UART Parameters ****/
135
136/**** GPIO Parameters ****/
137/* Pins used for monitoring ADC status information */
138
139/* AFE CTRL GPIO (ARDUINO UNO D9) */
140#define GPIO_AFE_CTRL_PORT 3
141#define GPIO_AFE_CTRL 15 // PD_15
142
143/* AD4080 GP1 GPIO (ARDUINO UNO D7) (input to ADC) */
144#define GPIO_GP1_PORT 6
145#define GPIO_GP1 12 // PG12
146
147/* AD4080 GP2 GPIO (ARDUINO UNO D5) (output from ADC) */
148#define GPIO_GP2_PORT 6
149#define GPIO_GP2 11 // PE11
150
151/* Pin used to trigger external conversion clock (ARDUINO UNO D4) */
152#define GPIO_XTAL_OSC_EN_PORT 4
153#define GPIO_XTAL_OSC_EN 14 // PE14
154
155/* AD4080 GP3 GPIO (ARDUINO UNO D3) (output from ADC) */
156#define GPIO_GP3_PORT 4
157#define GPIO_GP3 13 // PE13
158
159/* Oscillator enable GPIO (40M - D2, 20M - D1, 10M - D0) */
160#define GPIO_OSC_EN_40M_PORT 6
161#define GPIO_OSC_EN_40M 14 // PG14
162#define GPIO_OSC_EN_20M_PORT 1
163#define GPIO_OSC_EN_20M 6 // PB6
164#define GPIO_OSC_EN_10M_PORT 1
165#define GPIO_OSC_EN_10M 7 // PB7
166/**** End GPIO Parameters ****/
167#endif
168
169/******************************************************************************/
170/********************** Variables and User Defined Data Types *****************/
171/******************************************************************************/
172extern UART_HandleTypeDef APP_UART_HANDLE;
173extern DMA_HandleTypeDef QSPI_DMA_HANDLE;
174#if defined (STM32F469xx)
175extern USBD_HandleTypeDef APP_UART_USB_HANDLE;
176#endif
177#ifdef STM32H563xx
178extern PCD_HandleTypeDef APP_UART_USB_HANDLE;
179#endif
180
181/* STM32 Extra Init Parameters */
182extern struct stm32_spi_init_param stm32_config_spi_extra_init_params;
183extern struct stm32_spi_init_param stm32_data_spi_extra_init_params;
184extern struct stm32_xspi_init_param stm32_data_qspi_extra_init_params;
185extern struct stm32_uart_init_param stm32_uart_extra_init_params;
186#if defined (STM32F469xx) || defined (STM32H563xx)
188#endif
189extern struct stm32_gpio_init_param stm32_gpio_xtal_osc_en_init_params;
190extern struct stm32_gpio_init_param stm32_gpio_gp1_init_params;
191extern struct stm32_gpio_init_param stm32_gpio_gp2_init_params;
192extern struct stm32_gpio_init_param stm32_gpio_gp3_init_params;
193extern struct stm32_gpio_init_param stm32_gpio_40m_osc_init_params;
194extern struct stm32_gpio_init_param stm32_gpio_20m_osc_init_params;
195extern struct stm32_gpio_init_param stm32_gpio_10m_osc_init_params;
196extern struct stm32_gpio_init_param stm32_gpio_afe_ctrl_init_params;
197extern struct stm32_i2c_init_param stm32_i2c_extra_init_params;
198
199/******************************************************************************/
200/************************ Public Declarations *********************************/
201/******************************************************************************/
202void stm32_system_init(void);
203
204#if defined (STM32F469xx)
205void MX_USB_DEVICE_Init(void);
206#endif
207
208#endif // APP_CONFIG_STM32_H_
void stm32_system_init(void)
Initialize the STM32 system peripherals.
Definition app_config_stm32.c:178
struct stm32_usb_uart_init_param stm32_vcom_extra_init_params
Definition app_config_stm32.c:39
struct stm32_i2c_init_param stm32_i2c_extra_init_params
Definition app_config_stm32.c:166
struct stm32_uart_init_param stm32_uart_extra_init_params
Definition app_config_stm32.c:102
struct stm32_gpio_init_param stm32_gpio_10m_osc_init_params
Definition app_config_stm32.c:154
#define APP_UART_HANDLE
Definition app_config_stm32.h:131
#define QSPI_DMA_HANDLE
Definition app_config_stm32.h:114
struct stm32_gpio_init_param stm32_gpio_20m_osc_init_params
Definition app_config_stm32.c:148
struct stm32_spi_init_param stm32_config_spi_extra_init_params
Definition app_config_stm32.c:40
struct stm32_gpio_init_param stm32_gpio_gp2_init_params
Definition app_config_stm32.c:130
struct stm32_spi_init_param stm32_data_spi_extra_init_params
Definition app_config_stm32.c:46
struct stm32_gpio_init_param stm32_gpio_xtal_osc_en_init_params
Definition app_config_stm32.c:118
struct stm32_gpio_init_param stm32_gpio_gp3_init_params
Definition app_config_stm32.c:136
struct stm32_xspi_init_param stm32_data_qspi_extra_init_params
struct stm32_gpio_init_param stm32_gpio_afe_ctrl_init_params
Definition app_config_stm32.c:160
struct stm32_gpio_init_param stm32_gpio_40m_osc_init_params
Definition app_config_stm32.c:142
struct stm32_gpio_init_param stm32_gpio_gp1_init_params
Definition app_config_stm32.c:124
#define APP_UART_USB_HANDLE
Definition app_config_stm32.h:133
void MX_USB_DEVICE_Init(void)
VCOM driver for stm32 as a no_os_uart implementation.
Specific initialization parameters for stm32 UART over USB.
Definition stm32_usb_uart.h:27