b-g474e-dpow1: Added smps example.

This commit is contained in:
Daniel P. Carvalho 2024-06-26 16:18:07 -03:00 committed by Mateusz Szafoni
parent 9f69652835
commit 25886c7b47
7 changed files with 1440 additions and 1 deletions

View File

@ -0,0 +1,90 @@
#
# This file is autogenerated: PLEASE DO NOT EDIT IT.
#
# You can use "make menuconfig" to make any modifications to the installed .config file.
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
# modifications.
#
# CONFIG_ARCH_LEDS is not set
CONFIG_ADC=y
CONFIG_ANALOG=y
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="b-g474e-dpow1"
CONFIG_ARCH_BOARD_B_G474E_DPOW1=y
CONFIG_ARCH_BUTTONS=y
CONFIG_ARCH_CHIP="stm32"
CONFIG_ARCH_CHIP_STM32=y
CONFIG_ARCH_CHIP_STM32G474R=y
CONFIG_ARCH_HIPRI_INTERRUPT=y
CONFIG_ARCH_RAMVECTORS=y
CONFIG_ARCH_STACKDUMP=y
CONFIG_BOARD_LOOPSPERMSEC=16717
CONFIG_BUILTIN=y
CONFIG_DEBUG_FULLOPT=y
CONFIG_DEBUG_SYMBOLS=y
CONFIG_DISABLE_ENVIRON=y
CONFIG_DISABLE_MQUEUE=y
CONFIG_DISABLE_POSIX_TIMERS=y
CONFIG_DISABLE_PTHREAD=y
CONFIG_DRIVERS_SMPS=y
CONFIG_EXAMPLES_SMPS=y
CONFIG_EXAMPLES_SMPS_DEVPATH="/dev/smps0"
CONFIG_EXAMPLES_SMPS_IN_VOLTAGE_LIMIT=10000
CONFIG_EXAMPLES_SMPS_OUT_CURRENT_LIMIT=100
CONFIG_EXAMPLES_SMPS_OUT_POWER_LIMIT=100
CONFIG_EXAMPLES_SMPS_OUT_VOLTAGE_DEFAULT=5000
CONFIG_EXAMPLES_SMPS_OUT_VOLTAGE_LIMIT=10000
CONFIG_EXAMPLES_SMPS_TIME_DEFAULT=10
CONFIG_FDCLONE_STDIO=y
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INIT_STACKSIZE=1024
CONFIG_INTELHEX_BINARY=y
CONFIG_LIBDSP=y
CONFIG_LIBM=y
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_FILEIOSIZE=256
CONFIG_NSH_LINELEN=64
CONFIG_NSH_READLINE=y
CONFIG_POSIX_SPAWN_DEFAULT_STACKSIZE=512
CONFIG_PTHREAD_STACK_DEFAULT=1024
CONFIG_PTHREAD_STACK_MIN=1024
CONFIG_RAM_SIZE=98304
CONFIG_RAM_START=0x20000000
CONFIG_RAW_BINARY=y
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_WAITPID=y
CONFIG_SMPS_HAVE_INPUT_VOLTAGE=y
CONFIG_SMPS_HAVE_OUTPUT_VOLTAGE=y
CONFIG_START_DAY=6
CONFIG_START_MONTH=12
CONFIG_START_YEAR=2011
CONFIG_STDIO_BUFFER_SIZE=128
CONFIG_STM32_ADC1=y
CONFIG_STM32_ADC1_INJECTED_CHAN=2
CONFIG_STM32_ADC_CHANGE_SAMPLETIME=y
CONFIG_STM32_ADC_LL_OPS=y
CONFIG_STM32_ADC_NOIRQ=y
CONFIG_STM32_CCMEXCLUDE=y
CONFIG_STM32_HRTIM1=y
CONFIG_STM32_HRTIM_ADC1_TRG2=y
CONFIG_STM32_HRTIM_ADC=y
CONFIG_STM32_HRTIM_DEADTIME=y
CONFIG_STM32_HRTIM_DISABLE_CHARDRV=y
CONFIG_STM32_HRTIM_PWM=y
CONFIG_STM32_HRTIM_TIMC=y
CONFIG_STM32_HRTIM_TIMC_DT=y
CONFIG_STM32_HRTIM_TIMC_PWM=y
CONFIG_STM32_HRTIM_TIMC_PWM_CH1=y
CONFIG_STM32_HRTIM_TIMC_PWM_CH2=y
CONFIG_STM32_HRTIM_TIMD=y
CONFIG_STM32_HRTIM_TIMD_DT=y
CONFIG_STM32_HRTIM_TIMD_PWM=y
CONFIG_STM32_HRTIM_TIMD_PWM_CH1=y
CONFIG_STM32_HRTIM_TIMD_PWM_CH2=y
CONFIG_STM32_JTAG_SW_ENABLE=y
CONFIG_STM32_PWR=y
CONFIG_STM32_USART3=y
CONFIG_SYSTEM_NSH=y
CONFIG_TASK_NAME_SIZE=0
CONFIG_USART3_SERIAL_CONSOLE=y

View File

