PCA9547 Support/Autodetect #87

Merged
sb10q merged 6 commits from mwojcik/zynq-rs:pca9547_support into master 2022-02-11 12:38:59 +08:00

With the recent chip shortage, I2C multiplexer got changed from PCA9548 to PCA9547 on kasli-soc only.

This PR incorporates autodetect code for the I2C driver for kasli-soc. It resets the PCA954x with I2C_SW_RESET (MIO_33) and checks the config register contents - which default behaviour of differs (0x00 for PCA9548, 0x08 for PCA9547) - and uses that knowledge to properly set chosen channel, making the interface simpler too.

Since i2c::pca9548_select function name changed to i2c::pca954x_select this will also require an update in artiq-zynq.

With the recent chip shortage, I2C multiplexer got changed from PCA9548 to PCA9547 on kasli-soc only. This PR incorporates autodetect code for the I2C driver for kasli-soc. It resets the PCA954x with I2C_SW_RESET (MIO_33) and checks the config register contents - which default behaviour of differs (0x00 for PCA9548, 0x08 for PCA9547) - and uses that knowledge to properly set chosen channel, making the interface simpler too. Since i2c::pca9548_select function name changed to i2c::pca954x_select this will also require an update in artiq-zynq.
mwojcik added 5 commits 2022-02-11 11:30:20 +08:00
sb10q reviewed 2022-02-11 11:43:50 +08:00
@ -113,0 +166,4 @@
0x00 => I2cMultiplexer::PCA9548,
0x08 => I2cMultiplexer::PCA9547,
_ => { return Err("Unknown response for PCA954X autodetect")},
};

I suggest logging which chip was detected to help troubleshooting possible problems.

I suggest logging which chip was detected to help troubleshooting possible problems.
mwojcik added 1 commit 2022-02-11 12:00:44 +08:00
sb10q merged commit 26ab2927b9 into master 2022-02-11 12:38:59 +08:00
mwojcik deleted branch pca9547_support 2022-02-11 12:43:15 +08:00
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: M-Labs/zynq-rs#87
There is no content yet.