I’ve built a custom PCB board using the STM32F103VG. The board has been debugged and is working from a hardware point of view.
I’ve attached the platformio.ini file below, along with the USB upload errors.
The issue I’m having is I am unable to upload code to it via the USB port (dfu or serial), I have to use the STLink. However the USB interface is working as I can use it to debug the board and I can see Serial.print(" text…"); via terminal on it.
From what I understand platformio uploads a bootloader to it over the stlink interface so there is no need to download the bootloader from STM. or bother about the boot0 or boot1. At least that’s what happened with the bluepill I originally tested. However, I have tested the STM bootloader and it didn’t work either. I have also tried a variation of the BOOT jumpers.
I’m now thinking the “VG” version of this MCU is classed as XL-density and I’m not sure if the memory areas are mapped differently causing some issues in USB interface on platformio.
The usb port does show up as a com port on the PC
[env:genericSTM32F103VG] platform = ststm32 board = genericSTM32F103VG framework = arduino board_build.mcu = stm32f103vg board_build.f_cpu = 72000000L ;upload_protocol = stlink upload_port = COM3 upload_protocol = serial build_flags = -w -D PIO_FRAMEWORK_ARDUINO_ENABLE_CDC -D USBCON -D USBD_VID=0x0483 -D USBD_PID=0x5740 ;-D USB_MANUFACTURER="Unknown" -D USB_PRODUCT="\"BLUEPILL_F103C8\"" -D HAL_PCD_MODULE_ENABLED -D ENABLE_HWSERIAL1 -D ENABLE_HWSERIAL2
Response when trying to upload via USB / Serial
CURRENT: upload_protocol = serial Looking for upload port... Use manually specified: COM3 Uploading .pio\build\genericSTM32F103VG\firmware.bin stm32flash 0.4 Failed to init device. http://stm32flash.googlecode.com/ Using Parser : Raw BINARY Interface serial_w32: 115200 8E1 *** [upload] Error 1
Response when trying to upload via USB / dfu
Use manually specified: COM3 Uploading .pio\build\genericSTM32F103VG\firmware.bin maple_loader v0.1 Resetting to bootloader via DTR pulse Searching for DFU device [0483:DF11]... dfu-util - (C) 2007-2008 by OpenMoko Inc. Couldn't find the DFU device: [0483:DF11]