Skip to content

Commit a18ac84

Browse files
committed
Add support for STM32WB mcu
1 parent 2bef441 commit a18ac84

File tree

4 files changed

+20
-1
lines changed

4 files changed

+20
-1
lines changed

src/common/tusb_mcu.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,9 @@
184184
#define TUP_DCD_ENDPOINT_MAX 8
185185
#endif
186186

187+
#elif TU_CHECK_MCU(OPT_MCU_STM32WB)
188+
#define TUP_DCD_ENDPOINT_MAX 8
189+
187190
//------------- Sony -------------//
188191
#elif TU_CHECK_MCU(OPT_MCU_CXD56)
189192
#define TUP_DCD_ENDPOINT_MAX 7

src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@
110110
#endif
111111

112112
#if CFG_TUD_ENABLED && \
113-
( TU_CHECK_MCU(OPT_MCU_STM32F0, OPT_MCU_STM32F3, OPT_MCU_STM32L0, OPT_MCU_STM32L1, OPT_MCU_STM32G4) || \
113+
( TU_CHECK_MCU(OPT_MCU_STM32F0, OPT_MCU_STM32F3, OPT_MCU_STM32L0, OPT_MCU_STM32L1, OPT_MCU_STM32G4, OPT_MCU_STM32WB) || \
114114
(TU_CHECK_MCU(OPT_MCU_STM32F1) && defined(STM32F1_FSDEV)) \
115115
)
116116

@@ -328,6 +328,10 @@ void dcd_int_enable (uint8_t rhport)
328328
NVIC_EnableIRQ(USB_LP_IRQn);
329329
NVIC_EnableIRQ(USBWakeUp_IRQn);
330330

331+
#elif CFG_TUSB_MCU == OPT_MCU_STM32WB
332+
NVIC_EnableIRQ(USB_HP_IRQn);
333+
NVIC_EnableIRQ(USB_LP_IRQn);
334+
331335
#else
332336
#error Unknown arch in USB driver
333337
#endif
@@ -370,6 +374,10 @@ void dcd_int_disable(uint8_t rhport)
370374
NVIC_DisableIRQ(USB_LP_IRQn);
371375
NVIC_DisableIRQ(USBWakeUp_IRQn);
372376

377+
#elif CFG_TUSB_MCU == OPT_MCU_STM32WB
378+
NVIC_DisableIRQ(USB_HP_IRQn);
379+
NVIC_DisableIRQ(USB_LP_IRQn);
380+
373381
#else
374382
#error Unknown arch in USB driver
375383
#endif

src/portable/st/stm32_fsdev/dcd_stm32_fsdev_pvt_st.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,13 @@
9191
#include "stm32g4xx.h"
9292
#define PMA_LENGTH (1024u)
9393

94+
#elif CFG_TUSB_MCU == OPT_MCU_STM32WB
95+
#include "stm32wbxx.h"
96+
#define PMA_LENGTH (1024u)
97+
/* ST provided header has incorrect value */
98+
#undef USB_PMAADDR
99+
#define USB_PMAADDR USB1_PMAADDR
100+
94101
#else
95102
#error You are using an untested or unimplemented STM32 variant. Please update the driver.
96103
// This includes L1x0, L1x1, L1x2, L4x2 and L4x3, G1x1, G1x3, and G1x4

src/tusb_option.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
#define OPT_MCU_STM32L4 309 ///< ST L4
8181
#define OPT_MCU_STM32G0 310 ///< ST G0
8282
#define OPT_MCU_STM32G4 311 ///< ST G4
83+
#define OPT_MCU_STM32WB 312 ///< ST WB
8384

8485
// Sony
8586
#define OPT_MCU_CXD56 400 ///< SONY CXD56

0 commit comments

Comments
 (0)