No pwm and hid possible on generic_stm32f103CB using maple core

hello peeps

since two weeks for now i try to get 6 pins working as PWM outputs.
i want to use PB8, PB9, PB10, PB11, PA15, PB3 and need to use the maple core because of later use of the bootloader and to flash it via webDfu.
PB8 and PB9 work as pwm, but the others dont. maybe iam to stupid but anyhow all the informations in the web i were leading me into errors, problems, irritation and frustration.
is anybody out there who can help me with explaining in detail what i need to do?
how do i remap correctly, which file should i really edit and in what way?
i tried also disableDebugPorts(), enableDebugPorts(), but it makes less sense cuz in the c_cpp_properties.json file, “CONFIG_MAPLE_MINI_NO_DISABLE_DEBUG=1”, let me think the 3 jtag pins are used for gpio pins only. how do i map pwm functionality to them?

also a big question is how do i change a pwm channels polarity? i use a 2 pin bicolor led and the third color is only possible if the the polarity of one channel is mirrored to the other used pwm channel of the same timer.

last but not least is the question: how can i turn the stm32 usb sides into a hid device. i want to create a standart recognized midi device, using usb.

what maybe need to be mentioned is that i use adafruit gfx and adafruit ssd1306 on the first standart i2c port. most tries by me lead into a nonworking display . how should i cook everything together?

sorry to bother you, but it leads me into everything but not the final solutions.

much love to all of you and thanks in advance <3

I can’t answer all in depth technical questions right now since i’m not an expert in them, but I have some general tips:

which should be taken with a grain of salt though because e.g. PB8 works as you said, but is not in the above list – when you look up at the detailed pin definitions though

You see that PB8 has timer 4 (some TIM peripheral) associated with it, so it hsould work as a timer. Other pins like PB10 have no timer associated with it. There are two possibilities for this:

  • there really is no hardware TIM peripheral and timer channel in the microcontroller that is connected to this this pin – thus hardware PWM is impossible on that pin
  • there is some pin mapping remapping available but the Maple core doesn’t implement it

The truth for that will be in the datasheet.

Refer to the Arduino core implementation’s source code. Pretty sure you want to instantiate an object of the HardwareTimer class here and use the function

Use the core-provided Arduino_STM32/STM32F1/libraries/USBComposite at master · rogerclarkmelbourne/Arduino_STM32 · GitHub library.

Very hard to say what’s going on there without seeing all full technical details and wireup. The devil can be in the details. I suggest taking one step at the time, testing everything in simple minimal firmwares, then merging the firmware together piece by piece.

max, i really thank you !! will check that out in the next days and will feedback my experience then :slight_smile:

mmh, i dont know were to start :smiley:
on the stm32duino core i got PB3, PB10, PB11 and PA15 working as pwm output, PB8 and PB9 dont work
on the maple core it works totally different again … i hate all that different core confusion

Tacke one problem at a time. The cores seem to have different implementations here that make it work differently. You can always inspect the source code of them at GitHub - stm32duino/Arduino_Core_STM32: STM32 core support for Arduino and GitHub - rogerclarkmelbourne/Arduino_STM32: Arduino STM32. Hardware files to support STM32 boards, on Arduino IDE 1.8.x including LeafLabs Maple and other generic STM32F103 boards or open issues / discussions there for clarifications.

so here are some news.

i deinstalled platformio and deletetd all files under users/platformio/.
after that i reinstalled everything freshly and tried again.

because of usbcomposite.h iam using the maple core.
oled is working.
none of my desired pwmable (in its nature hardware) pins work as pwm. i coded my own softpwm for all those pins.
usb midi works too.

for now i can work with this