SIGNALDuino auf Maple Mini - Portierung auf PlatformIO

Begonnen von juergs, 23 März 2020, 15:48:42

Vorheriges Thema - Nächstes Thema

juergs

#1
Da es noch nichts Konkretes, gibt bin ich auf Versuche mit Trial&Error um die Arduino-Settings einzubauen angewiesen:

Meine platformio.ini-Datei zum Testen für die ersten Versuche:

; PlatformIO Project Configuration File
;
;   Build options: build flags, source filter
;   Upload options: custom upload port, speed and extra flags
;   Library options: dependencies, extra library storages
;   Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

[env:maple_mini_origin]
platform = ststm32
board = maple_mini_origin
framework = arduino

; change microcontroller
board_build.mcu = stm32f103cbt6

; change MCU frequency
board_build.f_cpu = 72000000L


;lib_extra_dirs = ~/Documents/Arduino/libraries
;lib_extra_dirs = C:/Users/js
;/Documents/PlatformIO/Projects/MapleSDuino/src/_micro-api\libraries
lib_deps =
   

upload_port     = COM17
monitor_speed   = 115200
debug_port      = COM17

build_flags =
    -D PIO_FRAMEWORK_ARDUINO_ENABLE_CDC
    -D PIO_FRAMEWORK_ARDUINO_NANOLIB_FLOAT_PRINTF
    -D PIO_FRAMEWORK_ARDUINO_USB_HIGHSPEED_FULLMODE
;=================================================================================================
;--- Anpassung an STMDuino für MapleSDuino 
;PIO_FRAMEWORK_ARDUINO_ENABLE_CDC CDC (generic Serial supersede U(S)ART)
;PIO_FRAMEWORK_ARDUINO_ENABLE_CDC_WITHOUT_SERIAL CDC (no generic Serial)
; PIO_FRAMEWORK_ARDUINO_ENABLE_HID HID (keyboard and mouse)
;-- see https://docs.platformio.org/en/latest/platforms/ststm32.html#configuration
;platformio run --target env:maple_mini_as_generic_stmf1_series
[env:maple_mini_as_generic_stmf1_series]
platform = ststm32
board = genericSTM32F103C8
framework = arduino
board_build.mcu = stm32f103cbt6
board_build.core = maple
build_flags =
    -D PIO_FRAMEWORK_ARDUINO_ENABLE_CDC
    -D PIO_FRAMEWORK_ARDUINO_NANOLIB_FLOAT_PRINTF
    -D PIO_FRAMEWORK_ARDUINO_USB_HIGHSPEED_FULLMODE
    -D ENABLE_USB_SERIAL


;=================================================================================================
; build_flags = -L/C:/Users/js/Documents/PlatformIO/Projects/190901-123302-nodemcuv2/lib/ -lalgobsec
;https://docs.platformio.org/en/latest/projectconf/section_env_build.html#built-in-variables

[env:bluepill_f103c8]
platform = ststm32
board = bluepill_f103c8
framework = arduino
upload_protocol = hid
upload_port = 99

;https://docs.platformio.org/en/latest/platforms/ststm32.html#configuration
build_flags =
    -D PIO_FRAMEWORK_ARDUINO_ENABLE_CDC
    -D USBCON
    -D USBD_VID=0x0483
    -D USB_MANUFACTURER="Unknown"
    -D USB_PRODUCT=""BLUEPILL_F103C8""
    -D HAL_PCD_MODULE_ENABLED


;https://docs.platformio.org/en/latest/boards/ststm32/genericSTM32F103C8.html#board-ststm32-genericstm32f103c8
[env:genericSTM32F103C8]
platform = ststm32
board = genericSTM32F103C8

; change microcontroller
board_build.mcu = stm32f103c8t6

; change MCU frequency
board_build.f_cpu = 72000000L



Um die verschiedenen Environments aufzurufen geht man in die "PlatformIo CLI Console" und gibt "pio run -e <env-name> ein.


