precision-converters-firmware
All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Macros | Functions | Variables
app_config_stm32.c File Reference

Application configurations module for STM32 platform. More...

#include "app_config_stm32.h"
#include "no_os_error.h"
#include "no_os_util.h"
#include "no_os_pwm.h"
#include "ad3530r.h"
#include "ad3530r_iio.h"
Include dependency graph for app_config_stm32.c:

Macros

#define TRANSFER_COMPLETE_TIMEOUT   0xffffff
 

Functions

void stm32_system_init (void)
 Initialize the STM32 system peripherals.
 
void EXTI15_10_IRQHandler (void)
 This function handles the LDAC GPIO interrupt event, to which EXTI line 10 interrupt is dedicated.
 
int reconfig_stm32_params (void)
 Reconfigure the STM32 specific system parameters with change in data streaming mode.
 
void tim8_config (void)
 Configure Tx Trigger timer for slave mode operation, one-pulse mode and to generate DMA requests.
 
int stm32_timer_enable (void)
 Starts the timer signal generation for PWM.
 
int stm32_timer_stop (void)
 Stop generating timer signals.
 
int stm32_abort_dma_transfer (void)
 Abort DMA Transfers.
 
void receivecomplete_callback (DMA_HandleTypeDef *hdma)
 Callback function to flag the transfer of number of requested samples.
 

Variables

struct stm32_uart_init_param stm32_uart_init_params
 
struct stm32_usb_uart_init_param stm32_vcom_extra_init_params
 
struct stm32_gpio_irq_init_param stm32_trigger_gpio_irq_init_params
 
struct stm32_spi_init_param stm32_spi_init_params
 
struct stm32_i2c_init_param stm32_i2c_init_params
 
struct stm32_gpio_init_param stm32_gpio_ldac_init_params
 
struct stm32_gpio_init_param stm32_pwm_ldac_gpio_init_params
 
struct stm32_gpio_init_param stm32_gpio_reset_init_params
 
struct stm32_pwm_init_param stm32_ldac_pwm_init_params
 
DMA_HandleTypeDef hdma_spi1_tx
 
struct stm32_gpio_init_param stm32_csb_gpio_init_params
 
struct stm32_pwm_init_param stm32_tx_trigger_extra_init_params
 
struct stm32_dma_channel txdma_channel_single_instr_mode
 
struct stm32_dma_channel txdma_channel_stream_mode
 
struct stm32_dma_channel rxdma_channel
 
volatile struct stm32_spi_desc * sdesc
 

Detailed Description

Application configurations module for STM32 platform.

Copyright (c) 2024-25 Analog Devices, Inc. All rights reserved.

This software is proprietary to Analog Devices, Inc. and its licensors. By using this software you agree to the terms of the associated Analog Devices Software License Agreement.

Macro Definition Documentation

◆ TRANSFER_COMPLETE_TIMEOUT

#define TRANSFER_COMPLETE_TIMEOUT   0xffffff

Function Documentation

◆ EXTI15_10_IRQHandler()

void EXTI15_10_IRQHandler ( void  )

This function handles the LDAC GPIO interrupt event, to which EXTI line 10 interrupt is dedicated.

Returns
None

◆ receivecomplete_callback()

void receivecomplete_callback ( DMA_HandleTypeDef *  hdma)

Callback function to flag the transfer of number of requested samples.

Callback function to flag the capture of number of requested samples.

Parameters
hdma[in]- DMA Handler (Unused)
Returns
None
Parameters
hdma- DMA handler (Unused)
Returns
None
Here is the caller graph for this function:

◆ reconfig_stm32_params()

int reconfig_stm32_params ( void  )

Reconfigure the STM32 specific system parameters with change in data streaming mode.

Returns
0 in case of success, negative error code otherwise

◆ stm32_abort_dma_transfer()

int stm32_abort_dma_transfer ( void  )

Abort DMA Transfers.

Returns
None
Here is the caller graph for this function:

◆ stm32_system_init()

void stm32_system_init ( void  )

Initialize the STM32 system peripherals.

Returns
None
Here is the caller graph for this function:

◆ stm32_timer_enable()

int stm32_timer_enable ( void  )

Starts the timer signal generation for PWM.

Returns
0 in case of success, negative error code otherwise

◆ stm32_timer_stop()

int stm32_timer_stop ( void  )

Stop generating timer signals.

Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function:

◆ tim8_config()

void tim8_config ( void  )

Configure Tx Trigger timer for slave mode operation, one-pulse mode and to generate DMA requests.

Returns
None

Variable Documentation

◆ hdma_spi1_tx

DMA_HandleTypeDef hdma_spi1_tx

◆ rxdma_channel

struct stm32_dma_channel rxdma_channel
Initial value:
= {
.hdma = &hdma_spi1_rx,
.ch_num = RxDMA_CHANNEL_NUM,
.mem_increment = false,
.mem_data_alignment = DATA_ALIGN_BYTE,
.per_data_alignment = DATA_ALIGN_BYTE,
.dma_mode = DMA_CIRCULAR_MODE,
}
#define RxDMA_CHANNEL_NUM
Definition app_config_stm32.h:86
DMA_HandleTypeDef hdma_spi1_rx

◆ sdesc

volatile struct stm32_spi_desc* sdesc

◆ stm32_csb_gpio_init_params

