From d501fe85d1816bd8fc20cd8354f7b339df9ecc27 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 5 Dec 2012 11:19:22 +0000 Subject: STM32F3xx DMA and SPI support. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4874 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/ARMCM4-STM32F303-DISCOVERY/halconf.h | 2 +- demos/ARMCM4-STM32F303-DISCOVERY/main.c | 16 ++++++++-------- demos/ARMCM4-STM32F303-DISCOVERY/mcuconf.h | 16 +++++++++++++++- 3 files changed, 24 insertions(+), 10 deletions(-) (limited to 'demos') diff --git a/demos/ARMCM4-STM32F303-DISCOVERY/halconf.h b/demos/ARMCM4-STM32F303-DISCOVERY/halconf.h index c9b3ad25a..d3766e0fd 100644 --- a/demos/ARMCM4-STM32F303-DISCOVERY/halconf.h +++ b/demos/ARMCM4-STM32F303-DISCOVERY/halconf.h @@ -143,7 +143,7 @@ * @brief Enables the SPI subsystem. */ #if !defined(HAL_USE_SPI) || defined(__DOXYGEN__) -#define HAL_USE_SPI FALSE +#define HAL_USE_SPI TRUE #endif /** diff --git a/demos/ARMCM4-STM32F303-DISCOVERY/main.c b/demos/ARMCM4-STM32F303-DISCOVERY/main.c index 587d1f694..53ba509fb 100644 --- a/demos/ARMCM4-STM32F303-DISCOVERY/main.c +++ b/demos/ARMCM4-STM32F303-DISCOVERY/main.c @@ -33,28 +33,28 @@ static msg_t Thread1(void *arg) { chRegSetThreadName("blinker"); while (TRUE) { palSetPad(GPIOE, GPIOE_LED3_RED); - chThdSleepMilliseconds(100); + chThdSleepMilliseconds(125); palClearPad(GPIOE, GPIOE_LED3_RED); palSetPad(GPIOE, GPIOE_LED5_ORANGE); - chThdSleepMilliseconds(100); + chThdSleepMilliseconds(125); palClearPad(GPIOE, GPIOE_LED5_ORANGE); palSetPad(GPIOE, GPIOE_LED7_GREEN); - chThdSleepMilliseconds(100); + chThdSleepMilliseconds(125); palClearPad(GPIOE, GPIOE_LED7_GREEN); palSetPad(GPIOE, GPIOE_LED9_BLUE); - chThdSleepMilliseconds(100); + chThdSleepMilliseconds(125); palClearPad(GPIOE, GPIOE_LED9_BLUE); palSetPad(GPIOE, GPIOE_LED10_RED); - chThdSleepMilliseconds(100); + chThdSleepMilliseconds(125); palClearPad(GPIOE, GPIOE_LED10_RED); palSetPad(GPIOE, GPIOE_LED8_ORANGE); - chThdSleepMilliseconds(100); + chThdSleepMilliseconds(125); palClearPad(GPIOE, GPIOE_LED8_ORANGE); palSetPad(GPIOE, GPIOE_LED6_GREEN); - chThdSleepMilliseconds(100); + chThdSleepMilliseconds(125); palClearPad(GPIOE, GPIOE_LED6_GREEN); palSetPad(GPIOE, GPIOE_LED4_BLUE); - chThdSleepMilliseconds(100); + chThdSleepMilliseconds(125); palClearPad(GPIOE, GPIOE_LED4_BLUE); } } diff --git a/demos/ARMCM4-STM32F303-DISCOVERY/mcuconf.h b/demos/ARMCM4-STM32F303-DISCOVERY/mcuconf.h index 1b0d1243e..aa3607f1e 100644 --- a/demos/ARMCM4-STM32F303-DISCOVERY/mcuconf.h +++ b/demos/ARMCM4-STM32F303-DISCOVERY/mcuconf.h @@ -47,7 +47,7 @@ #define STM32_SW STM32_SW_PLL #define STM32_PLLSRC STM32_PLLSRC_HSE #define STM32_PREDIV_VALUE 1 -#define STM32_PLLMUL_VALUE 8 +#define STM32_PLLMUL_VALUE 9 #define STM32_HPRE STM32_HPRE_DIV1 #define STM32_PPRE1 STM32_PPRE1_DIV2 #define STM32_PPRE2 STM32_PPRE2_DIV1 @@ -80,3 +80,17 @@ #define STM32_SERIAL_USART3_PRIORITY 12 #define STM32_SERIAL_UART4_PRIORITY 12 #define STM32_SERIAL_UART5_PRIORITY 12 + +/* + * SPI driver system settings. + */ +#define STM32_SPI_USE_SPI1 TRUE +#define STM32_SPI_USE_SPI2 FALSE +#define STM32_SPI_USE_SPI3 FALSE +#define STM32_SPI_SPI1_DMA_PRIORITY 1 +#define STM32_SPI_SPI2_DMA_PRIORITY 1 +#define STM32_SPI_SPI3_DMA_PRIORITY 1 +#define STM32_SPI_SPI1_IRQ_PRIORITY 10 +#define STM32_SPI_SPI2_IRQ_PRIORITY 10 +#define STM32_SPI_SPI3_IRQ_PRIORITY 10 +#define STM32_SPI_DMA_ERROR_HOOK(spip) chSysHalt() -- cgit v1.2.3