precision-converters-firmware
All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
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 "stm32_spi.h"
21#include "stm32_uart.h"
22#include "stm32_gpio.h"
23#include "stm32_i2c.h"
24#include "stm32_uart_stdio.h"
25#include "main.h"
26
27/******************************************************************************/
28/********************** Macros and Constants Definition ***********************/
29/******************************************************************************/
30
31/* Note: The SDP-K1 board with the STM32F469NI MCU has been used
32* for developing the firmware. The below parameters will change depending
33* on the controller used. */
34
35//#define ARDUINO
36
37/* SPI Pins on SDP-K1-Arduino Interface */
38#ifdef ARDUINO
39#define SPI_DEVICE_ID 1 // SPI1
40#define SPI_CS_PORT 0 // GPIO Port A
41#define SPI_CSB 15 // PA_15
42
43/* I2C Device ID */
44#define I2C_DEVICE_ID 1 // I2C1
45
46/* GAIN Specific Port G and Pin 11 */
47#define GAIN_PIN 11 // PG_11
48#define GAIN_PORT 6 // GPIO PORT G
49
50/* RESET Specific Port B and Pin 15 */
51#define RESET_PIN 15 // PB_15
52#define RESET_PORT 1 // GPIO Port B
53
54/* LDAC Specific Port G and Pin 10 */
55#define LDAC_PIN 10 // PG_10
56#define LDAC_PORT 6 // GPIO PORT G
57
58/* ADDR0 Specific Port A and Pin 10 */
59#define ADDR0_PIN 10 // PA_10
60#define ADDR0_PORT 0 // GPIO PORT A
61#else /* Default- SDP_120 Interface */
62/* SPI Pins on SDP-K1-SDP-120 Interface */
63#define SPI_DEVICE_ID 5 // SPI5
64#define SPI_CS_PORT 1 // GPIO Port B
65#define SPI_CSB 9 // PB_9
66#define I2C_DEVICE_ID 3 // I2C3
67#endif
68
69/* Define the other GPIO mapping based on the compatible EVAL board
70 *Note: The 7-bit I2C slave address mentioned below is the default address for the
71 device, set by combination of slave address bits (7:3) from the device
72 datasheet and default logic level of A1 and A0 pins (bits 2:1) on the
73 respective device EVAL board. For more information, refer the device
74 datasheet and EVAL board manual. */
75
76#if defined(DEV_AD5686R) || defined(DEV_AD5686) || \
77 defined(DEV_AD5684R) || defined(DEV_AD5684) || \
78 defined(DEV_AD5685R)
79/* These devices support EVAL-AD5686RSDZ board */
80#if !defined ARDUINO
81#define GAIN_PIN 0 // PJ_0
82#define GAIN_PORT 9 // PORTJ
83#define RESET_PIN 3 // PJ_3
84#define RESET_PORT 9 // PORTJ
85#define LDAC_PIN 4 // PJ_4
86#define LDAC_PORT 9 // PORTJ
87#endif
88#elif defined(DEV_AD5696R) || defined(DEV_AD5696) || \
89 defined(DEV_AD5694R) || defined(DEV_AD5694) || \
90 defined(DEV_AD5695R) || defined(DEV_AD5697R)
91/* These devices support EVAL-AD5696RSDZ board */
92#if !defined ARDUINO
93#define GAIN_PIN 0 // PJ_0
94#define GAIN_PORT 9 // PORTJ
95#define RESET_PIN 3 // PJ_3
96#define RESET_PORT 9 // PORTJ
97#define LDAC_PIN 4 // PJ_4
98#define LDAC_PORT 9 // PORTJ
99#endif
100#define I2C_SLAVE_ADDRESS 0x18
101#elif defined(DEV_AD5683) || defined(DEV_AD5683R) || defined(DEV_AD5682R) || \
102 defined(DEV_AD5681R)
103/* These devices uses EVAL-AD5683R board */
104#if !defined ARDUINO
105#define GAIN_PIN 3 // PJ_3
106#define GAIN_PORT 9 // PORTJ
107#define RESET_PIN 1 // PJ_1
108#define RESET_PORT 9 // PORTJ
109#define LDAC_PIN 0 // PJ_0
110#define LDAC_PORT 9 // PORTJ
111#endif
112#elif defined(DEV_AD5693) || defined(DEV_AD5693R) || defined(DEV_AD5692R) || \
113 defined(DEV_AD5691R)
114/* These devices uses EVAL-AD5693R board */
115#if !defined ARDUINO
116#define GAIN_PIN 3 // PJ_3
117#define GAIN_PORT 9 // PORTJ
118#define RESET_PIN 1 // PJ_1
119#define RESET_PORT 9 // PORTJ
120#define LDAC_PIN 0 // PJ_0
121#define LDAC_PORT 9 // PORTJ
122#endif
123#define I2C_SLAVE_ADDRESS 0x98
124#elif defined (DEV_AD5674R) || defined (DEV_AD5674) || \
125 defined (DEV_AD5679R) || defined (DEV_AD5679) || \
126 defined (DEV_AD5677R) || defined (DEV_AD5673R)
127/* These devices uses EVAL-AD5679RSDZ/EVAL-AD567xRSDZ board */
128#if !defined ARDUINO
129#define GAIN_PIN 0 // PJ_0
130#define GAIN_PORT 9 // PORTJ
131#define RESET_PIN 2 // PJ_2
132#define RESET_PORT 9 // PORTJ
133#define LDAC_PIN 1 // PJ_1
134#define LDAC_PORT 9 // PORTJ
135#endif
136#define I2C_SLAVE_ADDRESS 0x1E
137#elif defined (DEV_AD5676R) || defined (DEV_AD5676) || \
138 defined (DEV_AD5672R)
139/* These devices uses EVAL-AD5676RSDZ board */
140#if !defined ARDUINO
141#define GAIN_PIN 3 // PJ_3
142#define GAIN_PORT 9 // PORTJ
143#define RESET_PIN 1 // PJ_1
144#define RESET_PORT 9 // PORTJ
145#define LDAC_PIN 0 // PJ_0
146#define LDAC_PORT 9 // PORTJ
147#endif
148#elif defined (DEV_AD5671R) || defined (DEV_AD5675R)
149/* These devices uses EVAL-AD5675RSDZ board */
150#if !defined ARDUINO
151#define GAIN_PIN 3 // PJ_3
152#define GAIN_PORT 9 // PORTJ
153#define RESET_PIN 1 // PJ_1
154#define RESET_PORT 9 // PORTJ
155#define LDAC_PIN 0 // PJ_0
156#define LDAC_PORT 9 // PORTJ
157#endif
158#define I2C_SLAVE_ADDRESS 0x18
159#else
160#warning No/Unsupported EVAL board found. Using EVAL-AD5686R as default.
161#if !defined ARDUINO
162#define GAIN_PIN 0 //PJ_1
163#define GAIN_PORT 9 // PortJ
164#define RESET_PIN 3 // PJ_3
165#define RESET_PORT 9 // PortJ
166#define LDAC_PIN 4 // PJ_4
167#define LDAC_PORT 9 // PortJ
168#endif
169#endif
170
171/* Common pin mappings */
172#define LED_GREEN LED3 // PK_5
173#define LED_GREEN_PORT 10 // PortK
174
175#define I2C_TIMING 0 // (Unused)
176
177/* STM32 UART specific parameters */
178#define APP_UART_HANDLE &huart5
179#define UART_IRQ_ID UART5_IRQn
180
181/* platform ops */
182#define uart_ops stm32_uart_ops
183#define i2c_ops stm32_i2c_ops
184#define gpio_ops stm32_gpio_ops
185#define spi_ops stm32_spi_ops
186
187/******************************************************************************/
188/********************** Public/Extern Declarations ****************************/
189/******************************************************************************/
190
191extern struct no_os_uart_desc *uart_desc;
192extern UART_HandleTypeDef huart5;
193
194extern struct stm32_uart_init_param stm32_uart_extra_init_params;
195extern struct stm32_spi_init_param stm32_spi_extra_init_params;
196extern struct stm32_i2c_init_param stm32_i2c_extra_init_params;
197extern struct stm32_gpio_init_param stm32_gpio_reset_init_params;
198extern struct stm32_gpio_init_param stm32_gain_gpio_init_params;
199extern struct stm32_gpio_init_param stm32_gpio_ldac_init_params;
200
201extern void stm32_system_init(void);
202
203#endif // APP_CONFIG_STM32_H_
UART_HandleTypeDef huart5
struct stm32_gpio_init_param stm32_gpio_ldac_init_params
Definition app_config_stm32.c:59
void stm32_system_init(void)
Initialize the STM32 system peripherals.
Definition app_config_stm32.c:174
struct stm32_gpio_init_param stm32_gpio_reset_init_params
Definition app_config_stm32.c:72
struct stm32_uart_init_param stm32_uart_extra_init_params
Definition app_config_stm32.c:51
struct stm32_spi_init_param stm32_spi_extra_init_params
Definition app_config_stm32.c:61
struct stm32_i2c_init_param stm32_i2c_extra_init_params
Definition app_config_stm32.c:99
struct no_os_uart_desc * uart_desc
Definition app_config.c:97
struct stm32_gpio_init_param stm32_gain_gpio_init_params
Definition app_config_stm32.c:57