I switched to using stm32duino from the :
http://docs.leaflabs.com/static.leaflab … gitalwrite
In the Leaf library, there is OUTPUT_OPEN_DRAIN pin mode, and I added it in Visuino https://www.visuino.com as tart of the upcoming STM32 support (Hopefully in the future supporting all STM32 boards ).
I can’t find the OUTPUT_OPEN_DRAIN mode in the stm32duino . What is the alternative?
Cheers,
Boian
PS: I am sorry, I posted it in the Nucleo instead of the Maple . If somebody can move it I would really appreciate it!

C:\Users\mitov\AppData\Local\Temp\arduino_modified_sketch_780612\Blink.ino: In function ‘void setup()’:
Blink:27: error: ‘OUTPUT_OD’ was not declared in this scope
pinMode(LED_BUILTIN, OUTPUT_OD);
^
exit status 1
‘OUTPUT_OD’ was not declared in this scope
Target “MapleMini F103CB”
Suggestions?
OUTPUT_OPEN_DRAIN
see:
https://github.com/rogerclarkmelbourne/ … e/io.h#L47
[stevestrong – Tue Jul 11, 2017 8:43 am] –
Sorry, I was wrong, you should use:
OUTPUT_OPEN_DRAIN
see:
https://github.com/rogerclarkmelbourne/ … e/io.h#L47
I got the libraries with the board manager from:
https://github.com/stm32duino/BoardManagerFiles
like this:
https://github.com/stm32duino/BoardMana … index.json
Is that the wrong library? It does not have the OUTPUT_OPEN_DRAIN defined
Which one is the “official” library?
const uint8_t led_pin = 33;
uint8_t led = 0;
void setup() {
pinMode(led_pin, OUTPUT_OPEN_DRAIN);
}
void loop() {
digitalWrite(led_pin, led);
led = 1 - led;
delay(500);
}
it seems there is a misunderstanding around the STM32 core used.
With this one:
https://github.com/stm32duino/Arduino_Core_STM32
Installed thanks https://github.com/stm32duino/BoardManagerFiles
OUTPUT_OPEN_DRAIN is not defined so your sketch should not compile.
On this core only the OUTPUT is defined: and set the GPIO with GPIO_MODE_OUTPUT_PP (Output Push Pull Mode) and GPIO_NOPULL (No Pull-up or Pull-down activation).
It follow Arduino reference for pinMode: https://www.arduino.cc/en/Reference/PinMode
Probably, we could extend and propose other mode, ex: GPIO_MODE_OUTPUT_OD.
I think you use the core provided by Roger:
https://github.com/rogerclarkmelbourne/Arduino_STM32
uint8_t led = 0;
void setup() {
pinMode(led_pin, OUTPUT_OPEN_DRAIN);
}
…
Does not work with the libraries installed from the board manager.
I followed this instructions to install from the board manager:
https://github.com/stm32duino/wiki/wiki/Boards-Manager
You can see the error when compiling.
I can also manually get the repository, but I would prefer to use the board manager, as the Visuino customers will have to follow the same procedure.
One of the users already is planning Visuino Wiki tutorial on setting up the Arduino IDE to compile for the STB32Duino boards.
Will be added in the Visuino Wiki:
https://www.visuino.com/wiki/index.php?title=Main_Page
To solve this problem:
o You could add the feature to the code yourself.
o You could ask for an enhancement by creating an issue on github
o You could use the libmaple core. https://github.com/rogerclarkmelbourne/Arduino_STM32
o You could use another core that supports it http://www.stm32duino.com/viewtopic.php?f=42&t=97
[Rick Kimball – Wed Jul 12, 2017 5:51 pm] –
o You could add the feature to the code yourself.
If I add it it will be included in the official release?
I am asking as I have about 23000 users of Visuino, according to the registration, and they all will need to have access to it.
I am asking how to solve the problem for all users.
This functionality is probably important, and should be included in the official library IMHO
Which arduino boards support this ?
The libmaple core (Roger’s repo) is an updated version of the leaflabs code for the latest arduino ide.
The ST core has just added support for the STM32F1 chips and it isn’t complete or fully tested and changing rapidly. The official ST core isn’t going to have all the extensions you find in the libmaple core. It is going to be a vanilla port of the arduino core and will probably work best with NUCLEO boards. The ST core will probably work with a wider range of STM32 chips. It already supports some of the F0, L0, L1, F3, L4, F4 boards.
[Boian Mitov – Wed Jul 12, 2017 7:56 pm] –[Rick Kimball – Wed Jul 12, 2017 5:51 pm] –
o You could add the feature to the code yourself.If I add it it will be included in the official release?
I am asking as I have about 23000 users of Visuino, according to the registration, and they all will need to have access to it.
I am asking how to solve the problem for all users.
This functionality is probably important, and should be included in the official library IMHO![]()
You realize that stm32duino.com isn’t a commercial venture yes? You should read about its origins on the WIKI FAQ. You realize the users here aren’t going to provide user support for your 23k users? Based on a quick look at your product, I doubt your users are the ideal candidates to be using any of the stm32 cores.
You realize that ST’s official port is barely used by anyone here? It is a brand new effort that doesn’t really have anything to do with the original mission of this site, which was all about getting libmaple updated to work with the newer Arduino IDE. You realize that ST’s official port is being done by a contractor? It feels to me that the main goal of the ST official core is to support the NUCLEO boards. We welcome their work as it adds more of the complete STM32 product line. However, as it uses STM32CUBEMX HAL, it is incompatible with the libmaple core and will have many differences.
[Rick Kimball – Wed Jul 12, 2017 8:51 pm] –
You realize that stm32duino.com isn’t a commercial venture yes? You should read about its origins on the WIKI FAQ. You realize the users here aren’t going to provide user support for your 23k users? Based on a quick look at your product, I doubt your users are the ideal candidates to be using any of the stm32 cores.You realize that ST’s official port is barely used by anyone here? It is a brand new effort that doesn’t really have anything to do with the original mission of this site, which was all about getting libmaple updated to work with the newer Arduino IDE. You realize that ST’s official port is being done by a contractor? It feels to me that the main goal of the ST official core is to support the NUCLEO boards. We welcome their work as it adds more of the complete STM32 product line. However, as it uses STM32CUBEMX HAL, it is incompatible with the libmaple core and will have many differences.
Thank you! I am unfortunately completely unaware of any of this .
I am completely new to the ST modules, just started few days ago with them For the last 2 years, I have been working on Visuino, starting with support for the Arduino boards, and slowly adding more and more boards, with the goal one day for it to support at least all popular boards. The ST support is my latest effort at covering boards. I am simply trying to make it easy for people without programming knowledge to program whatever board they want.
Unfortunately there seems to be a bit more confusion about the ST based bards than in any of the other controllers that I had to work with so far . Hopefully we all will find a way to make sure the boards are well supported and easy to use. I am concerned that I already encounter few somewhat competing and not quite compatible libraries for the Maple, and this will only cause confusion. I have tried to write my Visuino library to be able to compile with both the ST and the Leaf libraries, but I think there should be a more concerted effort to have common ST cores Arduino IDE compatible support
[Boian Mitov – Wed Jul 12, 2017 9:02 pm] –
I have tried to write my Visuino library to be able to compile with both the ST and the Leaf libraries, but I think there should be a more concerted effort to have common ST cores Arduino IDE compatible support
For users who are using any of the stm32f103 chips, the stm32duino libmaple core is actually the best pick. It has semi efficient functions and more flight time with many users who have been using it for the last couple of years. Leaflabs developed this because ST’s offerings at that time weren’t open source friendly.
Since that time ST, has seen the error of their ways and have become more open source friendly. They now offer the STM32CubeMX HAL with a much more friendly license. However, this API has more overhead than either their original Standard Peripheral Library or the libmaple code. Not that the SPL stuff was lean and mean. The STM32CubeMX and the SPL APIs attempt to provide a high level interface to the chips but they don’t focus on being small and efficient.
The official ST Arduino core is using the STM32CubeMX HAL API. When you add an Arduino API on top of that, it becomes less and less efficient. However Its goal is to provide access to more of the STM32 chips with the same/similar code.
So the bottom line I don’t see a merging of any of the cores. People who want something semi efficient and happen to be using an STM32F1 will be using the libmaple core. People who want to use an STM32F0, STM32L0, STM32F3, STM32L3, STM32F4, STM32L4, or STM32F7 chip will probably be looking to the ST official port.