2017-07-27 10:56 PM
Greetings,
I am rolling my own USBD DFU bootloader for an STM32F427. I have a CubeMX project reading and writing to Internal Flash. Now I need to expose the OTP memory region, similar to the System Memory USBD DFU bootloader.
I had to roll my own because the System Memory USBD DFU initializes GPIO to states that are unacceptable for me at startup.
When I change &sharpdefine
USBD_DFU_MAX_ITF_NUM to 4, I get four entries in the PC-side DFU utility, but they are all named the same thing. I cannot seem to figure out how to add additional descriptions to the subsequent 'Alternate' memory regions.
Cheers,
Joe
#dfu #dfu-bootloader #usb-bootloader #usbdfubootloader #usb2017-07-28 07:46 AM
Dear
Gorse.Joseph
,You need to change and update your string descriptor as explained in the DFU Manual to export a new region , here OTP region or another external Memory. see our Examples in IAP mode provided inbox.
Cheers,
STOne-
2017-08-11 12:04 AM
THIS IS MY EXAMPLE:
/* DFU Class Config */
#define USBD_DFU_MAX_ITF_NUM 2//1
#if (USBD_SUPPORT_USER_STRING == 1)
#define FLASH_DESC_STR1 '@Internal Flash /0x08000000/120*128 a,1416*128 g'#define FLASH_DESC_STR2 '@Dollar Flash /0x00000000/120*4096 a,512*4096 g'static uint8_t* USBD_DFU_GetUsrStringDesc (USBD_HandleTypeDef *pdev, uint8_t index , uint16_t *length)
{ static uint8_t USBD_StrDesc[255]; /* Check if the requested string interface is supported */ if (index <= (USBD_IDX_INTERFACE_STR + USBD_DFU_MAX_ITF_NUM)) {//USBD_GetString ((uint8_t *)((USBD_DFU_MediaTypeDef *)pdev->pUserData)->pStrDesc, USBD_StrDesc, length);
if(index==(USBD_IDX_INTERFACE_STR + 1))
USBD_GetString ((uint8_t *)FLASH_DESC_STR1, USBD_StrDesc, length);
else
USBD_GetString ((uint8_t *)FLASH_DESC_STR2, USBD_StrDesc, length);
return USBD_StrDesc; } /* Not supported Interface Descriptor index */ else { return NULL; }}#endif2017-08-14 09:33 AM
Hi,
You can use our demonstrations examples as a starting point and then you can customize with different Alternates.
By the way in your string descriptor, do not forget to add the Units : Bytes, Kbytes, Mbytes etc. in this way :
''@Internal Flash /0x08000000/120*128 a,1416*128 g'' MUST be
''@Internal Flash /0x08000000/120*128Ba,1416*128Bg'' B to mean Bytes and a '' Readable here is the definition in
.Page 71/72
Cheers,
STOne-32.