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

Cannot change I2C address of the Adafruit Mini I2C STEMMA QT Gamepad #93

Closed
pongsagon opened this issue Oct 24, 2023 · 2 comments
Closed

Comments

@pongsagon
Copy link

In the document, one should be able to change the I2C address by calling setI2CAddr().
The default address of Adafruit Mini I2C STEMMA QT Gamepad is 0x50.

However, I have try using setI2CAddr() as well as try calling EEPROMWrite8(SEESAW_EEPROM_I2C_ADDR, newAddress) directly and then call ss.begin(newAddress).

Calling ss.begin(newAddress) would return false.
The function can actually store the new address to EEPROM. I have verified this by calling getI2CAddr(), even after the replug the power cable.
But, the I2C address that can used to ss.begin() must still be the old one, 0x50.

Look like the gamepad does not use or care the I2C address from EEPROM.

more detail on this post https://forums.adafruit.com/viewtopic.php?t=205373

Thanks a lot

Matt

@caternuson caternuson transferred this issue from adafruit/seesaw Oct 25, 2023
@caternuson caternuson transferred this issue from adafruit/Adafruit_seesawPeripheral Oct 25, 2023
@caternuson
Copy link
Contributor

caternuson commented Oct 25, 2023

Was able to recreate this. The issue is the hardwired value of 0x3F for SEESAW_EEPROM_I2C_ADDR here:

#define SEESAW_EEPROM_I2C_ADDR \
0x3F ///< EEPROM address of i2c address to start up with (for devices that
///< support this feature)

That's the correct location for SAMD based seesaw firmware:
https://github.com/adafruit/seesaw/blob/af364d5bcd24330fbb00d9c34e6b27f090af7ab3/include/RegisterMap.h#L215

However, for ATtiny based seesaw firmware, the location is the end of EEPROM, which is determined dynamically:
https://github.com/adafruit/Adafruit_seesawPeripheral/blob/12dd2e85d294eee182922d6cc544f17bb30ef19a/Adafruit_seesawPeripheral.h#L26
The EEPROM address location ends up being 0x7F on ATtiny816 used on GamePad. (ATtiny16xx's would be 0xFF)

So this library is reading/writing to the incorrect EEPROM location for any ATtiny based seesaw product.

@pongsagon
Copy link
Author

Thanks I can change the I2C address now.

Adafruit_seesaw ss;
...
uint8_t newAddress = 0x49;
ss.EEPROMWrite8(0x7F, newAddress);
delay(250);
ss.begin(newAddress); // now return true and can read the input

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants