Skip to content

Commit 778f92b

Browse files
authored
Update AS5600.cpp
Critical bug fix. The I2CADDR and I2CUPDT registers are single byte registers on AS5600L, without specifying this the default behaviour is to write two bytes. The address will then be mistakenly written as 0x00 which is a reserved I2C address. If this is followed by a burn settings, the wrong address may permanently be written and the sensor may be 'bricked'.
1 parent f7a91fa commit 778f92b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/encoders/as5600/AS5600.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,13 @@ void AS5600::setZPos(uint16_t value) {
124124
void AS5600::setI2CAddr(uint8_t value) {
125125
uint8_t val = (uint8_t)readRegister(AS5600_REG_I2CADDR, 1);
126126
val = (value<<1) | (val&0x01);
127-
writeRegister(AS5600_REG_I2CADDR, val);
127+
writeRegister(AS5600_REG_I2CADDR, val, 1);
128128
};
129129

130130
void AS5600::setI2CUpdt(uint8_t value) {
131131
uint8_t val = (uint8_t)readRegister(AS5600_REG_I2CUPDT, 1);
132132
val = (value<<1) | (val&0x01);
133-
writeRegister(AS5600_REG_I2CUPDT, val);
133+
writeRegister(AS5600_REG_I2CUPDT, val, 1);
134134
};
135135

136136

0 commit comments

Comments
 (0)