cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L496: Unable to go in DFU when use HAL_SPI_Transmit_DMA

M4R10
Associate III

Hello guys,

I'm not new using DFU but I have this strange problem.

When I try to jump in DFU from my code, I get an "Unknown usb device" from my PC.

I have also 2 push button in my board. Reset and DFU pin (keep PH3 high ).

If I keep pressed DFU button and then pressing Reset it fall in the same state (Unknown device).

If I keep pressed DFU button and plug the usb (I get the power from usb) it works.

Investigating I discovered that commenting this line

HAL_SPI_Transmit_DMA(&hspi1,(uint8_t *)bProgADC,sizeof(bProgADC));

DFU works in every case.

What is very strange is that resetting MCU while keep pressed DFU button is not enough, I must cut the power and plug the usb cable while pressing DFU button to go in DFU.

While commenting that SPI line everything is fine

How HAL_SPI_Transmit_DMA can cause this?

How can I fix it?

Thanks in advance

--

Mario

2 REPLIES 2
TDK
Guru

Does your program use the USB at all? Are any other bootloader peripherals active during reset, possibly the SPI? What exactly does the DFU button do?

If you feel a post has answered your question, please click "Accept as Solution".
M4R10
Associate III

My program use USB. It is configured as VCP

Bootloader peripheral are USB, USART1 and SPI1. When I jump to DFU from code I tried to stop/disable everything but still the same issue.

DFU button link PH3 to VCC. Pushbuttons are working, I checked with oscilloscope.