From 0829cfcb4527ed040620c193b7774146761608ed Mon Sep 17 00:00:00 2001 From: patacongo Date: Fri, 21 Sep 2012 17:32:30 +0000 Subject: [PATCH] Add support for Fire STM32v3; sscanf fixes from Kate git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5168 42af7a65-404d-4744-a932-0658087f49c3 --- configs/Kconfig | 8 ++++---- configs/README.txt | 3 ++- configs/fire-stm32v2/Kconfig | 22 ++++++++++++++++++++++ configs/fire-stm32v2/README.txt | 16 ++++++++++++---- configs/fire-stm32v2/nsh/defconfig | 17 ++++++++++++++++- configs/fire-stm32v2/src/fire-internal.h | 18 +++++++++++++++--- 6 files changed, 71 insertions(+), 13 deletions(-) diff --git a/configs/Kconfig b/configs/Kconfig index 12cc41ea72..752a5b0983 100644 --- a/configs/Kconfig +++ b/configs/Kconfig @@ -130,8 +130,8 @@ config ARCH_BOARD_EZ80F910200ZCO development kit, eZ80F091 part, and the Zilog ZDS-II Windows command line tools. The development environment is Cygwin under WinXP. -config ARCH_BOARD_FIRE_STM32V2 - bool "M3 Wildfire STM32v2 board" +config ARCH_BOARD_FIRE_STM32 + bool "M3 Wildfire STM3 board (v2 or v3)" depends on ARCH_CHIP_STM32F103VET6 select ARCH_HAVE_LEDS select ARCH_HAVE_BUTTONS @@ -607,7 +607,7 @@ config ARCH_BOARD default "ekk-lm3s9b96" if ARCH_BOARD_EKK_LM3S9B96 default "ez80f0910200kitg" if ARCH_BOARD_EZ80F910200KITG default "ez80f0910200zco" if ARCH_BOARD_EZ80F910200ZCO - default "fire-stm32v2" if ARCH_BOARD_FIRE_STM32V2 + default "fire-stm32v2" if ARCH_BOARD_FIRE_STM32 default "hymini-stm32v" if ARCH_BOARD_HYMINI_STM32V default "kwikstik-k40" if ARCH_BOARD_KWIKSTIK_K40 default "lincoln60" if ARCH_BOARD_LINCOLN60 @@ -747,7 +747,7 @@ endif if ARCH_BOARD_EZ80F910200ZCO source "configs/ez80f910200zco/Kconfig" endif -if ARCH_BOARD_FIRE_STM32V2 +if ARCH_BOARD_FIRE_STM32 source "configs/fire-stm32v2/Kconfig" endif if ARCH_BOARD_HYMINI_STM32V diff --git a/configs/README.txt b/configs/README.txt index b5ada6ee5d..5bbec874f7 100644 --- a/configs/README.txt +++ b/configs/README.txt @@ -1570,7 +1570,8 @@ configs/ez80f0910200zco configs/fire-stm32v2 A configuration for the M3 Wildfire STM32 board. This board is based on the - STM32F103VET6 chip. See http://firestm32.taobao.com + STM32F103VET6 chip. See http://firestm32.taobao.com . Version 2 and 3 of + the boards are supported but only version 2 has been tested. configs/hymini-stm32v A configuration for the HY-Mini STM32v board. This board is based on the diff --git a/configs/fire-stm32v2/Kconfig b/configs/fire-stm32v2/Kconfig index 3f4b857dad..4249a3dbde 100644 --- a/configs/fire-stm32v2/Kconfig +++ b/configs/fire-stm32v2/Kconfig @@ -4,3 +4,25 @@ # comment "M3 Wildfire Configuration" + +if ARCH_BOARD_FIRE_STM32 + +choice + prompt "Select Wildfire STM32 version" + default ARCH_BOARD_FIRE_STM32V2 + ---help--- + This port has logic differences to support either the Version 2 or + Version 3 of the Wildfire board. + +config ARCH_BOARD_FIRE_STM32V2 + bool "Wildfire STM32v2" + ---help--- + Selects the M3 Wildfire version 2. + +config ARCH_BOARD_FIRE_STM32V3 + bool "Wildfire STM32v3" + ---help--- + Selects the M3 Wildfire version 3. + +endchoice +endif diff --git a/configs/fire-stm32v2/README.txt b/configs/fire-stm32v2/README.txt index d9a4d14cad..6382a7363e 100644 --- a/configs/fire-stm32v2/README.txt +++ b/configs/fire-stm32v2/README.txt @@ -4,6 +4,10 @@ README This README discusses issues unique to NuttX configurations for the M3 Wildfire development board (STM32F103VET6). See http://firestm32.taobao.com +This configuration should support both the version 2 and version 3 of the +Wildfire board (using NuttX configuration options). However, only version 2 +has been verified. + Contents ======== @@ -27,8 +31,10 @@ PIN NAME SIGNAL NOTES 1 PE2 PE2-C-RCLK Camera (P9) 2 PE3 PE3-USB-M USB2.0 -3 PE4 PE4-BEEP LS1 Bell -4 PE5 (no name) 10Mbps ENC28J60 Interrupt +3 PE4 PE4-BEEP LS1 Bell (v2) + PE4 10Mbps ENC28J60 Interrupt (v3) +4 PE5 (no name) 10Mbps ENC28J60 Interrupt (v2) + PE5 KEY1, Low when closed (pulled high if open) (v3) 5 PE6 6 VBAT BT1 Battery (BT1) 7 PC13 Header 7X2 @@ -64,7 +70,8 @@ PIN NAME SIGNAL NOTES 32 PA7 PA7-SPI1-MOSI 2.4" TFT + Touchscreen, 10Mbit ENC28J60, SPI 2M FLASH 33 PC4 PC4-LED2 LED2, Active low (pulled high) 34 PC5 PC5-LED3 LED3, Active low (pulled high) -35 PB0 PB0-KEY1 KEY1, Low when closed (pulled high if open) +35 PB0 PB0-KEY1 KEY1, Low when closed (pulled high if open) (v2) + PB0 Header P5 (v3) 36 PB1 PB1-KEY2 KEY2, Low when closed (pulled high if open) 37 PB2 BOOT1/DGND 38 PE7 PE7-FSMC_D4 2.4" TFT + Touchscreen @@ -525,7 +532,8 @@ M3 Wildfire-specific Configuration Options CONFIG_ARCH_BOARD_name - For use in C code - CONFIG_ARCH_BOARD_FIRE_STM32V2=y + CONFIG_ARCH_BOARD_FIRE_STM32V2=y (Version 2) + CONFIG_ARCH_BOARD_FIRE_STM32V3=y (Version 3) CONFIG_ARCH_LOOPSPERMSEC - Must be calibrated for correct operation of delay loops diff --git a/configs/fire-stm32v2/nsh/defconfig b/configs/fire-stm32v2/nsh/defconfig index fd51878010..0802af3c94 100644 --- a/configs/fire-stm32v2/nsh/defconfig +++ b/configs/fire-stm32v2/nsh/defconfig @@ -150,6 +150,7 @@ CONFIG_STM32_USART2=y CONFIG_STM32_USB=y # CONFIG_STM32_WWDG is not set CONFIG_STM32_SPI=y +CONFIG_STM32_I2C=y # # Alternate Pin Mapping @@ -171,6 +172,15 @@ CONFIG_STM32_JTAG_FULL_ENABLE=y # CONFIG_STM32_SPI_INTERRUPTS is not set # CONFIG_STM32_SPI_DMA is not set +# +# I2C Configuration +# +# CONFIG_STM32_I2C_DYNTIMEO is not set +CONFIG_STM32_I2CTIMEOSEC=0 +CONFIG_STM32_I2CTIMEOMS=500 +CONFIG_STM32_I2CTIMEOTICKS=500 +# CONFIG_STM32_I2C_DUTY16_9 is not set + # # SDIO Configuration # @@ -215,7 +225,7 @@ CONFIG_BOOT_RUNFROMFLASH=y # # Board Selection # -CONFIG_ARCH_BOARD_FIRE_STM32V2=y +CONFIG_ARCH_BOARD_FIRE_STM32=y # CONFIG_ARCH_BOARD_CUSTOM is not set CONFIG_ARCH_BOARD="fire-stm32v2" @@ -238,6 +248,8 @@ CONFIG_NSH_MMCSDSPIPORTNO=0 # # M3 Wildfire Configuration # +CONFIG_ARCH_BOARD_FIRE_STM32V2=y +# CONFIG_ARCH_BOARD_FIRE_STM32V3 is not set # # RTOS Features @@ -316,6 +328,8 @@ CONFIG_I2C_TRANSFER=y # CONFIG_I2C_WRITEREAD is not set CONFIG_I2C_POLLED=y # CONFIG_I2C_TRACE is not set +CONFIG_ARCH_HAVE_I2CRESET=y +# CONFIG_I2C_RESET is not set CONFIG_SPI=y # CONFIG_SPI_OWNBUS is not set CONFIG_SPI_EXCHANGE=y @@ -348,6 +362,7 @@ CONFIG_ENC28J60_SPIMODE=0 CONFIG_ENC28J60_FREQUENCY=20000000 # CONFIG_ENC28J60_STATS is not set # CONFIG_ENC28J60_HALFDUPPLEX is not set +# CONFIG_ENC28J60_DUMPPACKET is not set # CONFIG_NET_E1000 is not set # CONFIG_NET_SLIP is not set # CONFIG_NET_VNET is not set diff --git a/configs/fire-stm32v2/src/fire-internal.h b/configs/fire-stm32v2/src/fire-internal.h index e9f7a85089..7ab78a08fe 100644 --- a/configs/fire-stm32v2/src/fire-internal.h +++ b/configs/fire-stm32v2/src/fire-internal.h @@ -166,7 +166,8 @@ * PIN NAME SIGNAL NOTES * --- ------ -------------- ------------------------------------------------------------------- * - * 35 PB0 PB0-KEY1 KEY1, Low when closed (pulled high if open) + * 35 PB0 PB0-KEY1 KEY1, Low when closed (pulled high if open) (v2) + * 35 PE5 PB0 KEY1, Low when closed (pulled high if open) (v3) * 36 PB1 PB1-KEY2 KEY2, Low when closed (pulled high if open) */ @@ -174,8 +175,13 @@ #define MAX_IRQBUTTON BUTTON_KEY2 #define NUM_IRQBUTTONS (MAX_IRQBUTTON - MIN_IRQBUTTON + 1) -#define GPIO_BTN_KEY1 (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|\ +#ifdef CONFIG_ARCH_BOARD_FIRE_STM32V3 +# define GPIO_BTN_KEY1 (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|\ + GPIO_EXTI|GPIO_PORTE|GPIO_PIN5) +#else +# define GPIO_BTN_KEY1 (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|\ GPIO_EXTI|GPIO_PORTB|GPIO_PIN0) +#endif #define GPIO_BTN_KEY2 (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|\ GPIO_EXTI|GPIO_PORTB|GPIO_PIN1) @@ -207,7 +213,8 @@ * 31 PA6 PA6-SPI1-MISO 2.4" TFT + Touchscreen, 10Mbit ENC28J60, SPI 2M FLASH * 32 PA7 PA7-SPI1-MOSI 2.4" TFT + Touchscreen, 10Mbit ENC28J60, SPI 2M FLASH * 98 PE1 PE1-FSMC_NBL1 2.4" TFT + Touchscreen, 10Mbit EN28J60 Reset - * 4 PE5 (no name) 10Mbps ENC28J60 Interrupt + * 4 PE5 (no name) 10Mbps ENC28J60 Interrupt (v2) + * 4 PE4 PE4 10Mbps ENC28J60 Interrupt (v3) */ #if defined(CONFIG_STM32_FSMC) && defined(CONFIG_ENC28J60) @@ -224,9 +231,14 @@ GPIO_OUTPUT_SET|GPIO_PORTA|GPIO_PIN4) # define GPIO_ENC28J60_RESET (GPIO_OUTPUT|GPIO_CNF_OUTPP|GPIO_MODE_50MHz|\ GPIO_OUTPUT_CLEAR|GPIO_PORTE|GPIO_PIN1) +#ifdef CONFIG_ARCH_BOARD_FIRE_STM32V3 +# define GPIO_ENC28J60_INTR (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|\ + GPIO_EXTI|GPIO_PORTE|GPIO_PIN4) +#else /* CONFIG_ARCH_BOARD_FIRE_STM32V2 */ # define GPIO_ENC28J60_INTR (GPIO_INPUT|GPIO_CNF_INFLOAT|GPIO_MODE_INPUT|\ GPIO_EXTI|GPIO_PORTE|GPIO_PIN5) #endif +#endif /* MP3 *