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#include <stdint.h>
20
21#include "stm32_i2c.h"
22#include "stm32_irq.h"
23#include "stm32_gpio_irq.h"
24#include "stm32_spi.h"
25#include "stm32_gpio.h"
26#include "stm32_uart.h"
27#include "stm32_pwm.h"
28#include "stm32_usb_uart.h"
29#include "stm32_uart_stdio.h"
30
31/******************************************************************************/
32/********************** Macros and Constants Definition ***********************/
33/******************************************************************************/
34/* Note: The SDP-K1 board with the STM32F469NI MCU has been used
35* for developing the firmware. The below parameters will change depending
36* on the controller used. */
37#define TARGET_NAME SDP_K1
38
39/* STM32 UART specific parameters */
40#define APP_UART_USB_HANDLE hUsbDeviceHS
41#define APP_UART_HANDLE &huart5
42#define UART_IRQ_ID UART5_IRQn
43#define UART_ID 5
44#define I2C_DEV_ID 1 // I2C1
45
46/* STM32 SPI Specific parameters */
47#define SPI_DEVICE_ID 1 // SPI1
48#define SPI_CSB 15 // PA_15
49#define SPI_CS_PORT 0 // SPI Port A
50
51/* GPIO Pins associated with DAC */
52#define LDAC_GPIO_PORT 0 // PORT A
53#define LDAC_GPIO 10 // PA_10
54#define CLEAR_GPIO_PORT 6 // PORT G
55#define CLEAR_GPIO 9 // PG_9
56
57#define TRIGGER_INT_ID LDAC_GPIO
58#define IRQ_CTRL_ID 10
59
60/* STM32 LDAC PWM Specific parameters */
61#define LDAC_PWM_ID 1 // Timer1
62#define LDAC_PWM_CHANNEL 3 // Channel3
63#define LDAC_PWM_CLK_DIVIDER 2 // multiplier to get timer clock from PLCK1
64#define LDAC_PWM_PRESCALER 3
65#define LDAC_PWM_HANDLE htim1
66
67/* Priority of the LDAC Interrupt */
68#define LDAC_GPIO_PRIORITY 1
69
70/* Max spi clk speed */
71#define MAX_SPI_CLK 11250000
72
73/* platform ops */
74#define gpio_ops stm32_gpio_ops
75#define spi_ops stm32_spi_ops
76#define i2c_ops stm32_i2c_ops
77#define uart_ops stm32_uart_ops
78#define pwm_ops stm32_pwm_ops
79#define trigger_gpio_irq_ops stm32_gpio_irq_ops
80#define vcom_ops stm32_usb_uart_ops
81
82/* Define the max possible sampling (or update) rate for a given platform.
83 * Note: Max possible update rate is 45.82 KSPS per channel on IIO client.
84 * This is derived by testing the firmware on SDP-K1 controller board with STM32F469NI MCU
85 * using GCC and ARM compilers. The max possible update rate can vary from board to board and
86 * data continuity is not guaranteed above this update rate */
87#define MAX_SAMPLING_RATE (uint32_t)(45823)
88
89/******************************************************************************/
90/********************** Public/Extern Declarations ****************************/
91/******************************************************************************/
92
93extern I2C_HandleTypeDef hi2c1;
94extern SPI_HandleTypeDef hspi1;
95extern UART_HandleTypeDef huart5;
96extern TIM_HandleTypeDef htim1;
97extern USBD_HandleTypeDef APP_UART_USB_HANDLE;
98
100extern struct stm32_uart_init_param stm32_uart_extra_init_params;
101extern struct stm32_spi_init_param stm32_spi_extra_init_params;
102extern struct stm32_gpio_init_param stm32_ldac_gpio_init_params;
103extern struct stm32_gpio_init_param stm32_clear_gpio_init_params;
104extern struct stm32_gpio_irq_init_param stm32_trigger_gpio_irq_init_params;
105extern struct stm32_pwm_init_param stm32_pwm_extra_init_params;
106extern struct stm32_gpio_init_param stm32_pwm_gpio_init_params;
107
108void stm32_system_init(void);
109#endif /* APP_CONFIG_STM32_H_ */
UART_HandleTypeDef huart5
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_gpio_irq_init_param stm32_trigger_gpio_irq_init_params
Definition app_config_stm32.c:43
SPI_HandleTypeDef hspi1
struct stm32_uart_init_param stm32_uart_extra_init_params
Definition app_config_stm32.c:102
I2C_HandleTypeDef hi2c1
struct stm32_spi_init_param stm32_spi_extra_init_params
Definition app_config_stm32.c:46
TIM_HandleTypeDef htim1
struct stm32_gpio_init_param stm32_clear_gpio_init_params
Definition app_config_stm32.c:58
struct stm32_gpio_init_param stm32_pwm_gpio_init_params
Definition app_config_stm32.c:69
struct stm32_pwm_init_param stm32_pwm_extra_init_params
Definition app_config_stm32.c:76
struct stm32_gpio_init_param stm32_ldac_gpio_init_params
Definition app_config_stm32.c:52
VCOM driver for stm32 as a no_os_uart implementation.
Specific initialization parameters for stm32 UART over USB.
Definition stm32_usb_uart.h:27