Hi,
I have to read data from a BMP180 sensor, it's on my custom board, PD12,PD13 pins, I2C4. how to use i2cDriver? how to config i2cv3?
I didn't found any H7 i2c example.
Regards,
Amir.
STM32H743 I2C
Moderators: RoccoMarco, barthess
- Giovanni
- Site Admin
- Posts: 14444
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1074 times
- Been thanked: 921 times
- Contact:
Re: STM32H743 I2C
Hi,
Look of other I2C examples, API is the same. You could try to ask on the Discord server, probably somebody already used it on h7.
Giovanni
Look of other I2C examples, API is the same. You could try to ask on the Discord server, probably somebody already used it on h7.
Giovanni
Re: STM32H743 I2C
Dear Giovanni,
I didn't found any example using i2c on H7 device, the problem is not the i2cDriver, my problem is the i2c config:
the compiler replied: main.c:59:7: error: 'OPMODE_I2C' undeclared here (not in a function)
and main.c:61:7: error: 'STD_DUTY_CYCLE' undeclared here (not in a function)
Regards,
Amir.
I didn't found any example using i2c on H7 device, the problem is not the i2cDriver, my problem is the i2c config:
Code: Select all
static const I2CConfig i2cConfig = {
OPMODE_I2C,
100000,
STD_DUTY_CYCLE,
};
the compiler replied: main.c:59:7: error: 'OPMODE_I2C' undeclared here (not in a function)
and main.c:61:7: error: 'STD_DUTY_CYCLE' undeclared here (not in a function)
Regards,
Amir.
- Giovanni
- Site Admin
- Posts: 14444
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1074 times
- Been thanked: 921 times
- Contact:
Re: STM32H743 I2C
Hi,
That configuration structure is for I2Cv1, the I2Cv2/I2Cv3 structure is different:
Note that those are register values, the documentation is on the STM32 reference manual, especially "TIMINGR" is critical. Values can be written as numeric constant or using ST-defined macros present in the STM32 CMSIS header for your device, see under /os/common/ext/ST and pick yours.
Giovanni
That configuration structure is for I2Cv1, the I2Cv2/I2Cv3 structure is different:
Code: Select all
struct hal_i2c_config {
/**
* @brief TIMINGR register initialization.
* @note Refer to the STM32 reference manual, the values are affected
* by the system clock settings in mcuconf.h.
*/
uint32_t timingr;
/**
* @brief CR1 register initialization.
* @note Leave to zero unless you know what you are doing.
*/
uint32_t cr1;
/**
* @brief CR2 register initialization.
* @note Only the ADD10 bit can eventually be specified here.
*/
uint32_t cr2;
};
Note that those are register values, the documentation is on the STM32 reference manual, especially "TIMINGR" is critical. Values can be written as numeric constant or using ST-defined macros present in the STM32 CMSIS header for your device, see under /os/common/ext/ST and pick yours.
Giovanni
Who is online
Users browsing this forum: No registered users and 15 guests