Skip to content

Commit 34ea175

Browse files
committed
Merge pull request #1810 from adustm/fixserial_f3
[STM32F3] Use USART3_BASE instead of UART3_BASE
2 parents 486d7e8 + 955b928 commit 34ea175

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

hal/targets/hal/TARGET_STM/TARGET_STM32F3/TARGET_NUCLEO_F303K8/PeripheralNames.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ typedef enum {
4848

4949
typedef enum {
5050
UART_1 = (int)USART1_BASE,
51-
UART_2 = (int)USART2_BASE
51+
UART_2 = (int)USART2_BASE,
52+
UART_3 = (int)USART3_BASE // defined for compilation issue. UART3 is not present on STM32F303K8
5253
} UARTName;
5354

5455
#define STDIO_UART_TX PA_2

hal/targets/hal/TARGET_STM/TARGET_STM32F3/serial_api.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ void serial_init(serial_t *obj, PinName tx, PinName rx)
9494
__HAL_RCC_USART2_CONFIG(RCC_USART2CLKSOURCE_SYSCLK);
9595
obj->index = 1;
9696
}
97-
#if defined(UART3_BASE)
97+
#if defined(USART3_BASE)
9898
if (obj->uart == UART_3) {
9999
__USART3_CLK_ENABLE();
100100
__HAL_RCC_USART3_CONFIG(RCC_USART3CLKSOURCE_SYSCLK);
@@ -157,7 +157,7 @@ void serial_free(serial_t *obj)
157157
__USART2_RELEASE_RESET();
158158
__USART2_CLK_DISABLE();
159159
}
160-
#if defined(UART3_BASE)
160+
#if defined(USART3_BASE)
161161
if (obj->uart == UART_3) {
162162
__USART3_FORCE_RESET();
163163
__USART3_RELEASE_RESET();
@@ -252,7 +252,7 @@ static void uart2_irq(void)
252252
uart_irq(UART_2, 1);
253253
}
254254

255-
#if defined(UART3_BASE)
255+
#if defined(USART3_BASE)
256256
static void uart3_irq(void)
257257
{
258258
uart_irq(UART_3, 2);
@@ -296,7 +296,7 @@ void serial_irq_set(serial_t *obj, SerialIrq irq, uint32_t enable)
296296
vector = (uint32_t)&uart2_irq;
297297
}
298298

299-
#if defined(UART3_BASE)
299+
#if defined(USART3_BASE)
300300
if (obj->uart == UART_3) {
301301
irq_n = USART3_IRQn;
302302
vector = (uint32_t)&uart3_irq;

0 commit comments

Comments
 (0)