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_uart.h"
21#include "stm32_spi.h"
22#include "stm32_i2c.h"
23#include "stm32_gpio.h"
24#include "stm32_irq.h"
25#include "stm32_gpio_irq.h"
26#include "stm32_pwm.h"
27#include "main.h"
28#include "stm32_uart_stdio.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 SPI Specific parameters */
41#define SPI_DEVICE_ID 1 // SPI1
42#define SPI_CS_PORT 0 // GPIO Port A
43#define SPI_CSB 15 // PA_15
44
45/* STM32 UART specific parameters */
46#define APP_UART_HANDLE &huart5
47#define APP_UART_USB_HANDLE hUsbDeviceHS
48
49/* UART Device ID */
50#define UART_IRQ_ID UART5_IRQn
51
52/* LED Port K and Pin 10 */
53#define LED_GPO 5 // PK_5
54#define LED_PORT 10 // Port K
55
56/* I2C Device ID */
57#define I2C_DEVICE_ID 1 // I2C1
58#define I2C_TIMING 0 // (Unused)
59
60/* STM32 TRIGGER Specific parameters */
61#define TRIGGER_INT_ID 12
62#define TRIGGER_GPIO_PORT 3
63#define TRIGGER_GPIO_PIN 12
64
65/* STM32 PWM Specific parameters */
66#define PWM_ID 4 //Timer4
67#define PWM_CHANNEL 1 // Channel 1
68#define PWM_CLK_DIVIDER 2 // multiplier to get timer clock from PLCK1
69#define PWM_PRESCALER 3
70
71/* Priority of RDY Interrupt */
72#define RDY_GPIO_PRIORITY 1
73
74/* Define the max possible sampling (or output data) rate for a given platform.
75 * This is also used to find the time period to trigger a periodic conversion event.
76 * Note: Max possible ODR is 62.5KSPS per channel for continuous data capture on
77 * IIO client. This is derived by testing the firmware on SDP-K1 controller board
78 * @22Mhz SPI clock. The max possible ODR can vary from board to board and
79 * data continuity is not guaranteed above this ODR on IIO oscilloscope */
80#define SAMPLING_RATE (62000)
81#define CONV_TRIGGER_PERIOD_NSEC (((float)(1.0 / SAMPLING_RATE) * 1000000) * 1000)
82#define CONV_TRIGGER_DUTY_CYCLE_NSEC (CONV_TRIGGER_PERIOD_NSEC / 2)
83
84/******************************************************************************/
85/********************** Variables and User Defined Data Types *****************/
86/******************************************************************************/
87
88extern UART_HandleTypeDef huart5;
89extern USBD_HandleTypeDef APP_UART_USB_HANDLE;
90
91extern struct stm32_usb_uart_init_param stm32_vcom_extra_init_params;
92extern struct stm32_gpio_irq_init_param stm32_trigger_gpio_irq_init_params;
93extern struct stm32_gpio_init_param stm32_trigger_gpio_extra_init_params;
94extern struct stm32_pwm_init_param stm32_pwm_extra_init_params;
95extern struct stm32_uart_init_param stm32_uart_extra_init_params;
96extern struct stm32_spi_init_param stm32_spi_extra_init_params;
97extern struct stm32_i2c_init_param stm32_i2c_extra_init_params;
98extern struct stm32_gpio_init_param stm32_pwm_gpio_extra_init_params;
99
100extern void stm32_system_init(void);
101
102#endif // APP_CONFIG_STM32_H_
UART_HandleTypeDef huart5
void stm32_system_init(void)
Initialize the STM32 system peripherals.
Definition app_config_stm32.c:174
struct stm32_usb_uart_init_param stm32_vcom_extra_init_params
Definition app_config_stm32.c:38
struct stm32_gpio_irq_init_param stm32_trigger_gpio_irq_init_params
Definition app_config_stm32.c:43
struct stm32_gpio_init_param stm32_pwm_gpio_extra_init_params
Definition app_config_stm32.c:110
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_trigger_gpio_extra_init_params
Definition app_config_stm32.c:55
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