cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L151Cx: Update firmware using USB.

Khoo.B
Associate III
Posted on January 15, 2016 at 08:33

I have been using ST-Link to flash the firmware of STM32L151Cx. Now, I would like to add the feature of flashing the uC using USB. I have checked on the datasheet and knowing that if I set BOOT0 = 1 and BOOT1 = 0 and power cycle the module, it will get me to the System Memory Boot Mode. Then, I can use USB and DfuSe Demo to flash the firmware. My question is  - do I need to modify my code/firmware to have this feature? Or it will work without any modifications? 

7 REPLIES 7
highimpedance
Associate III
Posted on January 15, 2016 at 09:09

Hi,

Nowadays, I plan to do it with 32f103, too. From what I understand you don't have to flash your mcu. Embedded bootloader is already exist. I plan to use dfuse for first time program.

I couldnt see ''STM device in DFU mode'' at device manager it didnt work fine,yet. What about you?

Khoo.B
Associate III
Posted on January 16, 2016 at 17:01

Hi,

Thanks for the reply. I actually wanted to upload my user application firmware to the mcu via USB (by setting BOOT0 = 1 and BOOT1 = 0). Is that what you are trying to do too?

I tried to plug in my device to PC after setting the BOOT pins and power cycle the device. However, I couldn't get ''STM device in DFU mode''.

Do you think I would need to change my codes to get this worked?

Thanks.

Posted on January 16, 2016 at 17:09

The loader is in ROM, it is executing that code, your code is irrelevant.

Not all STM32 support USB and DFU mode. Check the documentation related to specific clocking requirements for the ROM.

You should perhaps explain your design in more detail.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Khoo.B
Associate III
Posted on January 17, 2016 at 08:57

Thanks. I would like to design my end product in such a way that the end user can update the firmware by using a normal USB (not USB to uart). According to data sheet and some other websites, I can do that by just setting the BOOT0 and BOOT1 pins and reset the device. 

I have checked the data sheet and the mcu that I'm using has the DFU feature. Also, I have my USB DP and DM pins connected to PA11 and PA12. I tried it with my win 7 PC but the PC just couldn't detect the device.

I just wonder if I have to modify my firmware so it can get this feature worked.

Khoo.B
Associate III
Posted on January 17, 2016 at 08:58

Khoo.B
Associate III
Posted on January 18, 2016 at 15:49

Any suggestions? I am quite new on this and it might not make any sense. Thank you.

highimpedance
Associate III
Posted on January 20, 2016 at 13:38

Hello,

Maybe you can try with different MCU even AN3156 document says your stm32L151 mcu  supports DFU bootloader. Maybe yours is not one of STM32L1xxxC, STM32L1xxxD, STM32L1xxxE.

http://www.st.com/web/en/resource/technical/document/application_note/CD00264379.pdf

 

I also realized that my stm32f103 mcu doesn't supports dfuse so I gave up.