cancel
Showing results for 
Search instead for 
Did you mean: 

Does anyone have an example project using IAP with VCP?

Justin K.
Associate II
Posted on July 06, 2018 at 21:51

Hi everyone,

I'm trying to get IAP driver working on my STM32F072C8T6 with USB VCP. I saw an example code for STM32LX IAP projects with ymodem but I thought I would ask around first in case someone already has working code. In the meantime, I'll be trying to get the example code working with my MCU using USB VCP and update in the post if I do manage to get it to work in case someone needs the same functionality.

Thank you.

5 REPLIES 5
Posted on July 06, 2018 at 22:21

Presumably a VCP implemented on the F072, not the one on the ST-LINK? In which case you'd want to buffer the Rx and TX traffic and manage the Y-Modem/IAP within the while() loop.

I think the more common course is to use the USB DFU implementation on the STM32 and have that as a boot-loader. ie Where the Application isn't viable the loader drops into DFU mode.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on July 06, 2018 at 22:27

Ah, I see! So, for my case, I would go into USB DFU mode if the user pushes down on the button for firmware update and if not go into USB VCP mode.

I'll try that and thank you for the info.

Posted on July 06, 2018 at 23:31

\STM32Cube_FW_F0_V1.9.0\Projects\STM32F072B-Discovery\Applications\USB_Device\DFU_Standalone

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on July 09, 2018 at 07:02

Thanks Clive. I was able to get the DFU running but I believe I have ran into a wall. Later on in the project, I will need readout protection enabled but it doesn't look like DFU can be used with the protection feature. Have you came across the same issue?

Pavel A.
Evangelist III
Posted on July 09, 2018 at 21:35

Just today I&39ve made a simple update code on F072 based on CubeMX-generated CDC class.

After long time contemplating between DFU and virtual com port, preferred the latter, because ST&39s VCP works with in-box driver on Win10 and Linux (yes, used

https://community.st.com/0D50X00009XkYSESA3

 - thanks!) and for DFU extra steps are needed to install a driver.

Once you have a COM port you can use any free terminal program that supports Xmodem and so on. Preparation of binary file is simple. For DFU you need a special app and preparation of .dfu file is more complicated. I use the simplest brain dead variant of Xmodem, the firmware file is < 50K, works good enough.

Sorry, cannot share the project, the code is too dirty to show yet.

But basically - as Clive wrote - it takes to buffer one Xmodem packet ( ~ 132 bytes ). Then the sender will stop and wait for ACK, then you have a lot of time for flashing the data and other chores. Repeat until all done.

- pa