2021-03-10 02:58 AM
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 !
2021-03-10 03:23 AM
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
2021-03-10 04:16 AM
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 ?
2021-03-10 04:21 AM
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
2021-03-10 04:25 AM
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 !
2021-03-17 03:47 AM
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