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 <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/* Pin mapping w.r.t. target */
51#define OSR0_PIN 0 // PA0
52#define OSR0_PORT 0 // PORTA
53#define OSR1_PIN 7// PORTG
54#define OSR1_PORT 6 // PG7
55#define OSR2_PIN 9 // PORTD
56#define OSR2_PORT 6 // PG7
57#define RESET_PIN 11// PA_11
58#define RESET_PORT 0 // PORTA
59#define CONVST_PIN 10 // PA_10
60#define CONVST_PORT 0 // PORTA
61#define BUSY_PIN 10 // PG_10
62#define BUSY_PORT 6 // PORTG
63#define RANGE_PIN 11 // PG_11
64#define RANGE_PORT 6 // PORTG
65#define STDBY_PIN 15 // PB_15
66#define STDBY_PORT 1 // PORTB
67#define LED_GPO 5 // PK_5
68#define LED_PORT 10 // PORTK
69
70#define TRIGGER_GPIO_PORT 3 //PORTD
71#define PWM_TRIGGER 12
72
73/* STM32 SPI Specific parameters */
74#define SPI_DEVICE_ID 1 // SPI1
75#define SPI_CSB 15 //PA15
76#define SPI_CS_PORT 0 //PORTA
77
78/* Interrupt Callback parameters */
79#define INT_EVENT 12 // PD12
80#define IRQ_INT_ID 12 // PD12
81#define trigger_gpio_handle 0
82
83/* Priority of the Interrupt */
84#define RDY_GPIO_PRIORITY 1
85
86/* Define the max possible sampling (or output data) rate for a given platform.
87 * This is also used to find the time period to trigger a periodic conversion event.
88 * Note: Max possible ODR is 16KSPS per channel for continuous data capture on
89 * IIO client. This is derived by testing the firmware on SDP-K1 controller board
90 * @22Mhz SPI clock. The max possible ODR can vary from board to board and
91 * data continuity is not guaranteed above this ODR on IIO oscilloscope */
92#define SAMPLING_RATE (20000)
93
94/* STM32 PWM Specific parameters */
95#define PWM_ID 4 //Timer4
96#define PWM_CHANNEL 1 // Channel 1
97#define PWM_CLK_DIVIDER 2 // multiplier to get timer clock from PLCK1
98#define PWM_PRESCALER 3
99#define PWM_HANDLE htim4
100
101/******************************************************************************/
102/********************** Variables and User Defined Data Types *****************/
103/******************************************************************************/
104
105extern UART_HandleTypeDef APP_UART_HANDLE;
106extern USBD_HandleTypeDef APP_UART_USB_HANDLE;
107extern TIM_HandleTypeDef PWM_HANDLE;
108
109extern struct stm32_gpio_irq_init_param stm32_trigger_gpio_irq_init_params;
110extern struct stm32_gpio_init_param stm32_trigger_gpio_extra_init_params;
111extern struct stm32_gpio_init_param stm32_reset_gpio_extra_init_params;
112extern struct stm32_gpio_init_param stm32_convst_gpio_extra_init_params;
113extern struct stm32_gpio_init_param stm32_busy_gpio_extra_init_params;
114extern struct stm32_gpio_init_param stm32_osr0_gpio_extra_init_params;
115extern struct stm32_gpio_init_param stm32_osr1_gpio_extra_init_params;
116extern struct stm32_gpio_init_param stm32_osr2_gpio_extra_init_params;
117extern struct stm32_gpio_init_param stm32_range_gpio_extra_init_params;
118extern struct stm32_gpio_init_param stm32_stdby_gpio_extra_init_params;
119extern struct stm32_gpio_init_param stm32_pwm_gpio_extra_init_params;
120extern struct stm32_pwm_init_param stm32_pwm_extra_init_params;
121extern struct stm32_uart_init_param stm32_uart_extra_init_params;
123extern struct stm32_spi_init_param stm32_spi_extra_init_params;
124extern struct stm32_i2c_init_param stm32_i2c_extra_init_params;
125
126extern void stm32_system_init(void);
127
128#endif
129
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
struct stm32_i2c_init_param stm32_i2c_extra_init_params
Definition app_config_stm32.c:152
struct stm32_gpio_init_param stm32_pwm_gpio_extra_init_params
Definition app_config_stm32.c:180
struct stm32_uart_init_param stm32_uart_extra_init_params
Definition app_config_stm32.c:102
#define APP_UART_HANDLE
Definition app_config_stm32.h:131
struct stm32_spi_init_param stm32_spi_extra_init_params
Definition app_config_stm32.c:46
struct stm32_gpio_init_param stm32_trigger_gpio_extra_init_params
Definition app_config_stm32.c:58
struct stm32_pwm_init_param stm32_pwm_extra_init_params
Definition app_config_stm32.c:76
struct stm32_gpio_init_param stm32_reset_gpio_extra_init_params
Definition app_config_stm32.c:112
struct stm32_gpio_init_param stm32_osr1_gpio_extra_init_params
Definition app_config_stm32.c:69
struct stm32_gpio_init_param stm32_busy_gpio_extra_init_params
Definition app_config_stm32.c:57
struct stm32_gpio_init_param stm32_stdby_gpio_extra_init_params
Definition app_config_stm32.c:81
struct stm32_gpio_init_param stm32_range_gpio_extra_init_params
Definition app_config_stm32.c:87
struct stm32_gpio_init_param stm32_osr2_gpio_extra_init_params
Definition app_config_stm32.c:75
struct stm32_gpio_init_param stm32_convst_gpio_extra_init_params
Definition app_config_stm32.c:93
#define PWM_HANDLE
Definition app_config_stm32.h:99
struct stm32_gpio_init_param stm32_osr0_gpio_extra_init_params
Definition app_config_stm32.c:63
Configuration file of nanodac firmware example program.
VCOM driver for stm32 as a no_os_uart implementation.
Specific initialization parameters for stm32 UART over USB.
Definition stm32_usb_uart.h:27