#if !defined(STM32F0xx) & !defined(STM32L0xx) Obj->i2c = pinmap_merge_peripheral(i2c_sda, i2c_scl) Ĭore_debug("ERROR: I2C pins mismatch\n") I2C_TypeDef *i2c_scl = pinmap_peripheral(obj->scl, PinMap_I2C_SCL) Ĭore_debug("ERROR: at least one I2C pin has no peripheral\n")
I2C_TypeDef *i2c_sda = pinmap_peripheral(obj->sda, PinMap_I2C_SDA) I2C_HandleTypeDef *handle = &(obj->handle) Void i2c_custom_init(i2c_t *obj, i2c_timing_e timing, uint32_t addressingMode, uint32_t ownAddress, uint8_t master) * master : set to 1 to choose the master mode
* addressingMode : I2C_ADDRESSINGMODE_7BIT or I2C_ADDRESSINGMODE_10BIT * Initialize and setup GPIO and I2C peripheral * Default init and setup GPIO and I2C peripheral
Raceflight fc and stm32 driver issues generator#
With the PPM generator wired in at PB6 and no other changes the I2C Scanner test sketch gave errors and was no longer able to find the MPU-6050 at 0圆8 or any other address. I then wired up the PPM generator and that is when the trouble started. The sketch consistently showed the MPU-6050 found at address 0圆8, as expected. I had previously tested the I2C sensor wiring using I2C Scanner test sketch. I've attached a picture of the test setup. I elected to use TIM_CH1 to measure the input stream, which turns out to be PB6. The PPM stream comes from a 5V powered receiver, the voltage levels from the Rx outputs are not specified so I have chosen to use TIM4 as it is the only F103RB TIM with 5V tolerant inputs.
The default for I2C1 are PB7 (SDA) and PB6 (SCL). I've chosen I2C1 with alternate function inputs (SDA on PB9 and SCL on PB8). The application also reads a combined accelerometer/gyro (MPU-6050) over I2C. The application reads pilot commands in from a PPM stream, with input pulse widths to be measured using on of the STM32 TIM channels. I continue to work on putting the pieces together for my port of YMFC-32 STM32F103 based flight controller.