STM32F103C - Blue Pill Port Literals

The internal LED on my Blue Pill Board is connected to PC13 or Pin No. 2.
I have tried to upload a simple project in XOD:

Zwischenablage03

I got this error message:

Begin compiling code for the board Generic STM32F103C series

C:\Users\OPTIPL~1\AppData\Local\Temp\xod_temp_sketchbook1WFQV1\xod_1539803363197_sketch\xod_1539803363197_sketch.ino: In function ‘void xod::xod__gpio__digital_write::evaluate(xod::xod__gpio__digital_write::Context)’:
C:\Users\OPTIPL~1\AppData\Local\Temp\xod_temp_sketchbook1WFQV1\xod_1539803363197_sketch\xod_1539803363197_sketch.ino:1238:24: error: ‘NUM_DIGITAL_PINS’ was not declared in this scope
bool err = (port > NUM_DIGITAL_PINS - 1);
^

Error: exit status 1
Compilation failed.
Upload tool exited with error
Command C:\Program Files\XOD IDE\resources\arduino-cli.exe --config-file=C:\Users\OPTIPL~1\AppData\Local\Temp\arduino-cliUqQlfe\.cli-config.yml compile --fqbn stm32duino:STM32F1:genericSTM32F103C:upload_method=DFUUploadMethod C:\Users\OPTIPL~1\AppData\Local\Temp\xod_temp_sketchbook1WFQV1\xod_1539803363197_sketch failed with code 1
Make sure the board is connected, the cable is working, the board model set correctly, the upload port belongs to the board, the board drivers are installed, the upload options (if any) match your board specs.

Perhaps there is an issue with the pin designations? :thinking:

Alternative boards has to define at least a new C++ header file with some constants to define their capabilities. The constants are pin names, timer info, analog channel mapping, etc. Unfortunately, there is no strict standard about what should be defined as a minimum. The NUM_DIGITAL_PINS macro is defined for all boards we’ve tested. However, Blue Pill does not define it. Thus you see the error.

A temporary workaround is digital-write monkeypatching:

- bool err = (port > NUM_DIGITAL_PINS - 1);
+ bool err = false;

We’ll make the code more tolerant in next releases.

1 Like

Created two issues after your report:

1 Like

Fix is out, please update to 0.25.1

Hello @evgenykochetkov!

Please tell me how to label the used output port.
PC13 is not allowed.
2 turns to “D2” automatically.
D2 produces the following error message:

Begin compiling code for the board Generic STM32F103C series

C:\Users\OPTIPL~1\AppData\Local\Temp\xod_temp_sketchbookRFlv6d\xod_1540106476565_sketch\xod_1540106476565_sketch.ino: In function ‘bool xod::isValidAnalogPort(uint8_t)’:
C:\Users\OPTIPL~1\AppData\Local\Temp\xod_temp_sketchbookRFlv6d\xod_1540106476565_sketch\xod_1540106476565_sketch.ino:792:20: error: ‘A0’ was not declared in this scope
return port >= A0;
^

Error: exit status 1
Compilation failed.
Compilation failed
Command C:\Program Files\XOD IDE\resources\arduino-cli.exe --config-file=C:\Users\OPTIPL~1\AppData\Local\Temp\arduino-cli5UGcNo\.cli-config.yml compile --fqbn stm32duino:STM32F1:genericSTM32F103C:device_variant=STM32F103C8 C:\Users\OPTIPL~1\AppData\Local\Temp\xod_temp_sketchbookRFlv6d\xod_1540106476565_sketch failed with code 1
The generated C++ code contains errors. It can be due to a bad node implementation or if your board is not compatible with XOD runtime code. The original compiler error message is above. Fix C++ errors to continue. If you believe it is a bug, report the problem to XOD developers.

Quick Help
digital-write
xod/gpio/digital-write
Outputs high or low signal on a board port
Inputs:
PORTport
Board port to write to
SIGboolean
State to write
UPDpulse
Triggers new write
Outputs:
ERRpulse
Fires if write failed. E.g. PORT does not exist.
DONEpulse
Fires on writing complete

This was the uploaded project:

Zwischenablage02

Hi @dox!

Thanks for the detailed bug report.
Looks like we need to do a little more work to support STM32 boards :frowning:
Will do that in the very near future, please stay tuned.

1 Like

A little status update:

I added support for defining ports like PC13 and a couple more tweaks to ensure that code successfully compiles for STM32. It will be included in the next release.

But the upload process does not work because of this issue in the arduino-cli tool, which we use under the hood. Fixing it will take some more time.

1 Like

@evgenykochetkov

Hello!
This is the result with version 0.25.2:

hi @dox , something similar I usually do with Wemos D1 mini, and I do a reset (button) before loading
According to this the PIN PC13 of the LED, corresponds to PIN 32 of ARDUINO
If it did not work, try D32. I worked with Wemos D1 mini that on board is D4 and I use it with D2

br

Debug window shows “Upload tool ‘maple_upload’ not found.”
Perhaps I have to install something more?

Arduino IDE works well without resetting the board before upload.

Packages & Toolchains is update since Deploy?

it seems that XOD does not recognize the boot loader, so I could read here Maple is about that


https://wiki.stm32duino.com/index.php?title=Maple_Mini

Unfortunately, no.

This issue with adruino-cli that I mentioned earlier is still unsolved, so XOD still can’t upload code to STM32s.
The only workaround at the moment is generating code with “Deploy -> Show Code for Arduino” and uploading it with Arduino IDE.

1 Like

By the way, all who are interested in resolving the issue, please follow to the issue and add a :+1: or :confused: reaction on it so that arduino-cli author can kind-of evaluate the importance of it to the community (i.e., how many people affected).

1 Like

Latest XOD cant use STM32 boards? Like the STM32F103C8T6

1 Like