This is an automated email from the ASF dual-hosted git repository.

jerpelea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit d54ed68aa044dbf6d75d17150641f088d89eb1bd
Author: raiden00pl <[email protected]>
AuthorDate: Wed May 20 13:01:11 2026 +0200

    boards/nucleo-f446re: add pulse count example
    
    add pulse count example for nucleo-f446re
    
    Signed-off-by: raiden00pl <[email protected]>
---
 .../stm32/nucleo-f446re/configs/jumbo/defconfig    | 54 ++++++++++++++++++++++
 boards/arm/stm32/nucleo-f446re/include/board.h     |  4 ++
 boards/arm/stm32/nucleo-f446re/src/stm32_bringup.c | 25 ++++++++++
 3 files changed, 83 insertions(+)

diff --git a/boards/arm/stm32/nucleo-f446re/configs/jumbo/defconfig 
b/boards/arm/stm32/nucleo-f446re/configs/jumbo/defconfig
new file mode 100644
index 00000000000..e553a334ca1
--- /dev/null
+++ b/boards/arm/stm32/nucleo-f446re/configs/jumbo/defconfig
@@ -0,0 +1,54 @@
+#
+# 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_FPU is not set
+# CONFIG_NSH_ARGCAT is not set
+# CONFIG_NSH_CMDOPT_HEXDUMP is not set
+# CONFIG_NSH_DISABLE_IFCONFIG is not set
+# CONFIG_NSH_DISABLE_PS is not set
+# CONFIG_STM32_FLASH_PREFETCH is not set
+CONFIG_ARCH="arm"
+CONFIG_ARCH_BOARD="nucleo-f446re"
+CONFIG_ARCH_BOARD_NUCLEO_F446RE=y
+CONFIG_ARCH_BUTTONS=y
+CONFIG_ARCH_CHIP="stm32"
+CONFIG_ARCH_CHIP_STM32=y
+CONFIG_ARCH_CHIP_STM32F446R=y
+CONFIG_ARCH_INTERRUPTSTACK=2048
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_BOARD_LOOPSPERMSEC=8499
+CONFIG_BUILTIN=y
+CONFIG_EXAMPLES_PULSECOUNT=y
+CONFIG_HAVE_CXX=y
+CONFIG_HAVE_CXXINITIALIZE=y
+CONFIG_INIT_ENTRYPOINT="nsh_main"
+CONFIG_INTELHEX_BINARY=y
+CONFIG_LINE_MAX=64
+CONFIG_NSH_BUILTIN_APPS=y
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_READLINE=y
+CONFIG_PREALLOC_TIMERS=4
+CONFIG_RAM_SIZE=131072
+CONFIG_RAM_START=0x20000000
+CONFIG_RAW_BINARY=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_WAITPID=y
+CONFIG_SPI=y
+CONFIG_START_DAY=14
+CONFIG_START_MONTH=10
+CONFIG_START_YEAR=2014
+CONFIG_STM32_CRC=y
+CONFIG_STM32_JTAG_SW_ENABLE=y
+CONFIG_STM32_OTGFS=y
+CONFIG_STM32_PWR=y
+CONFIG_STM32_TIM8=y
+CONFIG_STM32_TIM8_PULSECOUNT=y
+CONFIG_STM32_USART2=y
+CONFIG_SYSTEM_NSH=y
+CONFIG_TASK_NAME_SIZE=0
+CONFIG_TESTING_OSTEST=y
+CONFIG_USART2_SERIAL_CONSOLE=y
diff --git a/boards/arm/stm32/nucleo-f446re/include/board.h 
b/boards/arm/stm32/nucleo-f446re/include/board.h
index 46870b34da8..3e4b1ed1757 100644
--- a/boards/arm/stm32/nucleo-f446re/include/board.h
+++ b/boards/arm/stm32/nucleo-f446re/include/board.h
@@ -391,6 +391,10 @@
 
 #define GPIO_TIM3_CH1OUT (GPIO_TIM3_CH1OUT_1|GPIO_SPEED_50MHz)
 
+/* TIM8 configuration *******************************************************/
+
+#define GPIO_TIM8_CH1OUT (GPIO_TIM8_CH1OUT_1|GPIO_SPEED_50MHz) /* PC6 */
+
 #ifdef CONFIG_BOARD_STM32_IHM08M1
 
 /* Configuration specific to the X-NUCLEO-IHM08M1 expansion board with
diff --git a/boards/arm/stm32/nucleo-f446re/src/stm32_bringup.c 
b/boards/arm/stm32/nucleo-f446re/src/stm32_bringup.c
index 84d62e89f0b..893fe825102 100644
--- a/boards/arm/stm32/nucleo-f446re/src/stm32_bringup.c
+++ b/boards/arm/stm32/nucleo-f446re/src/stm32_bringup.c
@@ -40,6 +40,10 @@
 
 #include <arch/board/board.h>
 
+#ifdef CONFIG_PULSECOUNT
+#  include "stm32_pulsecount.h"
+#endif
+
 #ifdef CONFIG_INPUT_BUTTONS
 #  include <nuttx/input/buttons.h>
 #endif
@@ -80,6 +84,9 @@
 
 int stm32_bringup(void)
 {
+#ifdef CONFIG_PULSECOUNT
+  struct pulsecount_lowerhalf_s *pulsecount;
+#endif
   int ret = OK;
 
 #ifdef CONFIG_FS_PROCFS
@@ -163,6 +170,24 @@ int stm32_bringup(void)
     }
 #endif
 
+#ifdef CONFIG_PULSECOUNT
+  /* Initialize and register the pulse count driver. */
+
+  pulsecount = stm32_pulsecountinitialize(8);
+  if (pulsecount == NULL)
+    {
+      syslog(LOG_ERR, "ERROR: stm32_pulsecountinitialize failed\n");
+      return -ENODEV;
+    }
+
+  ret = pulsecount_register("/dev/pulsecount0", pulsecount);
+  if (ret < 0)
+    {
+      syslog(LOG_ERR, "ERROR: pulsecount_register failed: %d\n", ret);
+      return ret;
+    }
+#endif
+
 #ifdef CONFIG_STM32_CAN_CHARDRIVER
   /* Initialize CAN and register the CAN driver. */
 

Reply via email to