summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2009-06-05 09:59:52 +0100
committerDaniel Silverstone <dsilvers@digital-scurf.org>2009-06-05 09:59:52 +0100
commite7c94ad7b663b1ee720ce7c0aa4328079cbdc338 (patch)
treeed654b3a1b2d74d04660005938a3e0412e13c873
parentf77b561646df0b6c282b92a9e8d8af676ae0cb02 (diff)
downloadstm32-virtcomport-e7c94ad7b663b1ee720ce7c0aa4328079cbdc338.tar.bz2
Final bits to make speed right etc
-rw-r--r--hw_config.c8
-rw-r--r--platform_config.h12
-rw-r--r--virtcomport.s3p8
-rw-r--r--virtcomport.s3r2
4 files changed, 18 insertions, 12 deletions
diff --git a/hw_config.c b/hw_config.c
index b7cf280..e843c62 100644
--- a/hw_config.c
+++ b/hw_config.c
@@ -76,7 +76,13 @@ void Set_System(void)
/* ADCCLK = PCLK2/6 */
RCC_ADCCLKConfig(RCC_PCLK2_Div6);
- RCC_PLLConfig(RCC_PLLSource_HSE_Div1, RCC_PLLMul_9);
+ if (HSE_Value == 8000000) {
+ /* PLLCLK = 8MHz * 9 = 72 MHz */
+ RCC_PLLConfig(RCC_PLLSource_HSE_Div1, RCC_PLLMul_9);
+ } else {
+ /* PLLCLK = 12MHz * 6 = 72 MHz */
+ RCC_PLLConfig(RCC_PLLSource_HSE_Div1, RCC_PLLMul_6);
+ }
/* Enable PLL */
RCC_PLLCmd(ENABLE);
diff --git a/platform_config.h b/platform_config.h
index 12e2219..68c80a8 100644
--- a/platform_config.h
+++ b/platform_config.h
@@ -47,7 +47,7 @@
#endif
#ifndef ACTIVE_USART
-#define ACTIVE_USART USART1
+#define ACTIVE_USART USART2
#endif
#ifndef RCC_USART_CMD
@@ -55,11 +55,11 @@
#endif
#ifndef RCC_USART_PERIPH
-#define RCC_USART_PERIPH RCC_APB2Periph_USART1
+#define RCC_USART_PERIPH RCC_APB2Periph_USART2
#endif
#ifndef USART_IRQCHANNEL
-#define USART_IRQCHANNEL USART1_IRQChannel
+#define USART_IRQCHANNEL USART2_IRQChannel
#endif
#ifndef USART_GPIO
@@ -71,15 +71,15 @@
#endif
#ifndef USART_IRQHANDLER
-#define USART_IRQHANDLER USART1_IRQHandler
+#define USART_IRQHANDLER USART2_IRQHandler
#endif
#ifndef USART_TXPIN
-#define USART_TXPIN GPIO_Pin_9
+#define USART_TXPIN GPIO_Pin_2
#endif
#ifndef USART_RXPIN
-#define USART_RXPIN GPIO_Pin_10
+#define USART_RXPIN GPIO_Pin_3
#endif
/* Exported macro ------------------------------------------------------------*/
diff --git a/virtcomport.s3p b/virtcomport.s3p
index 49f79a0..a28dc0c 100644
--- a/virtcomport.s3p
+++ b/virtcomport.s3p
@@ -1,7 +1,7 @@
#
# Automatically generated STM32 project. don't edit
# If you wish to re-configure this project, re-run the stm32-config tool.
-# Thu Jun 4 17:20:03 2009
+# Fri Jun 5 09:49:54 2009
#
#
@@ -107,7 +107,7 @@ CONFIG_ENABLE_GPIOA=y
# Serial ports (USARTS)
#
CONFIG_ENABLE_USART1=y
-# CONFIG_ENABLE_USART2 is not set
+CONFIG_ENABLE_USART2=y
# CONFIG_ENABLE_USART3 is not set
#
@@ -185,6 +185,6 @@ CONFIG_DISCONNECT_PIN=10
CONFIG_DISCONNECT_PIN_PP=y
CONFIG_DISCONNECT_ACTIVE_HIGH=y
# CONFIG_DISCONNECT_ACTIVE_LOW is not set
-CONFIG_ACTIVE_USART_USART1=y
-# CONFIG_ACTIVE_USART_USART2 is not set
+# CONFIG_ACTIVE_USART_USART1 is not set
+CONFIG_ACTIVE_USART_USART2=y
# CONFIG_ACTIVE_USART_USART3 is not set
diff --git a/virtcomport.s3r b/virtcomport.s3r
index 96611fc..617bc26 100644
--- a/virtcomport.s3r
+++ b/virtcomport.s3r
@@ -28,7 +28,7 @@ VCOMP_CFLAGS += -DUSART_GPIO=GPIOA -DUSART_TXPIN=GPIO_Pin_9 -DUSART_RXPIN=GPIO_P
VCOMP_CFLAGS += -DUSART_RCC_GPIO=RCC_APB2Periph_GPIOA -DUSART_IRQHANDLER=USART1_IRQHandler
else
VCOMP_CFLAGS += -DRCC_USART_CMD=RCC_APB1PeriphClockCmd -DRCC_USART_PERIPH=RCC_APB1Periph_$(USART)
-ifeq ($(USART,USART2))
+ifeq ($(USART),USART2)
VCOMP_CFLAGS += -DUSART_GPIO=GPIOA -DUSART_TXPIN=GPIO_Pin_2 -DUSART_RXPIN=GPIO_Pin_3
VCOMP_CFLAGS += -DUSART_RCC_GPIO=RCC_APB2Periph_GPIOA -DUSART_IRQHANDLER=USART2_IRQHandler
else