mirror of https://github.com/ARMmbed/mbed-os.git
enable the additional uart 7&8 of the STM32F439
parent
0682571c5b
commit
1641dd7e8d
|
|
@ -53,7 +53,9 @@ typedef enum {
|
|||
UART_3 = (int)USART3_BASE,
|
||||
UART_4 = (int)UART4_BASE,
|
||||
UART_5 = (int)UART5_BASE,
|
||||
UART_6 = (int)USART6_BASE
|
||||
UART_6 = (int)USART6_BASE,
|
||||
UART_7 = (int)UART7_BASE,
|
||||
UART_8 = (int)UART8_BASE
|
||||
} UARTName;
|
||||
|
||||
#define STDIO_UART_TX PD_8
|
||||
|
|
|
|||
|
|
@ -133,12 +133,14 @@ const PinMap PinMap_PWM[] = {
|
|||
const PinMap PinMap_UART_TX[] = {
|
||||
{PA_9, UART_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)},
|
||||
{PD_8, UART_3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)},
|
||||
{PF_7, UART_7, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART7)},
|
||||
{NC, NC, 0}
|
||||
};
|
||||
|
||||
const PinMap PinMap_UART_RX[] = {
|
||||
{PA_10, UART_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)},
|
||||
{PD_9, UART_3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)},
|
||||
{PF_6, UART_7, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART7)},
|
||||
{NC, NC, 0}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -37,9 +37,9 @@
|
|||
#include <string.h>
|
||||
#include "PeripheralPins.h"
|
||||
|
||||
#define UART_NUM (6)
|
||||
#define UART_NUM (8)
|
||||
|
||||
static uint32_t serial_irq_ids[UART_NUM] = {0, 0, 0, 0, 0, 0};
|
||||
static uint32_t serial_irq_ids[UART_NUM] = {0, 0, 0, 0, 0, 0, 0, 0};
|
||||
|
||||
static uart_irq_handler irq_handler;
|
||||
|
||||
|
|
@ -111,6 +111,18 @@ void serial_init(serial_t *obj, PinName tx, PinName rx)
|
|||
__USART6_CLK_ENABLE();
|
||||
obj->index = 5;
|
||||
break;
|
||||
#if defined(UART7_BASE)
|
||||
case UART_7:
|
||||
__UART7_CLK_ENABLE();
|
||||
obj->index = 6;
|
||||
break;
|
||||
#endif
|
||||
#if defined(UART8_BASE)
|
||||
case UART_8:
|
||||
__UART8_CLK_ENABLE();
|
||||
obj->index = 7;
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Configure the UART pins
|
||||
|
|
@ -181,6 +193,20 @@ void serial_free(serial_t *obj)
|
|||
__USART6_RELEASE_RESET();
|
||||
__USART6_CLK_DISABLE();
|
||||
break;
|
||||
#if defined(UART7_BASE)
|
||||
case UART_7:
|
||||
__UART7_FORCE_RESET();
|
||||
__UART7_RELEASE_RESET();
|
||||
__UART7_CLK_DISABLE();
|
||||
break;
|
||||
#endif
|
||||
#if defined(UART8_BASE)
|
||||
case UART_8:
|
||||
__UART8_FORCE_RESET();
|
||||
__UART8_RELEASE_RESET();
|
||||
__UART8_CLK_DISABLE();
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
// Configure GPIOs
|
||||
pin_function(obj->pin_tx, STM_PIN_DATA(STM_MODE_INPUT, GPIO_NOPULL, 0));
|
||||
|
|
@ -281,6 +307,20 @@ static void uart6_irq(void)
|
|||
uart_irq(UART_6, 5);
|
||||
}
|
||||
|
||||
#if defined(UART7_BASE)
|
||||
static void uart7_irq(void)
|
||||
{
|
||||
uart_irq(UART_7, 6);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(UART8_BASE)
|
||||
static void uart8_irq(void)
|
||||
{
|
||||
uart_irq(UART_8, 7);
|
||||
}
|
||||
#endif
|
||||
|
||||
void serial_irq_handler(serial_t *obj, uart_irq_handler handler, uint32_t id)
|
||||
{
|
||||
irq_handler = handler;
|
||||
|
|
@ -326,6 +366,18 @@ void serial_irq_set(serial_t *obj, SerialIrq irq, uint32_t enable)
|
|||
irq_n = USART6_IRQn;
|
||||
vector = (uint32_t)&uart6_irq;
|
||||
break;
|
||||
#if defined(UART7_BASE)
|
||||
case UART_7:
|
||||
irq_n = UART7_IRQn;
|
||||
vector = (uint32_t)&uart7_irq;
|
||||
break;
|
||||
#endif
|
||||
#if defined(UART8_BASE)
|
||||
case UART_8:
|
||||
irq_n = UART8_IRQn;
|
||||
vector = (uint32_t)&uart8_irq;
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (enable) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue