Hi,
I'm working on an extension to the OneWire C & Python library to support Atmel SI/O (used by the AT21CS01). Timing on this bus is much faster than 1-Wire, but I seem to be writing bits correctly (after adding some new C methods to read and write whole bytes). The issue I currently have is reading the ACK/NACK bit (sent by the slave) after writing out a byte.
To cause the slave to emit the ACK, you pulse the bus low for between 1 and 2 us. An ACK by the slave will extends that low pulse to 4us or so.
When writing to an address without a slave (not expecting an ACK), this code produces a low-pulse of 1.3 us and returns NACK -- as expected.
common_hal_digitalio_digitalinout_set_value(&self->pin, false);
common_hal_digitalio_digitalinout_set_value(&self->pin, true);
bool value = common_hal_digitalio_digitalinout_get_value(&self->pin);
But when writing to an address with a slave, my logic analyzer sees the low-pulse extending to 4us in duration, but the get_value function still sees the bus as high.
To see if the sampling of the bus is too late (say at 5us after the start of the low pulse instead of 3 us), I inserted another set_value(false); set_value(true) after the get_value call. That extends the low-period to 4.7 us, without a high pulse see -- meaning the get_value is happening during the slave-extended low pulse.
I know this is a bit confusing, see the attached image. Left side is after a byte write to an invalid address (expecting a NACK). Right side is after writing to a valid address (expecting an ACK). In both cases, this extra 'debug' bus assertion has been added right after the get_value call.

My question: why does get_value return true, when it seems the bus is in a low-state? The function should be able to sample an open-drain output, right? Note that I can't switch the pin to an input as that would take too long and the ACK would be missed.
Hi,
I'm working on an extension to the OneWire C & Python library to support Atmel SI/O (used by the AT21CS01). Timing on this bus is much faster than 1-Wire, but I seem to be writing bits correctly (after adding some new C methods to read and write whole bytes). The issue I currently have is reading the ACK/NACK bit (sent by the slave) after writing out a byte.
To cause the slave to emit the ACK, you pulse the bus low for between 1 and 2 us. An ACK by the slave will extends that low pulse to 4us or so.
When writing to an address without a slave (not expecting an ACK), this code produces a low-pulse of 1.3 us and returns NACK -- as expected.
But when writing to an address with a slave, my logic analyzer sees the low-pulse extending to 4us in duration, but the
get_valuefunction still sees the bus as high.To see if the sampling of the bus is too late (say at 5us after the start of the low pulse instead of 3 us), I inserted another
set_value(false); set_value(true)after theget_valuecall. That extends the low-period to 4.7 us, without a high pulse see -- meaning theget_valueis happening during the slave-extended low pulse.I know this is a bit confusing, see the attached image. Left side is after a byte write to an invalid address (expecting a NACK). Right side is after writing to a valid address (expecting an ACK). In both cases, this extra 'debug' bus assertion has been added right after the
get_valuecall.My question: why does get_value return true, when it seems the bus is in a low-state? The function should be able to sample an open-drain output, right? Note that I can't switch the pin to an input as that would take too long and the ACK would be missed.