aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--demos/ARMCM3-STM32F407-DISCOVERY/mcuconf.h2
-rw-r--r--os/hal/platforms/STM32/serial_lld.c50
-rw-r--r--os/hal/platforms/STM32/serial_lld.h33
-rw-r--r--readme.txt6
4 files changed, 84 insertions, 7 deletions
diff --git a/demos/ARMCM3-STM32F407-DISCOVERY/mcuconf.h b/demos/ARMCM3-STM32F407-DISCOVERY/mcuconf.h
index 2da3961ed..058cc7a76 100644
--- a/demos/ARMCM3-STM32F407-DISCOVERY/mcuconf.h
+++ b/demos/ARMCM3-STM32F407-DISCOVERY/mcuconf.h
@@ -146,11 +146,13 @@
#define STM32_SERIAL_USE_USART3 FALSE
#define STM32_SERIAL_USE_UART4 FALSE
#define STM32_SERIAL_USE_UART5 FALSE
+#define STM32_SERIAL_USE_USART6 FALSE
#define STM32_SERIAL_USART1_PRIORITY 12
#define STM32_SERIAL_USART2_PRIORITY 12
#define STM32_SERIAL_USART3_PRIORITY 12
#define STM32_SERIAL_UART4_PRIORITY 12
#define STM32_SERIAL_UART5_PRIORITY 12
+#define STM32_SERIAL_USART6_PRIORITY 12
/*
* SPI driver system settings.
diff --git a/os/hal/platforms/STM32/serial_lld.c b/os/hal/platforms/STM32/serial_lld.c
index d9d0836fd..c5dda231b 100644
--- a/os/hal/platforms/STM32/serial_lld.c
+++ b/os/hal/platforms/STM32/serial_lld.c
@@ -60,6 +60,11 @@ SerialDriver SD4;
SerialDriver SD5;
#endif
+/** @brief USART6 serial driver identifier.*/
+#if STM32_SERIAL_USE_USART6 || defined(__DOXYGEN__)
+SerialDriver SD6;
+#endif
+
/*===========================================================================*/
/* Driver local variables. */
/*===========================================================================*/
@@ -127,7 +132,7 @@ static void usart_deinit(USART_TypeDef *u) {
#if STM32_SERIAL_USE_USART1 || STM32_SERIAL_USE_USART2 || \
STM32_SERIAL_USE_USART3 || STM32_SERIAL_USE_UART4 || \
- USE_STM32_USART5
+ STM32_SERIAL_USE_UART5 || STM32_SERIAL_USE_USART6
/**
* @brief Error handling routine.
*
@@ -241,6 +246,14 @@ static void notify5(GenericQueue *qp) {
}
#endif
+#if STM32_SERIAL_USE_USART6 || defined(__DOXYGEN__)
+static void notify6(GenericQueue *qp) {
+
+ (void)qp;
+ USART6->CR1 |= USART_CR1_TXEIE;
+}
+#endif
+
/*===========================================================================*/
/* Driver interrupt handlers. */
/*===========================================================================*/
@@ -325,6 +338,22 @@ CH_IRQ_HANDLER(UART5_IRQHandler) {
}
#endif
+#if STM32_SERIAL_USE_USART6 || defined(__DOXYGEN__)
+/**
+ * @brief USART1 interrupt handler.
+ *
+ * @isr
+ */
+CH_IRQ_HANDLER(USART6_IRQHandler) {
+
+ CH_IRQ_PROLOGUE();
+
+ serve_interrupt(&SD6);
+
+ CH_IRQ_EPILOGUE();
+}
+#endif
+
/*===========================================================================*/
/* Driver exported functions. */
/*===========================================================================*/
@@ -360,6 +389,11 @@ void sd_lld_init(void) {
sdObjectInit(&SD5, NULL, notify5);
SD5.usart = UART5;
#endif
+
+#if STM32_SERIAL_USE_USART6
+ sdObjectInit(&SD6, NULL, notify6);
+ SD6.usart = USART6;
+#endif
}
/**
@@ -413,6 +447,13 @@ void sd_lld_start(SerialDriver *sdp, const SerialConfig *config) {
CORTEX_PRIORITY_MASK(STM32_SERIAL_UART5_PRIORITY));
}
#endif
+#if STM32_SERIAL_USE_USART6
+ if (&SD6 == sdp) {
+ rccEnableUSART6(FALSE);
+ NVICEnableVector(USART6_IRQn,
+ CORTEX_PRIORITY_MASK(STM32_SERIAL_USART6_PRIORITY));
+ }
+#endif
}
usart_init(sdp, config);
}
@@ -465,6 +506,13 @@ void sd_lld_stop(SerialDriver *sdp) {
return;
}
#endif
+#if STM32_SERIAL_USE_USART6
+ if (&SD6 == sdp) {
+ rccDisableUSART6(FALSE);
+ NVICDisableVector(USART6_IRQn);
+ return;
+ }
+#endif
}
}
diff --git a/os/hal/platforms/STM32/serial_lld.h b/os/hal/platforms/STM32/serial_lld.h
index ceeccff67..fdd168201 100644
--- a/os/hal/platforms/STM32/serial_lld.h
+++ b/os/hal/platforms/STM32/serial_lld.h
@@ -42,7 +42,7 @@
/**
* @brief USART1 driver enable switch.
* @details If set to @p TRUE the support for USART1 is included.
- * @note The default is @p FALSE.
+ * @note The default is @p TRUE.
*/
#if !defined(STM32_SERIAL_USE_USART1) || defined(__DOXYGEN__)
#define STM32_SERIAL_USE_USART1 TRUE
@@ -60,7 +60,7 @@
/**
* @brief USART3 driver enable switch.
* @details If set to @p TRUE the support for USART3 is included.
- * @note The default is @p FALSE.
+ * @note The default is @p TRUE.
*/
#if !defined(STM32_SERIAL_USE_USART3) || defined(__DOXYGEN__)
#define STM32_SERIAL_USE_USART3 TRUE
@@ -69,7 +69,7 @@
/**
* @brief UART4 driver enable switch.
* @details If set to @p TRUE the support for UART4 is included.
- * @note The default is @p FALSE.
+ * @note The default is @p TRUE.
*/
#if !defined(STM32_SERIAL_USE_UART4) || defined(__DOXYGEN__)
#define STM32_SERIAL_USE_UART4 TRUE
@@ -78,13 +78,22 @@
/**
* @brief UART5 driver enable switch.
* @details If set to @p TRUE the support for UART5 is included.
- * @note The default is @p FALSE.
+ * @note The default is @p TRUE.
*/
#if !defined(STM32_SERIAL_USE_UART5) || defined(__DOXYGEN__)
#define STM32_SERIAL_USE_UART5 TRUE
#endif
/**
+ * @brief USART6 driver enable switch.
+ * @details If set to @p TRUE the support for USART6 is included.
+ * @note The default is @p TRUE.
+ */
+#if !defined(STM32_SERIAL_USE_USART6) || defined(__DOXYGEN__)
+#define STM32_SERIAL_USE_USART6 TRUE
+#endif
+
+/**
* @brief USART1 interrupt priority level setting.
*/
#if !defined(STM32_SERIAL_USART1_PRIORITY) || defined(__DOXYGEN__)
@@ -119,6 +128,13 @@
#define STM32_SERIAL_UART5_PRIORITY 12
#endif
+/**
+ * @brief USART6 interrupt priority level setting.
+ */
+#if !defined(STM32_SERIAL_USART6_PRIORITY) || defined(__DOXYGEN__)
+#define STM32_SERIAL_USART6_PRIORITY 12
+#endif
+
/*===========================================================================*/
/* Derived constants and error checks. */
/*===========================================================================*/
@@ -143,9 +159,13 @@
#error "UART5 not present in the selected device"
#endif
+#if STM32_SERIAL_USE_USART6 && !STM32_HAS_USART6
+#error "USART6 not present in the selected device"
+#endif
+
#if !STM32_SERIAL_USE_USART1 && !STM32_SERIAL_USE_USART2 && \
!STM32_SERIAL_USE_USART3 && !STM32_SERIAL_USE_UART4 && \
- !STM32_SERIAL_USE_UART5
+ !STM32_SERIAL_USE_UART5 && !STM32_SERIAL_USE_USART6
#error "SERIAL driver activated but no USART/UART peripheral assigned"
#endif
@@ -230,6 +250,9 @@ extern SerialDriver SD4;
#if STM32_SERIAL_USE_UART5 && !defined(__DOXYGEN__)
extern SerialDriver SD5;
#endif
+#if STM32_SERIAL_USE_USART6 && !defined(__DOXYGEN__)
+extern SerialDriver SD6;
+#endif
#ifdef __cplusplus
extern "C" {
diff --git a/readme.txt b/readme.txt
index ffce54fea..d2180bc8a 100644
--- a/readme.txt
+++ b/readme.txt
@@ -74,11 +74,15 @@
*****************************************************************************
*** 2.3.4 ***
+- FIX: Fixed broken support for UART5 in STM32 serial driver (bug 3434094)
+ (backported to 2.2.8).
- FIX: Fixed broken TIM8 support in STM32 PWM driver (bug 3418620).
- FIX: Fixed halconf.h file corrupted in some STM32 demos (bug 3418626).
- NEW: Reorganized the STM32F1xx hal_lld_xxx.h files in order to distribute
the capability macros into the appropriate file (previously those were all
in the common hal_lld.h).
+- NEW: Added HAL support for the STM32F4xx sub-family.
+- NEW: Added handling of USART6 to the STM32 serial driver.
- NEW: Added USE_COPT setting to all makefiles, contributed by Mabl.
- NEW: Added EXT driver implementation for AT91SAM7x, contributed by Florian.
(TODO: Test application missing).
@@ -111,7 +115,7 @@
- FIX: Fixed uninitialized variable in STM32 PWM and ICU drivers (bug 3413558).
- FIX: Fixed wrong parameter passed to the DMA error hook in STM32 ADC driver,
the DMA error hook has been removed entirely in the new ADC driver model
- (bug 3413214)(to be fixed in 2.2.8).
+ (bug 3413214).
- FIX: The function chThdExit() triggers an error on shell return when the
system state checker is enabled (bug 3411207)(backported to 2.2.8).
- FIX: Some ARMCMx makefiles refer the file rules.mk in the ARM7 port (bug