struct stm32_gpio_init_param stm32_csb_gpio_init_params
Initial value:
= {
.mode = GPIO_MODE_OUTPUT_PP,
.speed = GPIO_SPEED_FREQ_VERY_HIGH
}

◆ stm32_gpio_ldac_init_params

struct stm32_gpio_init_param stm32_gpio_ldac_init_params
Initial value:
= {
.mode = GPIO_MODE_OUTPUT_PP,
.speed = GPIO_SPEED_FREQ_VERY_HIGH
}

◆ stm32_gpio_reset_init_params

struct stm32_gpio_init_param stm32_gpio_reset_init_params
Initial value:
= {
.mode = GPIO_MODE_OUTPUT_PP
}

◆ stm32_i2c_init_params

struct stm32_i2c_init_param stm32_i2c_init_params
Initial value:
= {
.i2c_timing = I2C_TIMING
}
#define I2C_TIMING
Definition app_config_stm32.h:60

◆ stm32_ldac_pwm_init_params

struct stm32_pwm_init_param stm32_ldac_pwm_init_params
Initial value:
= {
.prescaler = LDAC_PWM_PRESCALER,
.timer_autoreload = true,
.mode = TIM_OC_PWM1,
.timer_chn = LDAC_PWM_CHANNEL,
.get_timer_clock = HAL_RCC_GetPCLK1Freq,
.clock_divider = LDAC_PWM_CLK_DIVIDER,
.trigger_enable = false,
.trigger_output = PWM_TRGO_UPDATE
}
#define LDAC_PWM_PRESCALER
Definition app_config_stm32.h:123
#define LDAC_PWM_CLK_DIVIDER
Definition app_config_stm32.h:71
#define LDAC_PWM_CHANNEL
Definition app_config_stm32.h:70

◆ stm32_pwm_ldac_gpio_init_params

struct stm32_gpio_init_param stm32_pwm_ldac_gpio_init_params
Initial value:
= {
.mode = GPIO_MODE_AF_PP,
.speed = GPIO_SPEED_FREQ_VERY_HIGH,
.alternate = GPIO_AF1_TIM1
}

◆ stm32_spi_init_params

struct stm32_spi_init_param stm32_spi_init_params
Initial value:
= {
.chip_select_port = STM32_SPI_CS_PORT,
.get_input_clock = HAL_RCC_GetPCLK2Freq
}
#define STM32_SPI_CS_PORT
Definition app_config_stm32.h:56

◆ stm32_trigger_gpio_irq_init_params

struct stm32_gpio_irq_init_param stm32_trigger_gpio_irq_init_params
Initial value:
= {
}
#define GPIO_TRIGGER_INT_PORT
Definition app_config_stm32.h:51

◆ stm32_tx_trigger_extra_init_params

struct stm32_pwm_init_param stm32_tx_trigger_extra_init_params
Initial value:
= {
.prescaler = TIMER_8_PRESCALER,
.timer_autoreload = true,
.mode = TIM_OC_TOGGLE,
.timer_chn = TIMER_CHANNEL_1,
.complementary_channel = false,
.get_timer_clock = HAL_RCC_GetPCLK1Freq,
.clock_divider = TIMER_8_CLK_DIVIDER,
.trigger_enable = true,
.trigger_source = PWM_TS_ITR0,
.dma_enable = true,
.repetitions = NUM_PULSE_REPETITIONS,
.onepulse_enable = true
}
#define NUM_PULSE_REPETITIONS
Definition app_config_stm32.h:138
#define TIMER_8_CLK_DIVIDER
Definition app_config_stm32.h:81
#define TIMER_CHANNEL_1
Definition app_config_stm32.h:82
#define TIMER_8_PRESCALER
Definition app_config_stm32.h:80

◆ stm32_uart_init_params

struct stm32_uart_init_param stm32_uart_init_params
Initial value:
= {
.huart = APP_UART_HANDLE
}
#define APP_UART_HANDLE
Definition app_config_stm32.h:42

◆ stm32_vcom_extra_init_params

struct stm32_usb_uart_init_param stm32_vcom_extra_init_params
Initial value:
= {
.husbdevice = APP_UART_USB_HANDLE
}
#define APP_UART_USB_HANDLE
Definition app_config_stm32.h:44

◆ txdma_channel_single_instr_mode

struct stm32_dma_channel txdma_channel_single_instr_mode
Initial value:
= {
.hdma = &hdma_tim8_ch1,
.ch_num = TxDMA_CHANNEL_NUM,
.mem_increment = true,
.mem_data_alignment = DATA_ALIGN_BYTE,
.per_data_alignment = DATA_ALIGN_BYTE,
.dma_mode = DMA_CIRCULAR_MODE
}
#define TxDMA_CHANNEL_NUM
Definition app_config_stm32.h:85
DMA_HandleTypeDef hdma_tim8_ch1

◆ txdma_channel_stream_mode

struct stm32_dma_channel txdma_channel_stream_mode
Initial value:
= {
.hdma = &hdma_spi1_tx,
.ch_num = DMA_CHANNEL_3,
.mem_increment = true,
.mem_data_alignment = DATA_ALIGN_BYTE,
.per_data_alignment = DATA_ALIGN_BYTE,
.dma_mode = DMA_NORMAL_MODE
}
DMA_HandleTypeDef hdma_spi1_tx
Definition app_config_stm32.c:89