Hi,
I'm trying to communicate with vl53l0x through the I2C interface. I checked both on an oscilloscope and logic analyzer and signals look good, but the software returns a not acknowledged status. I've seen some other topics about i2c issues on STM32F4 here and added pullup (4k7) to SDA and SCL lines, however, nothing is changing. I checked both fast and standard I2C modes.
While using STMCube and HAL both reading and writing to the device work (with the same pins configuration).
Pins are configurated with macros PAL_MODE_ALTERNATE(4), PAL_STM32_OSPEED_HIGHEST, PAL_STM32_OSPEED_HIGHEST and PAL_MODE_OUTPUT_OPENDRAIN. Any hints?
STM32F4 I2Cv1 doesn't see the aknowledge
- Giovanni
- Site Admin
- Posts: 14320
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1054 times
- Been thanked: 895 times
- Contact:
Re: STM32F4 I2Cv1 doesn't see the aknowledge
Hi,
I would check the physical connection, it is very critical, how log are wires for example?
Giovanni
I would check the physical connection, it is very critical, how log are wires for example?
Giovanni
Re: STM32F4 I2Cv1 doesn't see the aknowledge
Try this:
Code: Select all
PAL_MODE_ALTERNATE(4) | PAL_STM32_OTYPE_OPENDRAIN
Re: STM32F4 I2Cv1 doesn't see the aknowledge
psyco wrote:Try this:Code: Select all
PAL_MODE_ALTERNATE(4) | PAL_STM32_OTYPE_OPENDRAIN
it is like that already.
Giovanni wrote:Hi,
I would check the physical connection, it is very critical, how log are wires for example?
Giovanni
Giovanni, wires are just regular short prototype connectors. As I said I tested the same configuration with STM32 Cube HAL and all works without errors.
- Giovanni
- Site Admin
- Posts: 14320
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1054 times
- Been thanked: 895 times
- Contact:
Re: STM32F4 I2Cv1 doesn't see the aknowledge
Hi,
Are you using the correct address?
Note that in ChibiOS you need to pass the address field value without the RW bit, not the whole 1st byte value.
Giovanni
Are you using the correct address?
Note that in ChibiOS you need to pass the address field value without the RW bit, not the whole 1st byte value.
Giovanni
Re: STM32F4 I2Cv1 doesn't see the aknowledge
Giovanni wrote:Hi,
Are you using the correct address?
Note that in ChibiOS you need to pass the address field value without the RW bit, not the whole 1st byte value.
Giovanni
Yes, I also checked the signals from both chibios and Cube and they look the same - it has aknowledge.
Screenshot from the logic analyzer: https://ibb.co/3dKW6Wn
- FXCoder
- Posts: 384
- Joined: Sun Jun 12, 2016 4:10 am
- Location: Sydney, Australia
- Has thanked: 179 times
- Been thanked: 130 times
Re: STM32F4 I2Cv1 doesn't see the aknowledge
Hi,
Is the I2C config something like this?
I know this configuration works on F413 with BME280 configured for I2C use.
(Should be using dot notation for member access but this is old code).
--
Bob
Is the I2C config something like this?
Code: Select all
const I2CConfig _i2cMainCfg = {
OPMODE_I2C,
50000,
STD_DUTY_CYCLE,
};
I know this configuration works on F413 with BME280 configured for I2C use.
(Should be using dot notation for member access but this is old code).
--
Bob
Re: STM32F4 I2Cv1 doesn't see the aknowledge
FXCoder wrote:Hi,
Is the I2C config something like this?Code: Select all
const I2CConfig _i2cMainCfg = {
OPMODE_I2C,
50000,
STD_DUTY_CYCLE,
};
I know this configuration works on F413 with BME280 configured for I2C use.
(Should be using dot notation for member access but this is old code).
--
Bob
Yes, it looks the same for lower clock frequencies as well.
- Giovanni
- Site Admin
- Posts: 14320
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1054 times
- Been thanked: 895 times
- Contact:
Re: STM32F4 I2Cv1 doesn't see the aknowledge
Strange, is it possible I2C1 pins are shorted or connected to something else on the board? defective device?
Unless it is a GPIO setting problem it should be an HW problem.
Giovanni
Unless it is a GPIO setting problem it should be an HW problem.
Giovanni
Who is online
Users browsing this forum: No registered users and 5 guests