2023-03-31 10:19 AM
I’m using the board, motordriver IIC, to control motor through I2C bus.
The chip on the board is PCA9685.
The board is originally a extension for arduino UNO, and I’m using STM32F446RE which also support arduino UNO expansion connector.
The official give the arduino code, here is github link
github.com/YFROBOT-TM/Yfrobot-Motor-Driver-Library
and I translate it into stm32 code.
Now I want to drive a motor connent to M1 on the board with PWM 100%.
The following is the my stm32 code in main function:
And this is the ioc setting(including clock configuration):
[I2C]
standard mode with 100kHz
PB8 for SCL and PB9 for SDA, both pin set as open drain and pull-up.
[RCC]
set HSE to Crystal/Ceramic Resonator
[SYS]
set Debug to Serial Wire
I use the logic analyzer, and the SDA line shows what I trasmit is correct
***Worth mentionong, I found that at the SCL line, some duty cycle are 50%, and some are40%, don’t know if it make the i2c not working…
100kHz = 10us, refer to the form, the duty cycle should be between 40%~53% (?)
2023-05-23 07:31 AM
Do you find the solution? Because i have the same problem, i use a PCA9685 with the adress 0x7f, and the i2c connection don't work. I test my connection with the HAL status.
2023-06-02 01:45 AM
Sadly, I haven't found the solution...