diff --git a/ports/stm32f4/boards/stm32f411ve_discovery/mpconfigboard.mk b/ports/stm32f4/boards/stm32f411ve_discovery/mpconfigboard.mk index aa867c96f8..bbc2a4a049 100644 --- a/ports/stm32f4/boards/stm32f411ve_discovery/mpconfigboard.mk +++ b/ports/stm32f4/boards/stm32f411ve_discovery/mpconfigboard.mk @@ -1,7 +1,7 @@ USB_VID = 0x239A USB_PID = 0x802A USB_PRODUCT = "STM32F411VE Discovery Board - CPy" -USB_MANUFACTURER = "Adafruit Industries LLC" +USB_MANUFACTURER = "STMicroelectronics" USB_REDUCED_ENDPOINT = 1 INTERNAL_FLASH_FILESYSTEM = 1 diff --git a/ports/stm32f4/common-hal/microcontroller/Processor.c b/ports/stm32f4/common-hal/microcontroller/Processor.c index c59c340c09..7117945b39 100644 --- a/ports/stm32f4/common-hal/microcontroller/Processor.c +++ b/ports/stm32f4/common-hal/microcontroller/Processor.c @@ -28,17 +28,20 @@ #include "py/runtime.h" #include "supervisor/shared/translate.h" +#include "stm32f4xx_hal.h" + +#define STM32_UUID ((uint32_t *)0x1FFF7A10) float common_hal_mcu_processor_get_temperature(void) { return 0; } uint32_t common_hal_mcu_processor_get_frequency(void) { - return 64000000ul; + return SystemCoreClock; } void common_hal_mcu_processor_get_uid(uint8_t raw_id[]) { - for (int i=0; i<2; i++) { - ((uint32_t*) raw_id)[i] = 0; + for (int i=0; i<3; i++) { + ((uint32_t*) raw_id)[i] = STM32_UUID[i]; } } diff --git a/ports/stm32f4/common-hal/microcontroller/Processor.h b/ports/stm32f4/common-hal/microcontroller/Processor.h index c3ca4efd59..311333e7de 100644 --- a/ports/stm32f4/common-hal/microcontroller/Processor.h +++ b/ports/stm32f4/common-hal/microcontroller/Processor.h @@ -27,7 +27,7 @@ #ifndef MICROPY_INCLUDED_STM32F4_COMMON_HAL_MICROCONTROLLER_PROCESSOR_H #define MICROPY_INCLUDED_STM32F4_COMMON_HAL_MICROCONTROLLER_PROCESSOR_H -#define COMMON_HAL_MCU_PROCESSOR_UID_LENGTH 8 +#define COMMON_HAL_MCU_PROCESSOR_UID_LENGTH 12 #include "py/obj.h" diff --git a/ports/stm32f4/mpconfigport.mk b/ports/stm32f4/mpconfigport.mk index 78c8e76300..3a8e6acc6f 100644 --- a/ports/stm32f4/mpconfigport.mk +++ b/ports/stm32f4/mpconfigport.mk @@ -7,7 +7,7 @@ MPY_TOOL_LONGINT_IMPL = -mlongint-impl=mpz INTERNAL_LIBM = 1 # Chip supplied serial number, in bytes -USB_SERIAL_NUMBER_LENGTH = 16 +USB_SERIAL_NUMBER_LENGTH = 24 # Longints can be implemented as mpz, as longlong, or not LONGINT_IMPL = MPZ diff --git a/supervisor/shared/usb/usb.c b/supervisor/shared/usb/usb.c index cfb39d4bb5..b0880b1b62 100644 --- a/supervisor/shared/usb/usb.c +++ b/supervisor/shared/usb/usb.c @@ -34,7 +34,6 @@ #include "tusb.h" -#define COMMON_HAL_MCU_PROCESSOR_UID_LENGTH 8 // Serial number as hex characters. This writes directly to the USB // descriptor. @@ -43,7 +42,7 @@ extern uint16_t usb_serial_number[1 + COMMON_HAL_MCU_PROCESSOR_UID_LENGTH * 2]; void load_serial_number(void) { // create serial number based on device unique id uint8_t raw_id[COMMON_HAL_MCU_PROCESSOR_UID_LENGTH]; - //common_hal_mcu_processor_get_uid(raw_id); + common_hal_mcu_processor_get_uid(raw_id); for (int i=0; i<2; i++) { ((uint32_t*) raw_id)[i] = 0; }