4 years, 8 months ago.

Support for Nucleo F302


I am trying to use USBSerial on an ST Micro Nucleo F302R8 but the file USBEndPoints.h is looking for a preprocessor define of the form TARGET_STM32F4XX in order to include the correct endpoint definition file (see code snippet below). The F302 has, unsurprisingly, an STM32F302 MCU, which is not one of the supported architectures. I can figure out how to build the correct include file, but I am using the online compiler and cannot figure out how to create the define. I would deeply appreciate any advice on how to proceed.


if defined(TARGET_LPC1768) || defined(TARGET_LPC2368) || defined(TARGET_LPC4088) include "USBEndpoints_LPC17_LPC23.h" elif defined(TARGET_LPC11UXX) || defined(TARGET_LPC1347) || defined (TARGET_LPC11U6X) || defined (TARGET_LPC1549) include "USBEndpoints_LPC11U.h" elif defined(TARGET_KL25Z) | defined(TARGET_KL46Z) | defined(TARGET_K20D5M) | defined(TARGET_K64F) include "USBEndpoints_KL25Z.h" elif defined (TARGET_F302R8) include "USBEndpoints_STM32F4.h" elif defined (TARGET_STM32F3XX) include "USBEndpoints_STM32F4.h" else error "Unknown target type" endif

Question relating to:

Comment on this question

1 Answer

4 years, 2 months ago.

Hi, have you made any progress with this? I would also like to port the USB Device library for our new NZ32-ST1L boards (, which use a processor from the same family as the ST Nucleo L512RE. The USB registers for the STM32L151/152 and your STM32F302 seem identical. So, the code should be the same.

To post an answer, please log in.