Run für Environment: maple_mini_as_generic_stmf1_series:
:\Users\js\Documents\PlatformIO\Projects\MapleSDuino>pio run -e maple_mini_as_generic_stmf1_series
Processing maple_mini_as_generic_stmf1_series (platform: ststm32; board: genericSTM32F103C8; framework: arduino)
-----------------------------------------------------------------------------------------------------------------------------------------------
PackageManager: Installing framework-arduinoststm32-maple @ ~1.10000.190516
Downloading  [####################################]  100%
Unpacking  [####################################]  100%
framework-arduinoststm32-maple @ 1.10000.190819 has been successfully installed!
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/genericSTM32F103C8.html
PLATFORM: ST STM32 6.0.0 > STM32F103C8 (20k RAM. 64k Flash)
HARDWARE: STM32F103CBT6 72MHz, 20KB RAM, 64KB Flash
DEBUG: Current (blackmagic) External (blackmagic, jlink, stlink)
PACKAGES:
- framework-arduinoststm32-maple 1.10000.190819 (1.0.0)
- toolchain-gccarmnoneeabi 1.70201.0 (7.2.1)
Converting SIGNALDuino.ino
...


Man bemerke:

PackageManager: Installing framework-arduinoststm32-maple @ ~1.10000.190516
Downloading  [####################################]  100%
Unpacking  [####################################]  100%
framework-arduinoststm32-maple @ 1.10000.190819 has been successfully installed!

Ergebnis für Environment: maple_mini_as_generic_stmf1_series:
*** [.pio\build\maple_mini_as_generic_stmf1_series\liba32\signalDecoder\signalDecoder4.cpp.o] Error 1
============================================================================================================================== [FAILED] Took 3.49 seconds ==============================================================================================================================

Environment                         Status    Duration
----------------------------------  --------  ------------
maple_mini_origin                   IGNORED
maple_mini_as_generic_stmf1_series  FAILED    00:00:03.489
bluepill_f103c8                     IGNORED
genericSTM32F103C8                  IGNORED
======================================================================================================================== 1 failed, 0 succeeded in 00:00:03.489 ======================================================================================================================== 


Aber für maple_mini_origin:
============================================================================================================================= [SUCCESS] Took 7.73 seconds ============================================================================================================================= 

Environment                         Status    Duration
----------------------------------  --------  ------------
maple_mini_origin                   SUCCESS   00:00:07.729
maple_mini_as_generic_stmf1_series  IGNORED
bluepill_f103c8                     IGNORED
genericSTM32F103C8                  IGNORED
============================================================================================================================= 1 succeeded in 00:00:07.729 ============================================================================================================================= 


Änderungen:
Wohl durch PackageManager: Installing framework-arduinoststm32-maple @ ~1.10000.190516
war plötzlich Timer1 ein Problem => lib als zip gesichert und aus dem Lib-Verzeichnis gelöscht (Eventuel über Namespace wieder aktivierbar).


Offensichtlich läuft der Compile mit unterschiedlichem Erfolg durch ....   



juergs

#2
Auch steht die Upload-Frage noch im Raum:

Diesen HID-BL: https://github.com/Serasidis/STM32_HID_Bootloader/releases habe ich mit dem BluePill-Board ausprobiert.
Arduino erkennt den HID-Modus:

Arduino noch Ohne Patch: "C:\Program Files (x86)\Arduino\hardware\Arduino_STM32\tools\win\hid-flash.exe" =>  HID-Flash v2.1 (Original)

ZitatC:\Users\js>C:\Users\js\Documents\Arduino\hardware\Arduino_STM32/tools/win/maple_upload.bat COM17 1 1EAF:0003 C:\Users\js\Documents\PlatformIO\Projects\MapleSDuino\.pio\build\maple_mini_origin\firmware.bin
maple_loader v0.1
Resetting to bootloader via DTR pulse
Reset via USB Serial Failed! Did you select the right serial port?
Assuming the board is in perpetual bootloader mode and continuing to attempt dfu programming...

Searching for DFU device [1EAF:0003]...
Found it!

Opening USB Device 0x1eaf:0x0003...
Found Runtime: [0x1eaf:0x0003] devnum=1, cfg=0, intf=0, alt=1, name="STM32duino bootloader v1.0  Upload to Flash 0x8005000"
Setting Configuration 1...
Claiming USB DFU Interface...
Setting Alternate Setting ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
Transfer Size = 0x0400
bytes_per_hash=1158
Starting download: [##################################################] finished!
error resetting after download: usb_reset: could not reset device, win error: Ein nicht vorhandenes Gerät wurde angegeben.
state(8) = dfuMANIFEST-WAIT-RESET, status(0) = No error condition is present

Done!

Resetting USB to switch back to runtime mode
timeout waiting for COM17 serial
C:\Users\js\Documents\Arduino\hardware\Arduino_STM32\tools\win>
Driverless USB HID bootloader and flashing tool for STM32F10X devices:
Zitat
------------------------------------------------------------------------+
|         HID-Flash v2.1 - STM32 HID Bootloader Flash Tool               |
|     (c)      2018 - Bruno Freitas      - http://www.brunofreitas.com/  |
|     (c) 2018-2019 - Vassilis Serasidis - https://www.serasidis.gr/     |
|   Customized for STM32duino ecosystem  - https://www.stm32duino.com/   |
+------------------------------------------------------------------------+

> Trying to open the comport...
> unable to open comport
> Searching for 1209:BEBA HID device...
#
> 1209:BEBA device is found !
> Sending <reset pages> command...
> Flashing firmware...
. 1024 Bytes
. 2048 Bytes
. 3072 Bytes
. 4096 Bytes
. 5120 Bytes
. 6144 Bytes
. 7168 Bytes
. 8192 Bytes
. 9216 Bytes
. 10240 Bytes
. 11264 Bytes
. 12288 Bytes
. 13312 Bytes
. 14336 Bytes
. 15360 Bytes
. 16384 Bytes

> Done!
> Sending <reboot mcu> command...
> Error while sending <reboot mcu> command.

Scheint aber noch instabil zu sein oder mein USB-Kabel ist an der Grenze ...
Denn ein Upload von MapleSDuino.bin funktioniert nicht ...



juergs

#3
Hier die "normale" Variante mit Std-Bootloader auf das BluePill-Board:

Zitat:\Users\js\Documents\Arduino\hardware\Arduino_STM32/tools/win/maple_upload.bat COM17 2 1EAF:0003 C:\Users\js\AppData\Local\Temp\arduino_build_525840/Blink_BluePill.ino.bin
maple_loader v0.1
Resetting to bootloader via DTR pulse
Reset via USB Serial Failed! Did you select the right serial port?
Searching for DFU device [1EAF:0003]...
Assuming the board is in perpetual bootloader mode and continuing to attempt dfu programming...

Found it!

Opening USB Device 0x1eaf:0x0003...
Found Runtime: [0x1eaf:0x0003] devnum=1, cfg=0, intf=0, alt=2, name="STM32duino bootloader v1.0  Upload to Flash 0x8002000"
Setting Configuration 1...
Claiming USB DFU Interface...
Setting Alternate Setting ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
Transfer Size = 0x0400
bytes_per_hash=310
Starting download: [##################################################] finished!
state(8) = dfuMANIFEST-WAIT-RESET, status(0) = No error condition is present
Done!
error resetting after download: usb_reset: could not reset device, win error: Ein nicht vorhandenes Gerät wurde angegeben.


juergs

#4
STLink geht jetzt auch ...

C:\Users\js\Documents\Arduino\hardware\Arduino_STM32\tools\win>stlink\ST-LINK_CLI.exe -c SWD -P C:\Users\js\AppData\Local\Temp\arduino_build_525840\Blink_BluePill.ino.bin 0x8000000 -Rst -Run -NoPrompt
STM32 ST-LINK CLI v3.3.0.0
STM32 ST-LINK Command Line Interface

ST-LINK SN: 49FF6D065070495241201087
ST-LINK Firmware version: V2J29S7 (Need Update)
Connected via SWD.
SWD Frequency = 4000K.
Target voltage = 3.6 V
Connection mode: Normal
Reset mode: Software reset
Device ID: 0x410
Device flash Size: 64 Kbytes
Device family: STM32F10xx Medium-density

Loading file...
Flash Programming:
  File : C:\Users\js\AppData\Local\Temp\arduino_build_525840\Blink_BluePill.ino.bin
  Address : 0x08000000
Memory programming...
±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± 0%
0%ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ 49%ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ 99%Û 100%
Memory programmed in 1s and 156ms.
Programming Complete.

MCU Reset.

Application started.


C:\Users\js\Documents\Arduino\hardware\Arduino_STM32\tools\win>rem: Using the open source texane-stlink instead of the proprietary STM stlink exe

C:\Users\js\Documents\Arduino\hardware\Arduino_STM32\tools\win>rem:texane-stlink\st-flash.exe write C:\Users\js\AppData\Local\Temp\arduino_build_525840\Blink_BluePill.ino.bin 0x8000000


http://www.thinkcreate.org/index.php/debug-stm32-with-vscode/
https://github.com/arduino/OpenOCD

Ist ein STLINK angeschlossen, dann wird bei der Projekt-Erstellung auch OCD-DEBUG installiert:
Zitat> Executing task: C:\Users\js\.platformio\penv\Scripts\platformio.exe debug <

PackageManager: Installing tool-openocd @ ~2.1000.0
Downloading  [####################################]  100%
Unpacking  [####################################]  100%
tool-openocd @ 2.1000.190707 has been successfully installed!
Processing bluepill_f103c8 (platform: ststm32; board: bluepill_f103c8; framework: arduino)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/bluepill_f103c8.html
PLATFORM: ST STM32 6.0.0 > BluePill F103C8
HARDWARE: STM32F103C8T6 72MHz, 20KB RAM, 64KB Flash
DEBUG: Current (stlink) External (blackmagic, jlink, stlink)
PACKAGES:
- framework-arduinoststm32 3.10700.191028 (1.7.0)
- toolchain-gccarmnoneeabi 1.70201.0 (7.2.1)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 8 compatible libraries

juergs

#5
Jetzt klapp es auch auf dem BluePill mit dem Maple-Code (!) und dem Debuggen ... fehlt noch direkt auf dem Maple.
https://docs.platformio.org/en/latest/boards/ststm32/bluepill_f103c8.html?utm_source=platformio&utm_medium=piohome

Zitat[env:maple_mini_origin]
platform = ststm32
board = maple_mini_origin
framework = arduino

; change microcontroller to MapleMini CBT6-Type
board_build.mcu = stm32f103cbt6

; change MCU frequency
board_build.f_cpu = 72000000L


;lib_extra_dirs = ~/Documents/Arduino/libraries
;lib_extra_dirs = C:/Users/js
;/Documents/PlatformIO/Projects/MapleSDuino/src/_micro-api\libraries
lib_deps =
   
debug_tool        = stlink
upload_protocol   = stlink
monitor_speed     = 115200

;upload_port     = COM17
;monitor_speed   = 115200
;debug_port      = COM17

build_flags =
    -D PIO_FRAMEWORK_ARDUINO_ENABLE_CDC
    -D PIO_FRAMEWORK_ARDUINO_NANOLIB_FLOAT_PRINTF
    -D PIO_FRAMEWORK_ARDUINO_USB_HIGHSPEED_FULLMODE

juergs

#6
Das Debuggen mit passendem Bootloader upload  mittels:
pio run -t upload

https://docs.platformio.org/en/latest/boards/ststm32/maple_mini_b20.html
https://github.com/platformio/platformio-examples/tree/develop/wiring-blink
Advanced Doku:
https://docs.platformio.org/en/latest/projectconf/index.html
Build Configurations:
https://docs.platformio.org/en/latest/projectconf/build_configurations.html

Alternative für Upload:
; Use ST-util for flashing
; https://github.com/texane/stlink

[env:custom_st_flash]
platform = ststm32
framework = stm32cube
board = bluepill_f103c6
upload_command = $PROJECT_PACKAGES_DIR/tool-stlink/st-flash write $SOURCE 0x8000000


Zitat~~~~~~~~~~~~~~~~~~~^~~~~~~~
Archiving .pio\build\maple_mini_origin\liba32\libsignalDecoder.a
Linking .pio\build\maple_mini_origin\firmware.elf
Checking size .pio\build\maple_mini_origin\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [===       ]  27.9% (used 4864 bytes from 17408 bytes)
Flash: [=====     ]  51.6% (used 57060 bytes from 110592 bytes)
Configuring upload protocol...
AVAILABLE: blackmagic, dfu, jlink, serial, stlink
CURRENT: upload_protocol = stlink
Uploading .pio\build\maple_mini_origin\firmware.elf
xPack OpenOCD, 64-bit Open On-Chip Debugger 0.10.0+dev (2019-07-17-11:28)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
debug_level: 1

hla_swd
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x08006050 msp: 0x20004400
** Programming Started **
** Programming Finished **
** Verify Started **
** Verified OK **
** Resetting Target **
shutdown command invoked

juergs

#7
    Erkenntnisse: Bootloader und Debuggen mit PlatformIO:

    Flashvorgang Signalduino-Firmware von https://github.com/Ralf9/SIGNALDuino/releases/tag/4.1.0-dev200322
    Anmerkungen, trotz Namensgleichheit unterschiedliches Verhalten:
    https://github.com/rogerclarkmelbourne/Arduino_STM32/wiki/Bootloader Binary: STM32duino-bootloader/maple_mini_boot20.bin
    https://github.com/leaflabs/maple-bootloader hier die Binary-Datei: Leaflaps-maple_mini_boot20.bin


    • Zuerst über STMFlashloader das bin-File direkt auf den Chip mit Standard-Einstelllung auf Adresse: 0x8000000 => funktioniert nicht.
    • Nächster Versuch: FullErase des Chips.
    • MapleMini20-Bootloader geflasht auf Adresse: 0x8000000
    • Das bin-File über Kommandozeile:
      C:\Users\js>C:\Users\js\Documents\Arduino\hardware\Arduino_STM32/tools/win/maple_upload.bat COM17 1 1EAF:0003 C:\Users\js\Downloads\Maple_cul_USB_410dev200322.bin
      => "Found Runtime: [0x1eaf:0x0003] devnum=1, cfg=0, intf=0, alt=1, name="STM32duino bootloader v1.0  Upload to Flash 0x8005000" => Funktioniert!
    Um den Bootloader zu schützen hätte ich die Signalduino-Firmware ab 0x8005000 flashen müssen. Die Standard-Einstellung des Flashloader überschreibt den Bootloader, dann ghet nichts mehr.
    Dachte eigentlich, dass im BIN-File die Adresslage (wie z.B. beim HEX-Format) definiert sei, dies ist wohl nicht so.

    Bei verschiedenen Bootloadern ist die Einsprungadresse in den Sketch unterschiedlich, je nach Ausführung 20K BL => 0x8005000 und die kleineren BL-Varianten  auf 0x8002000.
    Also muss beim Flashen über STMFlashloader die Startadresse spezifisch eingestellt werden!

    Momentan gibt es die Zwickmühle:


    • "Alter" LeafLaps MapleMini20.bin (20K) Bootloader spannt seriellen Port auf und Arduino programmiert darüber ohne Probleme automatisch. Aber VSCODE mit STLINK kann nicht debuggen ...
    • Neuer STMduino-Bootloader https://github.com/rogerclarkmelbourne/STM32duino-bootloader gibt es in zwei Varianten: nur Bootloader und Bootloader+Welcome-Sketch
      Hier muss manuell über RESET +BUT32 der Programmiervorgang für Ardino eingeleitet werden. Hier spannt sich kein COM-Port auf ... ABER: VSCODE kann über STLINK problemlos debuggen.

    Der Leaflap-Bootloader unterbindet definitiv den Connect zu STLINK (trotz verbundenen NRST).

    Zitat15:47:05 : ST-LINK SN : 0673FF323535474B43080830
    15:47:05 : ST-LINK Firmware version : V2J29M18
    15:47:05 : Connected via SWD.
    15:47:05 : SWD Frequency = 4,0 MHz.
    15:47:05 : Connection mode : Normal.
    15:47:05 : Debug in Low Power mode enabled.
    15:47:05 : Device ID:0x410
    15:47:05 : Device flash Size : 128KBytes
    15:47:05 : Device family :STM32F10xx Medium-density
    15:47:36 : [maple_mini_boot20_ok_21kb.bin] opened successfully.
    15:47:36 : [maple_mini_boot20_ok_21kb.bin] checksum : 0x001747B5
    15:47:45 : Flash memory erased.
    15:47:53 : Flash memory is blank.
    15:48:05 : Memory programmed in 2s and 78ms.
    15:48:05 : Verification...OK
    15:48:05 : Programmed memory Checksum: 0x001747B5
    15:48:07 : Disconnected from device.
    15:48:07 : Connection to device is lost: check power supply and debug connection.
    15:48:07 : If the target is in low power mode, please enable "Debug in Low Power mode" option from Target->settings menu.
    15:48:26 : [Maple_cul_USB_410dev200322.bin] opened successfully.
    15:48:26 : [Maple_cul_USB_410dev200322.bin] checksum : 0x0058CFCE
    15:49:25 : Can not connect to target!
                      Please select "Connect Under Reset" mode from Target->Settings menu and try again.
                      If you're trying to connect to a low frequency application , please select a lower SWD Frequency mode from Target->Settings menu.
    15:49:29 : No target connected
    15:49:46 : STLink USB communication error
    15:50:04 : STLink USB communication error
    [/list]

    juergs

    #8
    Aber Google sei Dank:

    stm32-st-link-utility-software-description-stmicroelectronics.pdf

    Mit Mode: "connect under reset" funktioniert jetzt auch der Zugriff mit dem Original-Bootloader.  :)
    In Settings.ini:
    [Settings]
    File=C:\Users\js\Downloads\Maple_cul_USB_410dev200322.bin
    address=0x08005000
    size=0x501C
    data_width=4
    connection=SWD
    SwclkFrequency=4000K
    Connection_Mode=CUR
    DebugInSleepMode=1
    Reset_Mode=HWReset
    Parallelism=32_Bits
    AP_ID=0
    RunAfterProge=1
    FlashChecksum=0
    SkipErase=0
    SkipFlashProtection=0
    trace.log=1
    address1=0x08005000
    address2=0x08000000


    Der Hinweis auf das STLink-Tracefile ist auch hilfreich.

    Dann schauen wir mal weiter,ob der Upload mit VSCode funktioniert und fang erst mal klein mit einem Testprogramm an ...


    Upload mittels DFU:  pio run -t upload

    env:maple_mini_b20]
    platform    = ststm32
    framework   = arduino
    board       = maple_mini_b20
    build_type  = debug
    board_build.mcu     = stm32f103c8t6
    board_build.f_cpu = 72000000L

    debug_tool = stlink
    ;upload_protocol = dfu     ; is default
    monitor_speed = 115200


    ZitatInfo : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
    Info : tcl server disabled
    Info : telnet server disabled
    Info : clock speed 1000 kHz
    Info : STLINK V2J29M18 (API v2) VID:PID 0483:374B
    Info : Target voltage: 3.241416
    Error: init mode failed (unable to connect to the target)


    .pioinit:13: Error in sourced command file:
    Remote communication error.  Target disconnected.: Success.

    Nein, Blink geht einfach nicht zu Debuggen https://docs.platformio.org/en/latest/boards/ststm32/maple_mini_b20.html#board-ststm32-maple-mini-b20:
    Zitat
    Maple Mini Bootloader 2.0 does not have on-board debug probe and IS NOT READY for debugging. You will need to use/buy one of external probe listed below.
    Compatible Tools    On-board    Default
    Black Magic Probe         Yes
    J-LINK         
    ST-LINK         

    STLink connected ohne Probleme direkt auf das Board.

    juergs

    #9
    https://community.platformio.org/t/difficulty-with-getting-usb-serial-usb-cdc-working/7501

    Zitat[env:bluepill_f103c8]
    platform = https://github.com/platformio/platform-ststm32.git
    board = bluepill_f103c8
    framework = arduino
    build_flags =
       -D PIO_FRAMEWORK_ARDUINO_ENABLE_CDC
       -D USBCON
       -D USBD_VID=0x0483
       -D USB_MANUFACTURER="Unknown"
       -D USB_PRODUCT="\"BLUEPILL_F103C8\""
       -D HAL_PCD_MODULE_ENABLED

    ZitatThe same problem seem to appear when using the original "Roger Melbourne" (derived from leaflabs)-core.

    When using this in platformio.ini:

    board_build.core = maple

    the same thing seems to happen. The bluepill's USB does not change from "bootloader" to "serial port".
    A funny detail: if you disable the libUSB device (maple 003) in the device manager and reactivate it after that, then the board activates the virtual serial port.

    Es sei denn man spielt den aktuellen Update in VSCode ein:

    ZitatSorry about that. VScode has released some breaking changes in 1.43 so our serial port is broken. We are trying to fix it. You can downgrade to 1.42 for work around.
    The Feb 2020 version 1.43 had a bug where the Serial/Com port (ST Link USB) was not working.

    Nein!  ::)

    Nach dem gestrigen Update auf 1.43.2 geht Debuggen gar nicht mehr ...

    Downgrade?
    https://stackoverflow.com/questions/49346733/how-to-downgrade-vscode

    juergs


    juergs

    #11
    PlatformIO-Bug - Lösung um wieder Debuggen zu können:

    Ist zwar für ESP32 aber sollte helfen @3:10:
    https://www.youtube.com/watch?v=TivyIFF-dzw&feature=youtu.be . (low-cost-esp32-in-circuit-debugging für ESP32.)

    pio upgrade --dev

    Version: 1.43.2 (system setup)
    Commit: 0ba0ca52957102ca3527cf479571617f0de6ed50
    Date: 2020-03-24T07:36:51.261Z
    Electron: 7.1.11
    Chrome: 78.0.3904.130
    Node.js: 12.8.1
    V8: 7.8.279.23-electron.0
    OS: Windows_NT ia32 10.0.18363

    Und Debuggen geht wieder !  :)

    Zitat; PlatformIO Project Configuration File
    ;
    ;   Build options: build flags, source filter
    ;   Upload options: custom upload port, speed and extra flags
    ;   Library options: dependencies, extra library storages
    ;   Advanced options: extra scripting
    ;
    ; Please visit documentation for the other options and examples
    ; https://docs.platformio.org/page/projectconf.html

    [platformio]
    ;default_envs = maple_mini_b20
    default_envs = maple_mini
    ;======================================
    [common_env_data]
    build_flags = -D
    VERSION = 1.2.3 -D
    DEBUG = 1
    lib_deps_builtin =
        SPI
        Wire
    build_flags =
        -D PIO_FRAMEWORK_ARDUINO_ENABLE_CDC
        -D PIO_FRAMEWORK_ARDUINO_NANOLIB_FLOAT_PRINTF
        -D PIO_FRAMEWORK_ARDUINO_USB_HIGHSPEED_FULLMODE
    ;======================================
    [env:maple_mini]
    platform    = ststm32
    board        = maple_mini_origin
    framework =  arduino
    build_type = debug
    board_build.mcu = stm32f103cbt6    ;--- change microcontroller to MapleMini CBT6-Type
    board_build.f_cpu = 72000000L        ;--- change MCU frequency
       
    ;--- AVAILABLE: blackmagic, dfu, jlink, mbed, stlink
    upload_protocol  = dfu
    upload_port        = COM19  :--- ist der des Maples.
    debug_tool         = stlink
    ;--- Build options
    build_flags = ${common_env_data.build_flags}

    ;lib_extra_dirs = ~/Documents/Arduino/libraries
    ;lib_extra_dirs = C:/Users/js
    ;/Documents/PlatformIO/Projects/MapleSDuino/src/_micro-api\libraries

    lib_deps =
    ;==============================================================================
    [env:maple_mini_b20]
    ;platform      = ststm32
    platform       = https://github.com/platformio/platform-ststm32.git
    framework   = arduino
    ;board         = maple_mini_b20
    board          = bluepill_f103c8
    build_type   = debug
    board_build.core = maple
    board_build.mcu  = stm32f103c8t6
    board_build.f_cpu = 72000000L

    debug_tool = stlink
    ;upload_protocol = dfu     ; is default
    ;monitor_speed = 115200
    ;debug_port = COM17

    juergs

    #12
    Meine Versuche, die passenden Einstellungen (Achtung: falscher Bootloader!) der platformio.ini
    für einen erfolgreichen Compile der MapleSignalduino-Firmware von Ralf9 sind bisher leider gescheitert.
    Mein Ziel war es die Debug-Möglichkeiten von VSCode mit STLINK zu nutzen.

    Bei meiner Suche in unzähligen Youtube-Videos etc. habe ich eine Webseite gefunden, die die gesamte Thematik sehr schön und kompakt
    zusammenfasst: BluePill-STM32F103-to-BlackMagic-Probe

    Für Win 10 mit WSL Hinweise auf: JTAG.

    Das könnte für den Einen oder Anderen "STM32-Tüftler" auch interessant sein.

    Grüße,
    Jürgen


    HomeAuto_User

    Hallo,
    ich frage mal an wie weit der Stand aktuell ist?

    Meine Versuche das ganze bei PlatformIO zu compilieren ist mir bisher nur bei einer modded Version von SIGNALduino @org gelungen.

    MfG
    "Developer" heißt nicht, das man alles wissen kann!
    - FHEM v5.9 | Rasberry PI 3
    - radino CC1101 433Mhz (SIGNALduino)| - radino CC1101 868Mhz (CUL) | nano 433Mhz (SIGNALduino) - Sensoren: purer Dschungel querbeet