‎2020-05-26 08:07 AM
Hi,
I'm using STM32L072KZT6 microcontroller, and I'm trying to make USB DFU Standalone bootloader. I've done many bootloader standalone firmwares for STM32 MCUs, for F0, F1, F3, F4 series, and had never encountered this kind of a problem. It's not deterministic, I've succeeded couple of times to write my firmware via DfuSe, and successfully run the main program, but in most cases it fails. Windows does not complain about the driver when the USB is plugged in, when I try to update it, it says that I'm already using the newest version.
The problem appears in the following moments:
I've tried different solutions, running DfuSe from STM32L folder, but nothing helped. My firmware is almost the same as an example for 32L0538DISCOVERY inside Cube L0 repository, and I'm using the latest version of L0 Cube firmware (V1.11.2). I've attached some pictures of the error message, driver version, and .zip file of my CubeIDE project.
Hope you can help me :)
Solved! Go to Solution.
‎2020-07-01 09:28 AM
[UPDATE]:
I've bought the STM32L0538-Discovery board and I've successfully implemented the DFU-Standalone example.
There was a little bug inside the example, the flash string and erase method are not matched. From the flash string, the flash memory is divided into 1Kb sectors and the erase method erases only 1 page (128b, not 1024b). The result is the DfuSe demo waits indefinitely for the write operation. To fix this I've corrected the erase method to erase 8 pages which are equal to 1024b.
Secondly, I've managed to solve my issue with CubeMX v4. In CubeMX v5 I've noticed some problems:
Obviously, there are more problems which I didn't catch, because when I've fixed those I mentioned above, I get the same result (blue screen). Those problems are not a big deal, but they've consumed a lot of my time.
I will mark this topic as "closed", but you must correct those issues with CubeMX v5. Till then, I'm using v4 :)
‎2020-05-26 08:45 AM
What is the version (properties-> details) and size of your \windows\system32\drivers\STTub30.sys ?
-- pa
‎2020-05-26 10:23 AM
Hi @Pavel A.​ thanks for your quick answer, the details of my STTub30 are in the attached picture. I've installed the driver from C:\Program Files (x86)\STMicroelectronics\Software\DfuSe v3.0.6\Bin\Driver\Win10
‎2020-06-01 03:55 PM
Dear ST folks,
Can you investigate this Windows driver bug further with provided details?
@Amel NASRI​ @Imen DAHMEN​
regards,
-- pa
‎2020-06-06 03:30 AM
I'm facing the same problem here with DFU3.0.6 but with an older driver version (not sure from where I got this specific driver version :\ )
It worked a couple of times and then just starts generating BSOD
‎2020-06-08 08:24 AM
@Community member​ You can install the latest driver version from path I've posted above (C:\Program Files (x86)\STMicroelectronics\Software\DfuSe v3.0.6\Bin\Driver\Win10) but you need to install DfuSe v3.0.6 from ST official web site.
Do you have problems with STM32L series? I've already had some similar problems with STM32L1 couple of years ago, but without blue screen, just "Bad firmware" error inside DfuSe software. I've solved it with a 2-line fix inside dfu class driver :
/**
* @brief DFU_GetStatus
* Handles the DFU GETSTATUS request.
* @param pdev: instance
* @retval status
*/
static void DFU_GetStatus(USBD_HandleTypeDef *pdev)
{
USBD_DFU_HandleTypeDef *hdfu;
hdfu = (USBD_DFU_HandleTypeDef*) pdev->pClassData;
//todo: fix
if(hdfu->dev_state == 0)
hdfu->dev_state = 3;
...........
With these two lines of code (14 and 15), the bootloader was slow, but it worked, and never show a "Bad firmware" error. I didn't have too much time to analyze the DFU protocol and at that time I've found this fix satisfying.
With L0 microcontroller I got "Bad firmware" error a couple of times, but it's rare. The only obvious thing is when I raised clock frequency from 16 to 32Mhz (max) the blue screen rarely happened on the USB plugin event (on 16Mhz clock it happened all the time).
‎2020-06-08 12:32 PM
@MLovr​ I've installed the bundled driver and seems to work again.
I'll post if I get any other problems.
Thank you!
‎2020-06-16 08:17 AM
@Amel NASRI​ @Imen DAHMEN​ Do you have any suggestions regarding this question? Definitely, it's a bug in the driver, because of the blue screen, but I'm suspecting on the stm32l1 because with the F series I don't have any problems. It's not happening on my computer only, I've tried this on multiple computers with the same result. It's hard for me to debug this, the blue screen appears all the time and it's frustrating. It would be better if you have any idea what the cause of the problem is, just to save my time. If it's a driver, I'll wait till next release, if you doubt on the MCU I'll buy an stm32l0538-discovery board just to try CubeMX DFU Standalone example.
‎2020-06-25 06:38 AM
Is anyone looking into this ?
I just had the same problem with a STM32F429.... (so far for the F series not having any problems).
For me the stopcode was : SYSTEM_SERVICE_EXCEPTION (also STTub30.sys)
(and I took my screenshot at 40% :squinting_face_with_tongue: )
EDIT: seems I have an older SSTube driver btw, mine is File version 3.0.1.0, Product version 3.0B, Date: 2012-17-20 22:32
‎2020-07-01 09:28 AM
[UPDATE]:
I've bought the STM32L0538-Discovery board and I've successfully implemented the DFU-Standalone example.
There was a little bug inside the example, the flash string and erase method are not matched. From the flash string, the flash memory is divided into 1Kb sectors and the erase method erases only 1 page (128b, not 1024b). The result is the DfuSe demo waits indefinitely for the write operation. To fix this I've corrected the erase method to erase 8 pages which are equal to 1024b.
Secondly, I've managed to solve my issue with CubeMX v4. In CubeMX v5 I've noticed some problems:
Obviously, there are more problems which I didn't catch, because when I've fixed those I mentioned above, I get the same result (blue screen). Those problems are not a big deal, but they've consumed a lot of my time.
I will mark this topic as "closed", but you must correct those issues with CubeMX v5. Till then, I'm using v4 :)