summaryrefslogtreecommitdiff
path: root/nuttx/configs/stm3240g-eval
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-01-09 21:34:58 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-01-09 21:34:58 +0000
commitbfd6e961c47c3572c7c409c296b345966634c217 (patch)
treeb8b6b86209167f5a7c4556abe884221e12a45095 /nuttx/configs/stm3240g-eval
parented93fd7399d11571a4cf214fadcd671a8e2f5d50 (diff)
downloadpx4-nuttx-bfd6e961c47c3572c7c409c296b345966634c217.tar.gz
px4-nuttx-bfd6e961c47c3572c7c409c296b345966634c217.tar.bz2
px4-nuttx-bfd6e961c47c3572c7c409c296b345966634c217.zip
Finish PWM pulse count configuration
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4287 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/configs/stm3240g-eval')
-rwxr-xr-xnuttx/configs/stm3240g-eval/README.txt11
-rwxr-xr-xnuttx/configs/stm3240g-eval/include/board.h79
-rwxr-xr-xnuttx/configs/stm3240g-eval/nsh/defconfig11
-rw-r--r--nuttx/configs/stm3240g-eval/src/stm3240g-internal.h24
-rw-r--r--nuttx/configs/stm3240g-eval/src/up_pwm.c32
5 files changed, 100 insertions, 57 deletions
diff --git a/nuttx/configs/stm3240g-eval/README.txt b/nuttx/configs/stm3240g-eval/README.txt
index 94581d10b..9702bf03e 100755
--- a/nuttx/configs/stm3240g-eval/README.txt
+++ b/nuttx/configs/stm3240g-eval/README.txt
@@ -596,10 +596,19 @@ Where <subdir> is one of the following:
CONFIG_PWM=y : Enable the generic PWM infrastructure
CONFIG_PWM_PULSECOUNT=n : Disable to support TIM1/8 pulse counts
+ CONFIG_STM32_TIM4=y : Enable TIM4
CONFIG_STM32_TIM4_PWM=y : Use TIM4 to generate PWM output
CONFIG_STM32_TIM4_CHANNEL=2
- See also apps/examples/README.txt
+ Or..
+
+ CONFIG_PWM=y : Enable the generic PWM infrastructure
+ CONFIG_PWM_PULSECOUNT=y : Enable to support TIM1/8 pulse counts
+ CONFIG_STM32_TIM1=y : Enable TIM1
+ CONFIG_STM32_TIM1_PWM=y : Use TIM1 to generate PWM output
+ CONFIG_STM32_TIM1_CHANNEL=1
+
+ See also include/board.h and apps/examples/README.txt
Special PWM-only debug options:
diff --git a/nuttx/configs/stm3240g-eval/include/board.h b/nuttx/configs/stm3240g-eval/include/board.h
index 6ad4736d7..f5a1ed2d5 100755
--- a/nuttx/configs/stm3240g-eval/include/board.h
+++ b/nuttx/configs/stm3240g-eval/include/board.h
@@ -2,7 +2,7 @@
* configs/stm3240g-eval/include/board.h
* include/arch/board/board.h
*
- * Copyright (C) 2009 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2011-12 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -307,20 +307,79 @@
/* PWM
*
* The STM3240G-Eval has no real on-board PWM devices, but the board can be
- * configured to output a pulse train using TIM4 CH2. This pin is used by FSMC is
- * but is also connected to the Motor Control Connector (CN5) just for this
- * purpose:
+ * configured to output a pulse train using the following:
*
- * PD13 FSMC_A18 / MC_TIM4_CH2OUT pin 33 (EnB)
+ * If FSMC is not used:
+ * TIM4 CH2OUT: PD13 FSMC_A18 / MC_TIM4_CH2OUT
+ * Daughterboard Extension Connector, CN3, pin 32
+ * Motor Control Connector CN15, pin 33 -- not available unless you bridge SB14.
*
- * FSMC must be disabled in this case! PD13 is available at:
+ * TIM1 CH1OUT: PE9 FSMC_D6
+ * Daughterboard Extension Connector, CN2, pin 24
*
- * Daughterboard Extension Connector, CN3, pin 32 - available
- * TFT LCD Connector, CN19, pin 17 -- not available without removing the LCD.
- * Motor Control Connector CN15, pin 33 -- not available unless you bridge SB14.
+ * TIM1_CH2OUT: PE11 FSMC_D8
+ * Daughterboard Extension Connector, CN2, pin 26
+ *
+ * TIM1_CH3OUT: PE13 FSMC_D10
+ * Daughterboard Extension Connector, CN2, pin 28
+ *
+ * TIM1_CH4OUT: PE14 FSMC_D11
+ * Daughterboard Extension Connector, CN2, pin 29
+ *
+ * If OTG FS is not used
+ *
+ * TIM1_CH3OUT: PA10 OTG_FS_ID
+ * Daughterboard Extension Connector, CN3, pin 14
+ *
+ * TIM1_CH4OUT: PA11 OTG_FS_DM
+ * Daughterboard Extension Connector, CN3, pin 11
+ *
+ * If DMCI is not used
+ *
+ * TIM8 CH1OUT: PI5 DCMI_VSYNC & MC
+ * Daughterboard Extension Connector, CN4, pin 4
+ *
+ * TIM8_CH2OUT: PI6 DCMI_D6 & MC
+ * Daughterboard Extension Connector, CN4, pin 3
+ *
+ * TIM8_CH3OUT: PI7 DCMI_D7 & MC
+ * Daughterboard Extension Connector, CN4, pin 2
+ *
+ * If SDIO is not used
+ *
+ * TIM8_CH3OUT: PC8 MicroSDCard_D0 & MC
+ * Daughterboard Extension Connector, CN3, pin 18
+ *
+ * TIM8_CH4OUT: PC9 MicroSDCard_D1 & I2S_CKIN (JP16)
+ * Daughterboard Extension Connector, CN3, pin 15
+ *
+ * Others
+ *
+ * TIM8 CH1OUT: PC6 I2S_MCK & Smartcard_IO (JP21 open)
*/
-#define GPIO_TIM4_CH2OUT GPIO_TIM4_CH2OUT_2
+#if !defined(CONFIG_STM32_FSMC)
+# define GPIO_TIM4_CH2OUT GPIO_TIM4_CH2OUT_2
+# define GPIO_TIM1_CH1OUT GPIO_TIM1_CH1OUT_2
+# define GPIO_TIM1_CH2OUT GPIO_TIM1_CH2OUT_2
+# define GPIO_TIM1_CH3OUT GPIO_TIM1_CH3OUT_2
+# define GPIO_TIM1_CH4OUT GPIO_TIM1_CH4OUT_2
+#elif !defined(CONFIG_STM32_OTGFS)
+# define GPIO_TIM1_CH3OUT GPIO_TIM1_CH3OUT_1
+# define GPIO_TIM1_CH4OUT GPIO_TIM1_CH4OUT_1
+#endif
+
+#if !defined(CONFIG_STM32_DCMI)
+# define GPIO_TIM8_CH1OUT GPIO_TIM8_CH1OUT_2
+# define GPIO_TIM8_CH2OUT GPIO_TIM8_CH2OUT_2
+# define GPIO_TIM8_CH3OUT GPIO_TIM8_CH3OUT_2
+#else
+# define GPIO_TIM8_CH1OUT GPIO_TIM8_CH1OUT_1
+# if !defined(CONFIG_STM32_SDIO)
+# define GPIO_TIM8_CH3OUT GPIO_TIM8_CH3OUT_1
+# define GPIO_TIM8_CH4OUT GPIO_TIM8_CH4OUT_1
+# endif
+#endif
/* CAN
*
diff --git a/nuttx/configs/stm3240g-eval/nsh/defconfig b/nuttx/configs/stm3240g-eval/nsh/defconfig
index f9c0eb318..f71548b5f 100755
--- a/nuttx/configs/stm3240g-eval/nsh/defconfig
+++ b/nuttx/configs/stm3240g-eval/nsh/defconfig
@@ -349,14 +349,13 @@ CONFIG_STM32_ADC3_SAMPLE_FREQUENCY=100
# PWM configuration
#
# The STM3240G-Eval has no real on-board PWM devices, but the board can be configured to output
-# a pulse train using TIM4 CH2. This pin is used by FSMC is connect to CN5 just for this
-# purpose.
+# a pulse train using several options (see board.h). Here the default setup is for TIM1, CH1.
+# Don't forget to enable CONFIG_STM32_TIM1
#
CONFIG_PWM=n
-CONFIG_PWM_PULSECOUNT=n
-CONFIG_STM32_TIM4=y
-CONFIG_STM32_TIM4_PWM=y
-CONFIG_STM32_TIM4_CHANNEL=2
+CONFIG_PWM_PULSECOUNT=y
+CONFIG_STM32_TIM1_PWM=y
+CONFIG_STM32_TIM1_CHANNEL=1
#
# General build options
diff --git a/nuttx/configs/stm3240g-eval/src/stm3240g-internal.h b/nuttx/configs/stm3240g-eval/src/stm3240g-internal.h
index 2f23d252c..672d2f95e 100644
--- a/nuttx/configs/stm3240g-eval/src/stm3240g-internal.h
+++ b/nuttx/configs/stm3240g-eval/src/stm3240g-internal.h
@@ -113,21 +113,19 @@
/* PWM
*
* The STM3240G-Eval has no real on-board PWM devices, but the board can be
- * configured to output a pulse train using TIM4 CH2. This pin is used by FSMC is
- * but is also connected to the Motor Control Connector (CN5) just for this
- * purpose:
- *
- * PD13 FSMC_A18 / MC_TIM4_CH2OUT pin 33 (EnB)
- *
- * FSMC must be disabled in this case! PD13 is available at:
- *
- * Daughterboard Extension Connector, CN3, pin 32 - available
- * TFT LCD Connector, CN19, pin 17 -- not available without removing the LCD.
- * Motor Control Connector CN15, pin 33 -- not available unless you bridge SB14.
+ * configured to output a pulse train using TIM4, TIM1, or TIM8 (see board.h).
+ * Let's figure out which the user has configured.
*/
-#define STM3240G_EVAL_PWMTIMER 4
-#define STM3240G_EVAL_PWMCHANNEL 2
+#ifdef CONFIG_PWM
+# if defined(CONFIG_STM32_TIM1_PWM)
+# define STM3240G_EVAL_PWMTIMER 1
+# elif defined(CONFIG_STM32_TIM4_PWM)
+# define STM3240G_EVAL_PWMTIMER 4
+# elif defined(CONFIG_STM32_TIM8_PWM)
+# define STM3240G_EVAL_PWMTIMER 8
+# endif
+#endif
/****************************************************************************************************
* Public Types
diff --git a/nuttx/configs/stm3240g-eval/src/up_pwm.c b/nuttx/configs/stm3240g-eval/src/up_pwm.c
index f2932cc4d..7cc1d39d5 100644
--- a/nuttx/configs/stm3240g-eval/src/up_pwm.c
+++ b/nuttx/configs/stm3240g-eval/src/up_pwm.c
@@ -57,34 +57,12 @@
/* Configuration *******************************************************************/
/* PWM
*
- * The STM3240G-Eval has no real on-board PWM devices, but the board can be configured to output
- * a pulse train using TIM4 CH2. This pin is used by FSMC is connect to CN5 just for this
- * purpose:
- *
- * PD13 FSMC_A18 / MC_TIM4_CH2OUT pin 33 (EnB)
- *
- * FSMC must be disabled in this case!
+ * The STM3240G-Eval has no real on-board PWM devices, but the board can be
+ * configured to output a pulse train using variously unused pins on the board for
+ * PWM output (see board.h for details of pins).
*/
-#define HAVE_PWM 1
-
-#ifndef CONFIG_PWM
-# undef HAVE_PWM
-#endif
-
-#ifndef CONFIG_STM32_TIM4
-# undef HAVE_PWM
-#endif
-
-#ifndef CONFIG_STM32_TIM4_PWM
-# undef HAVE_PWM
-#endif
-
-#if CONFIG_STM32_TIM4_CHANNEL != STM3240G_EVAL_PWMCHANNEL
-# undef HAVE_PWM
-#endif
-
-#ifdef HAVE_PWM
+#ifdef CONFIG_PWM
/************************************************************************************
* Private Functions
@@ -139,4 +117,4 @@ int pwm_devinit(void)
return OK;
}
-#endif /* HAVE_PWM */
+#endif /* CONFIG_PWM */