I use BluePill in a project and need to work with I2C Wire and analogWrite () PWM commands in the same code.
Now the following isssue has catched me.
I put I2C Wire on the pins PB10, PB11 and i use the analogWrite PB8 for a PWM motor control Pin due to the lack of other free pins.
When I start the code and send data back between sensors and MCU via I2C, it works perfectly.
However, as soon as I send a one or more analogWrite (PB8, XXX) commands, the I2C interface stops working completely.
I attached an oscilloscope to the SCL, SDA pins and it really is the case that no more data or clock pulses are sent as soon as analogWrite(PB8) commands ones executed. No further Wire Commands start a Hardware SCL, SDA pulses. The pins a dead.
For me it looks like analogWrite (PB8, XXX) would bend a timer internally in the MCU, which is also required for I2C, and then it no longer receives a clock and can no longer be used via the interface.
It is also interesting that the I2C interface works normally when I use analogWrite (PB10, PB11, PA6) for motor controls. Only on the analogWrite(PB8 is I2C completely paralyzed.
I need this pin due to the lack of other pins that I have already used.
Perhaps someone knows this phenomenon himself and has a solution to decouple PWM and I2C from this pin PB8 so that both can work independed.
Thanks for hints
Mike
BluePill analogWrite(PB8 ) PWM and I2C (PB10,PB11) collision
Post here all questions related to STM32 core if you can't find a relevant section!
Return to “General discussion”
Jump to
- Announcements
- New users start here
- ↳ Forum rules, FAQs and HowTo's
- ↳ Let us know a bit about you and your projects
- Arduino for STM32
- ↳ General discussion
- ↳ Ideas & suggestions
- ↳ Cores
- ↳ STM32 Core
- ↳ Builds and Announcements
- ↳ Code snippets
- ↳ Ideas & suggestions
- ↳ General discussion
- ↳ Installation and OS related
- ↳ Libraries & Hardware
- ↳ PR's bugs and enhancements
- ↳ LibMaple
- ↳ Builds and Announcements
- ↳ Code snippets
- ↳ General discussion
- ↳ Ideas & suggestions
- ↳ Installation and OS related
- ↳ Libraries & Hardware
- ↳ PR's bugs and enhancements
- ↳ Steve's LibMaple core
- ↳ General discussion
- ↳ PR's bugs and enhancements
- ↳ Projects
- ↳ IDE's
- ↳ Off topic
- Arduino for STM8
- ↳ General discussion
- ↳ Cores
- ↳ STM8 Core
- ↳ Other
- Boards
- ↳ Custom design boards
- ↳ Maple & Maple mini etc
- ↳ STM boards (Discovery, Eval, Nucleo, ...)
- ↳ All other boards
- ↳ STM32F0 based boards
- ↳ STM32F1 based boards
- ↳ STM32F2 based boards
- ↳ STM32F3 based boards
- ↳ STM32F4 based boards
- ↳ STM32F7 based boards
- ↳ STM32G0 based boards
- ↳ STM32G4 based boards
- ↳ STM32H7 based boards
- ↳ STM32L0 based boards
- ↳ STM32L1 based boards
- ↳ STM32L4 based boards
- ↳ STM32L5 based boards
- ↳ STM32MP1 based boards
- ↳ STM32WB based boards
- Bootloaders
- ↳ STM32 HID bootloader
- ↳ USB bootloader
- ↳ STM32 SD-Bootloader
- ↳ STM32 USB CDC bootloader
- Uploaders and debuggers
- ↳ STLink
- ↳ USB to Serial adaptors
- ↳ Black Magic Probe & other
- Dead Thread Graveyard
- ↳ Dead Thread Graveyard