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 <stdint.h>
21#include "stm32_uart.h"
22#include "stm32_i2c.h"
23#include "stm32_spi.h"
24#include "stm32_gpio.h"
25#include "stm32_irq.h"
26#include "stm32_pwm.h"
27#include "stm32_gpio_irq.h"
28#include "app_config.h"
29#include "stm32_usb_uart.h"
30
31/******************************************************************************/
32/********************** Macros and Constants Definition ***********************/
33/******************************************************************************/
34
35/* Note: The SDP-K1 board with the STM32F469NI MCU has been used
36* for developing the firmware. The below parameters will change depending
37* on the controller used. */
38#define HW_CARRIER_NAME SDP_K1
39
40/* STM32 UART specific parameters */
41#define APP_UART_HANDLE &huart5
42#define UART_IRQ_ID UART5_IRQn
43#define UART_ID 5
44#define APP_UART_USB_HANDLE hUsbDeviceHS
45
46/* STM32 I2C Specific parameters */
47#define I2C_DEVICE_ID 1
48#define I2C_TIMING 0 // (Unused)
49
50/* GPIO Pins associated with DAC */
51#define RESET_PIN 10 // PG10
52#define RESET_PORT 6 // PORTG
53#define LDAC_PIN 12 // PD12
54#define LDAC_PORT 3 // PORTD
55#define CLR_PIN 7 // PG7
56#define CLR_PORT 6 // PORTG
57
58#define GPIO_TRIGGER_INT_PORT 3 //PORTD
59
60/* STM32 SPI Specific parameters */
61#define SPI_DEVICE_ID 1 // SPI1
62#define SPI_CSB 15 //PA15
63#define STM32_SPI_CS_PORT 0 //PORTA
64
65/* Interrupt Callback parameters */
66#define TRIGGER_GPIO_IRQ_CTRL_ID 12 // PD12
67#define TRIGGER_INT_ID 12 // PD12
68#define trigger_gpio_handle 0
69#define LDAC_GPIO_PRIORITY 1
70
71/* Define the max possible sampling (or update) rate for a given platform.
72 * Note: Max possible update rate is 71.428 KSPS per channel on IIO client.
73 * This is derived by testing the firmware on SDP-K1 controller board with STM32F469NI MCU
74 * using GCC and ARM compilers. The max possible update rate can vary from board to board and
75 * data continuity is not guaranteed above this update rate */
76#define MAX_SAMPLING_RATE (71428)
77
78/* STM32 LDAC PWM Specific parameters */
79#define LDAC_PWM_ID 4 //Timer12
80#define LDAC_PWM_CHANNEL 1 // Channel 2
81#define LDAC_PWM_CLK_DIVIDER 2 // multiplier to get timer clock from PLCK1
82#define LDAC_PWM_PRESCALER 3
83
84/******************************************************************************/
85/********************** Variables and User Defined Data Types *****************/
86/******************************************************************************/
87
88extern struct stm32_uart_init_param stm32_uart_extra_init_params;
89extern struct stm32_i2c_init_param stm32_i2c_extra_init_params;
90extern struct stm32_gpio_init_param stm32_gpio_ldac_init_params;
91extern struct stm32_gpio_init_param stm32_pwm_ldac_gpio_init_params;
92extern struct stm32_usb_uart_init_param stm32_vcom_extra_init_params;
93extern struct stm32_gpio_irq_init_param stm32_trigger_gpio_irq_init_params;
94extern struct stm32_spi_init_param stm32_spi_extra_init_params;
95extern struct stm32_pwm_init_param stm32_pwm_extra_init_params;
96extern struct stm32_gpio_init_param stm32_gpio_reset_init_params;
97extern struct stm32_gpio_init_param stm32_clear_gpio_init_params;
98
99extern UART_HandleTypeDef huart5;
100extern USBD_HandleTypeDef APP_UART_USB_HANDLE;
101
102extern void stm32_system_init(void);
103
104#endif
105
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_usb_uart_init_param stm32_vcom_extra_init_params
Definition app_config_stm32.c:38
struct stm32_gpio_init_param stm32_pwm_ldac_gpio_init_params
Definition app_config_stm32.c:65
struct stm32_gpio_irq_init_param stm32_trigger_gpio_irq_init_params
Definition app_config_stm32.c:43
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 stm32_gpio_init_param stm32_clear_gpio_init_params
Definition app_config_stm32.c:51
struct stm32_pwm_init_param stm32_pwm_extra_init_params
Definition app_config_stm32.c:80
#define APP_UART_USB_HANDLE
Definition app_config_stm32.h:44
Configuration file of nanodac firmware example program.