I have managed to get a Zero 2W to run in Slave mode, as long as I don't expect General Call messages, but what I'd really love to do is have bi-directional communication. On the Pico this is no problem, but on the Zero only the PiGpio seems to give me responder ("slave") mode.
The approach I take on the Pico is to put it in responder mode, and have it reset the I2C connection briefly while I send out messages, then go back to responder. It even works with interrupts.
On the Zero 2W I managed to get responder mode working with bsc_i2c(), but "switching back" to transmitting doesn't work. Looking at the documentation for i2c_open(), I noticed it refers to GPIO pins 2 and 3 for bus 1 (I saw somewhere that bus 0 is actually something internal and maybe even related to the HDMI output?) but bsc_i2c() uses pins 18 and 19. Is that correct? Do I need to connect 2 to 18 and 3 to 19 to get them to work on the same bus? I mean, I2C is a bus, right?
If instead I need to use bsc_i2c() or bsc_xfer() te send a message, how does that work? bsc_i2c() has two places to specify the address, but somehow my gut feeling is that it can only be used to listen.
The approach I take on the Pico is to put it in responder mode, and have it reset the I2C connection briefly while I send out messages, then go back to responder. It even works with interrupts.
On the Zero 2W I managed to get responder mode working with bsc_i2c(), but "switching back" to transmitting doesn't work. Looking at the documentation for i2c_open(), I noticed it refers to GPIO pins 2 and 3 for bus 1 (I saw somewhere that bus 0 is actually something internal and maybe even related to the HDMI output?) but bsc_i2c() uses pins 18 and 19. Is that correct? Do I need to connect 2 to 18 and 3 to 19 to get them to work on the same bus? I mean, I2C is a bus, right?
If instead I need to use bsc_i2c() or bsc_xfer() te send a message, how does that work? bsc_i2c() has two places to specify the address, but somehow my gut feeling is that it can only be used to listen.
Statistics: Posted by bert-laverman — Wed Apr 17, 2024 7:59 pm — Replies 0 — Views 29