cancel
Showing results for 
Search instead for 
Did you mean: 

DFU driver (STTub30) causes a blue screen on windows 10?

MLovr
Associate II

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:

  • When USB is plugged in
  • When Upgrade button is pressed inside DfuSe demo

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 :)0693W000001pRikQAE.png0693W000001pRgPQAU.jpg

1 ACCEPTED SOLUTION

Accepted Solutions
MLovr
Associate II

[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:

  • For Eclipse Stm32 Workbench it does not generate a linker script, and I need to manually set the mcuId inside .xml file.
  • In my L0 project, it does not include SysTick_Handler inside the stm32l0xx_it.c, and the main program gets stuck in the Infinite loop
  • Also, in the usbd_conf.h file, it defines macro USBD_SUPPORT_USER_STRING_DESC, but it should be USBD_SUPPORT_USER_STRING

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 :)

View solution in original post

9 REPLIES 9
Pavel A.
Evangelist III

What is the version (properties-> details) and size of your \windows\system32\drivers\STTub30.sys ?

-- pa

MLovr
Associate II

0693W000001pUoRQAU.pngHi @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

Dear ST folks,

Can you investigate this Windows driver bug further with provided details?

@Amel NASRI​ @Imen DAHMEN​ 

regards,

-- pa

A Pica
Associate II

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 :\ )

  • STTube Driver:
    • Version 3.0.1.0
    • Product version: 3.0B
    • Date modified: 20/07/2012
  • STM32 DFU driver:
    • Version 3.0.4.0

It worked a couple of times and then just starts generating BSOD

MLovr
Associate II

@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).

@MLovr​ I've installed the bundled driver and seems to work again.

I'll post if I get any other problems.

Thank you!

MLovr
Associate II

@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.

Peeters.Bram
Senior

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

MLovr
Associate II

[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:

  • For Eclipse Stm32 Workbench it does not generate a linker script, and I need to manually set the mcuId inside .xml file.
  • In my L0 project, it does not include SysTick_Handler inside the stm32l0xx_it.c, and the main program gets stuck in the Infinite loop
  • Also, in the usbd_conf.h file, it defines macro USBD_SUPPORT_USER_STRING_DESC, but it should be USBD_SUPPORT_USER_STRING

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 :)