boards/arm/stm32f0l0g0/nucleo-g070rb/include/board.h: Add TIMx clock frequencies

boards/arm/stm32f0l0g0/nucleo-g070rb: Enable basic timers
This commit is contained in:
Daniel Pereira Volpato 2019-10-07 22:10:32 -06:00 committed by Gregory Nutt
parent 0d1934a740
commit f800529f67
6 changed files with 69 additions and 6 deletions

View File

@ -9,4 +9,4 @@ STATUS
2019-09-04: Initial support for the STM32 Nucleo-G070RB board, based on STM32 Nucleo-G071RB. 2019-09-04: Initial support for the STM32 Nucleo-G070RB board, based on STM32 Nucleo-G071RB.
Basic NSH configuration is functional. Basic NSH configuration is functional.
2019-09-16: Enable PWR peripheral and increase sysclk to max. frequency. 2019-09-16: Enable PWR peripheral and increase sysclk to max. frequency.
2019-10-04: Enable basic timer TIM6. Timer example working.

View File

@ -11,18 +11,21 @@ CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="nucleo-g070rb" CONFIG_ARCH_BOARD="nucleo-g070rb"
CONFIG_ARCH_BOARD_NUCLEO_G070RB=y CONFIG_ARCH_BOARD_NUCLEO_G070RB=y
CONFIG_ARCH_CHIP="stm32f0l0g0" CONFIG_ARCH_CHIP="stm32f0l0g0"
CONFIG_ARCH_CHIP_STM32G0=y
CONFIG_ARCH_CHIP_STM32G070RB=y CONFIG_ARCH_CHIP_STM32G070RB=y
CONFIG_ARCH_CHIP_STM32G0=y
CONFIG_ARCH_STACKDUMP=y CONFIG_ARCH_STACKDUMP=y
CONFIG_BOARD_LATE_INITIALIZE=y
CONFIG_BOARD_LOOPSPERMSEC=2796 CONFIG_BOARD_LOOPSPERMSEC=2796
CONFIG_BUILTIN=y CONFIG_BUILTIN=y
CONFIG_DEBUG_FULLOPT=y
CONFIG_DEBUG_SYMBOLS=y
CONFIG_DISABLE_ENVIRON=y CONFIG_DISABLE_ENVIRON=y
CONFIG_DISABLE_MOUNTPOINT=y CONFIG_DISABLE_MOUNTPOINT=y
CONFIG_DISABLE_MQUEUE=y CONFIG_DISABLE_MQUEUE=y
CONFIG_DISABLE_POLL=y
CONFIG_DISABLE_POSIX_TIMERS=y CONFIG_DISABLE_POSIX_TIMERS=y
CONFIG_DISABLE_PSEUDOFS_OPERATIONS=y CONFIG_DISABLE_PSEUDOFS_OPERATIONS=y
CONFIG_EXAMPLES_HELLO=y CONFIG_EXAMPLES_HELLO=y
CONFIG_EXAMPLES_TIMER=y
CONFIG_INTELHEX_BINARY=y CONFIG_INTELHEX_BINARY=y
CONFIG_MAX_TASKS=8 CONFIG_MAX_TASKS=8
CONFIG_MAX_WDOGPARMS=2 CONFIG_MAX_WDOGPARMS=2
@ -49,11 +52,12 @@ CONFIG_START_MONTH=5
CONFIG_START_YEAR=2013 CONFIG_START_YEAR=2013
CONFIG_STDIO_DISABLE_BUFFERING=y CONFIG_STDIO_DISABLE_BUFFERING=y
CONFIG_STM32F0L0G0_PWR=y CONFIG_STM32F0L0G0_PWR=y
CONFIG_STM32F0L0G0_STM32G0=y CONFIG_STM32F0L0G0_TIM6=y
CONFIG_STM32F0L0G0_USART2=y CONFIG_STM32F0L0G0_USART2=y
CONFIG_SYSTEM_NSH=y CONFIG_SYSTEM_NSH=y
CONFIG_TASK_NAME_SIZE=0 CONFIG_TASK_NAME_SIZE=0
CONFIG_TASK_SPAWN_DEFAULT_STACKSIZE=1536 CONFIG_TASK_SPAWN_DEFAULT_STACKSIZE=1536
CONFIG_TIMER=y
CONFIG_USART2_SERIAL_CONSOLE=y CONFIG_USART2_SERIAL_CONSOLE=y
CONFIG_USERMAIN_STACKSIZE=1536 CONFIG_USERMAIN_STACKSIZE=1536
CONFIG_USER_ENTRYPOINT="nsh_main" CONFIG_USER_ENTRYPOINT="nsh_main"