@ -185,6 +185,63 @@
#define GPIO_USART3_TX GPIO_USART3_TX_3 /* PC10 */
#define GPIO_USART3_RX GPIO_USART3_RX_3 /* PC11 */
/* Pin Multiplexing Disambiguation ******************************************/
/* Board configuration for SMPS example:
* PB12 - HRTIM1_CHC1
* PB13 - HRTIM1_CHC2
* PB14 - HRTIM1_CHD1
* PB15 - HRTIM1_CHD2
* VIN - ADC Channel 2 (PA1)
* VOUT - ADC Channel 4 (PA3)
*/
#if defined(CONFIG_EXAMPLES_SMPS)
/* HRTIM configuration ******************************************************/
/* Timer C configuration - Buck operations */
#define HRTIM_TIMC_PRESCALER HRTIM_PRESCALER_1
#define HRTIM_TIMC_MODE HRTIM_MODE_CONT
#define HRTIM_TIMC_UPDATE 0
#define HRTIM_TIMC_RESET 0
#define HRTIM_TIMC_CH1_SET HRTIM_OUT_SET_NONE
#define HRTIM_TIMC_CH1_RST HRTIM_OUT_RST_NONE
#define HRTIM_TIMC_CH2_SET HRTIM_OUT_SET_NONE
#define HRTIM_TIMC_CH2_RST HRTIM_OUT_RST_NONE
#define HRTIM_TIMC_DT_FSLOCK HRTIM_DT_LOCK
#define HRTIM_TIMC_DT_RSLOCK HRTIM_DT_LOCK
#define HRTIM_TIMC_DT_FVLOCK HRTIM_DT_RW
#define HRTIM_TIMC_DT_RVLOCK HRTIM_DT_RW
#define HRTIM_TIMC_DT_FSIGN HRTIM_DT_SIGN_POSITIVE
#define HRTIM_TIMC_DT_RSIGN HRTIM_DT_SIGN_POSITIVE
#define HRTIM_TIMC_DT_PRESCALER HRTIM_DEADTIME_PRESCALER_1
/* Timer D configuration - Boost operations */
#define HRTIM_TIMD_PRESCALER HRTIM_PRESCALER_1
#define HRTIM_TIMD_MODE HRTIM_MODE_CONT
#define HRTIM_TIMD_UPDATE 0
#define HRTIM_TIMD_RESET 0
#define HRTIM_TIMD_CH1_SET HRTIM_OUT_SET_NONE
#define HRTIM_TIMD_CH1_RST HRTIM_OUT_RST_NONE
#define HRTIM_TIMD_CH2_SET HRTIM_OUT_SET_NONE
#define HRTIM_TIMD_CH2_RST HRTIM_OUT_RST_NONE
#define HRTIM_TIMD_DT_FSLOCK HRTIM_DT_LOCK
#define HRTIM_TIMD_DT_RSLOCK HRTIM_DT_LOCK
#define HRTIM_TIMD_DT_FVLOCK HRTIM_DT_RW
#define HRTIM_TIMD_DT_RVLOCK HRTIM_DT_RW
#define HRTIM_TIMD_DT_FSIGN HRTIM_DT_SIGN_POSITIVE
#define HRTIM_TIMD_DT_RSIGN HRTIM_DT_SIGN_POSITIVE
#define HRTIM_TIMD_DT_PRESCALER HRTIM_DEADTIME_PRESCALER_1
#define HRTIM_ADC_TRG2 HRTIM_ADCTRG24_CC4
/* DMA channels *************************************************************/
#endif /* CONFIG_EXAMPLES_SMPS */
#endif /* __BOARDS_ARM_STM32_B_G474E_DPOW1_INCLUDE_BOARD_H */

View File

@ -30,6 +30,10 @@ if(CONFIG_BOARDCTL)
list(APPEND SRCS stm32_appinit.c)
endif()
if(CONFIG_DRIVERS_SMPS)
list(APPEND SRCS stm32_smps.c)
endif()
target_sources(board PRIVATE ${SRCS})
set_property(GLOBAL PROPERTY LD_SCRIPT "${NUTTX_BOARD_DIR}/scripts/ld.script")

View File

@ -33,6 +33,10 @@ ifeq ($(CONFIG_BOARDCTL),y)
CSRCS += stm32_appinit.c
endif
ifeq ($(CONFIG_DRIVERS_SMPS),y)
CSRCS += stm32_smps.c
endif
DEPPATH += --dep-path board
VPATH += :board
CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board

View File

@ -74,4 +74,16 @@
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
* Name: stm32_smps_setup
*
* Description:
* Initialize SMPS peripheral for the board.
*
****************************************************************************/
#ifdef CONFIG_DRIVERS_SMPS
int stm32_smps_setup(void);
#endif
#endif /* __BOARDS_ARM_STM32_B_G474E_DPOW1_SRC_B_G474E_DPOW1_H */

View File

@ -86,6 +86,16 @@ int board_app_initialize(uintptr_t arg)
}
#endif
#ifdef CONFIG_DRIVERS_SMPS
/* Initialize smps and register the smps driver */
ret = stm32_smps_setup();
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: stm32_smps_setup failed: %d\n", ret);
}
#endif
UNUSED(ret);
return OK;
}

File diff suppressed because it is too large Load Diff