Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I2C repeated start not working on GD32F130 #132

Open
JamesWhitlock opened this issue Nov 21, 2024 · 3 comments
Open

I2C repeated start not working on GD32F130 #132

JamesWhitlock opened this issue Nov 21, 2024 · 3 comments
Assignees
Labels
bug Something isn't working Component: I2C Regarding the I2C component

Comments

@JamesWhitlock
Copy link

When performing a read from i2c slaves with registers, the wire library appears to be failing on repeated starts. The bus gets stuck in a clock low state and the I2C state machine gets stuck in I2C_BUSY.

To work around the issue I have forced the processor to send a stop and start by changing:

Wire.beginTransmission(address);
Wire.write(subAddress);
Wire.endTransmission(false);
Wire.requestFrom(address, (uint8_t)1);
uint8_t data = wire.read();

to

Wire.beginTransmission(address);
Wire.write(subAddress);
Wire.endTransmission();
Wire.requestFrom(address, (uint8_t)1);
uint8_t data = wire.read();

This behaviour was found on a MPU6050A slave device. I have not tried other slaves but I believe this behaviour lies within the GD32 libraries. Has anyone experienced similar (or disimilar) behaviour?

@Candas1
Copy link

Candas1 commented Nov 22, 2024

Hi,

I think you forked my hoverboard sideboard repository ?
Yeah I couldn't get I2C to work on GD32 with MPU6050 or MPU6050A. I have very little experience with I2C unfortunately.

I can try your fix if it helps, and I have many of those boards with different IMUs.

@maxgerhardt
Copy link
Member

Thanks the report. I have a GD32F130 and a MPU6050 here and will be able to test.

@maxgerhardt maxgerhardt self-assigned this Nov 22, 2024
@maxgerhardt maxgerhardt added bug Something isn't working Component: I2C Regarding the I2C component labels Nov 22, 2024
@JamesWhitlock
Copy link
Author

@Candas1, I did fork your repo. I've been hacking around on top of it - very useful thank you.

The main problem with the workaround I'm using is it's only useful if you control the function call in your code, this precludes use of third party libraries without modification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Component: I2C Regarding the I2C component
Projects
None yet
Development

No branches or pull requests

3 participants