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 (TARGET_SDP_K1)
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 (TARGET_SDP_K1)
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/**** End UART Parameters ****/
134
135/**** GPIO Parameters ****/
136/* Pins used for monitoring ADC status information */
137
138/* AFE CTRL GPIO (ARDUINO UNO D9) */
139#define GPIO_AFE_CTRL_PORT 3
140#define GPIO_AFE_CTRL 15 // PD_15
141
142/* AD4080 GP1 GPIO (ARDUINO UNO D7) (input to ADC) */
143#define GPIO_GP1_PORT 6
144#define GPIO_GP1 12 // PG12
145
146/* AD4080 GP2 GPIO (ARDUINO UNO D5) (output from ADC) */
147#define GPIO_GP2_PORT 6
148#define GPIO_GP2 11 // PE11
149
150/* Pin used to trigger external conversion clock (ARDUINO UNO D4) */
151#define GPIO_XTAL_OSC_EN_PORT 4
152#define GPIO_XTAL_OSC_EN 14 // PE14
153
154/* AD4080 GP3 GPIO (ARDUINO UNO D3) (output from ADC) */
155#define GPIO_GP3_PORT 4
156#define GPIO_GP3 13 // PE13
157
158/* Oscillator enable GPIO (40M - D2, 20M - D1, 10M - D0) */
159#define GPIO_OSC_EN_40M_PORT 6
160#define GPIO_OSC_EN_40M 14 // PG14
161#define GPIO_OSC_EN_20M_PORT 1
162#define GPIO_OSC_EN_20M 6 // PB6
163#define GPIO_OSC_EN_10M_PORT 1
164#define GPIO_OSC_EN_10M 7 // PB7
165/**** End GPIO Parameters ****/
166#endif
167
168/******************************************************************************/
169/********************** Variables and User Defined Data Types *****************/
170/******************************************************************************/
171extern UART_HandleTypeDef APP_UART_HANDLE;
172extern DMA_HandleTypeDef QSPI_DMA_HANDLE;
173#if defined (TARGET_SDP_K1)
174extern USBD_HandleTypeDef APP_UART_USB_HANDLE;
175#endif
176
177/* STM32 Extra Init Parameters */
178extern struct stm32_spi_init_param stm32_config_spi_extra_init_params;
179extern struct stm32_spi_init_param stm32_data_spi_extra_init_params;
180extern struct stm32_xspi_init_param stm32_data_qspi_extra_init_params;
181extern struct stm32_uart_init_param stm32_uart_extra_init_params;
182#if defined (TARGET_SDP_K1)
184#endif
185extern struct stm32_gpio_init_param stm32_gpio_xtal_osc_en_init_params;
186extern struct stm32_gpio_init_param stm32_gpio_gp1_init_params;
187extern struct stm32_gpio_init_param stm32_gpio_gp2_init_params;
188extern struct stm32_gpio_init_param stm32_gpio_gp3_init_params;
189extern struct stm32_gpio_init_param stm32_gpio_40m_osc_init_params;
190extern struct stm32_gpio_init_param stm32_gpio_20m_osc_init_params;
191extern struct stm32_gpio_init_param stm32_gpio_10m_osc_init_params;
192extern struct stm32_gpio_init_param stm32_gpio_afe_ctrl_init_params;
193extern struct stm32_i2c_init_param stm32_i2c_extra_init_params;
194
195/******************************************************************************/
196/************************ Public Declarations *********************************/
197/******************************************************************************/
198void stm32_system_init(void);
199
200#if defined (TARGET_SDP_K1)
201void MX_USB_DEVICE_Init(void);
202#endif
203
204#endif // APP_CONFIG_STM32_H_
void stm32_system_init(void)
Initialize the STM32 system peripherals.
Definition app_config_stm32.c:176
struct stm32_usb_uart_init_param stm32_vcom_extra_init_params
Definition app_config_stm32.c:38
#define APP_UART_USB_HANDLE
Definition app_config_stm32.h:44
struct stm32_i2c_init_param stm32_i2c_extra_init_params
Definition app_config_stm32.c:152
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:140
#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:134
struct stm32_spi_init_param stm32_config_spi_extra_init_params
Definition app_config_stm32.c:33
struct stm32_gpio_init_param stm32_gpio_gp2_init_params
Definition app_config_stm32.c:116
struct stm32_spi_init_param stm32_data_spi_extra_init_params
Definition app_config_stm32.c:39
struct stm32_gpio_init_param stm32_gpio_xtal_osc_en_init_params
Definition app_config_stm32.c:104
struct stm32_gpio_init_param stm32_gpio_gp3_init_params
Definition app_config_stm32.c:122
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:146
struct stm32_gpio_init_param stm32_gpio_40m_osc_init_params
Definition app_config_stm32.c:128
struct stm32_gpio_init_param stm32_gpio_gp1_init_params
Definition app_config_stm32.c:110
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