View File

@ -129,7 +129,21 @@
#define STM32_RCC_CFGR_PPRE1 RCC_CFGR_PPRE1_HCLK #define STM32_RCC_CFGR_PPRE1 RCC_CFGR_PPRE1_HCLK
#define STM32_PCLK1_FREQUENCY STM32_HCLK_FREQUENCY #define STM32_PCLK1_FREQUENCY STM32_HCLK_FREQUENCY
/* TODO: timers */ /* Timer clock frequencies */
/* Timers driven from APB1. Frequency = PCLK1 */
#define STM32_APB1_TIM3_CLKIN (STM32_PCLK1_FREQUENCY)
#define STM32_APB1_TIM6_CLKIN (STM32_PCLK1_FREQUENCY)
#define STM32_APB1_TIM7_CLKIN (STM32_PCLK1_FREQUENCY)
/* Timers driven from APB2 is equal to PCLK1 */
#define STM32_APB2_TIM1_CLKIN (STM32_PCLK1_FREQUENCY)
#define STM32_APB2_TIM14_CLKIN (STM32_PCLK1_FREQUENCY)
#define STM32_APB2_TIM15_CLKIN (STM32_PCLK1_FREQUENCY)
#define STM32_APB2_TIM16_CLKIN (STM32_PCLK1_FREQUENCY)
#define STM32_APB2_TIM17_CLKIN (STM32_PCLK1_FREQUENCY)
/* LED definitions **********************************************************/ /* LED definitions **********************************************************/

View File

@ -55,4 +55,9 @@ ifeq ($(CONFIG_LIB_BOARDCTL),y)
CSRCS += stm32_appinit.c CSRCS += stm32_appinit.c
endif endif
ifeq ($(CONFIG_TIMER),y)
CSRCS += stm32_timer.c
endif
include $(TOPDIR)/boards/Board.mk include $(TOPDIR)/boards/Board.mk

View File

@ -108,6 +108,26 @@
* Public Function Prototypes * Public Function Prototypes
****************************************************************************/ ****************************************************************************/
/****************************************************************************
* Name: stm32_timer_driver_setup
*
* Description:
* Configure the timer driver.
*
* Input Parameters:
* devpath - The full path to the timer device. This should be of the form /dev/timer0
* timer - The timer's number.
*
* Returned Value:
* Zero (OK) is returned on success; A negated errno value is returned
* to indicate the nature of any failure.
*
****************************************************************************/
#ifdef CONFIG_TIMER
int stm32_timer_driver_setup(FAR const char *devpath, int timer);
#endif
/***************************************************************************** /*****************************************************************************
* Name: stm32_bringup * Name: stm32_bringup
* *

View File

@ -111,6 +111,26 @@ int stm32_bringup(void)
} }
#endif #endif
#ifdef CONFIG_TIMER
/*Initialize basic timers */
# if defined(CONFIG_STM32F0L0G0_TIM6)
syslog(LOG_ERR, "Init timer\n");
ret = stm32_timer_driver_setup("/dev/timer0", 6);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: stm32_timer_driver_setup failed. TIM6: %d\n", ret);
}
# endif
# if defined(CONFIG_STM32F0L0G0_TIM7)
ret = stm32_timer_driver_setup("/dev/timer1", 7);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: stm32_timer_driver_setup failed. TIM7: %d\n", ret);
}
# endif
#endif
UNUSED(ret); UNUSED(ret);
return OK; return OK;
} }