cancel
Showing results for 
Search instead for 
Did you mean: 

Exchange data between microcontroller / C# programm and flash with same connection

KMiko.1
Associate III

Hi,

I have a question about STM32G4. I want to exchange data between microcontroller and a C# programm (by usb) on windows. But, sometimes I want to upgrade the program in the microcontroller with this same connection (usb)

How I can do this ? I need to integrate STLINK to the board and exchange data with it ?

Thanks !

5 REPLIES 5
KnarfB
Principal III

For flash updates in-the-field, you can use USB DFU protocol and don't need ST-LINK. This can be done in addition to "normal" USB function like CDC (serial port), MSC and so on. If you also want to be able to debug or update your devices in the lab, you may attach pins/header for ST-LINK interface as well, like for the ST-LINK V3 SET or MINI.

hth

KnarfB

KMiko.1
Associate III

Ok so, If I understand I add to my board the st link interface, I can send data (hex) via USB with normal USB function (CDC) and if i want to update via windows terminak I can also ?

DFU, CDC or MSC methods just require a USB connection to the STM32 and USB Device implementation on the Target.

An ST-LINK is only needed for debug connectivity and perhaps initial production programming ​

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Oh great ! So, i flash my program with an stlink for the first time and after I use an USB connection for exchange data (CDC) and update firmware (DFU) ?

What I need to do this ? I'm searching for CDC function for exchange data, but for the DFU update ? I can do this with terminal command and just the firmware file ?

thanks !

Igor Cesko
ST Employee

Hello KMiko.1 (Community Member),

The device contains embedded bootloader which can be used on each device to write firmware to the Flash. Embedded bootloader can use various interfaces to connect to device: USB, USART, SPI, I2C. To activate the bootloader - there depends from BOOT0, BOOT1 option bytes (see reference manual RM0440) and then restart the device. And please read application note about STM32 bootloaders: AN2606.

Regards

Igor