0
\$\begingroup\$

I've been reading documentation on 1-wire and I think I'm having a brainfart. How does the slave differentiate a read slot from a write slot?

reference: https://www.maximintegrated.com/en/app-notes/index.mvp/id/126

enter image description here

For example, lets say I want to read. First i go through the reset procedure and check if any slaves are on the line. Afterwards I pull the line down for time A (~6us) and then release. The slave should then keep the line low or release it which would be a read of 0 or 1.

How is this any different from write? If I bring the line down for time A (~6us) and then the slave keeps it low I would think that looks identical to a write 0 slot. Similarly, if I bring the line down for time A (~6us) and then release and the slave allows it to go high that would look identical to a write 1 slot.

\$\endgroup\$
0
\$\begingroup\$

The master is the one who decides the timing on the bus. Therefore to start clocking out data bits from slave it must send a short low pulse, and depending on which data bit the slave wants to send it will either do nothing or pull the line down so it looks like a long pulse. The master then determines the bit if the pulse was long or short.

But before the slave sends out anything, the master needs to send out a command packet (e.g. please send me temperature data) which puts the slave into transmitting a response (e.g. here is temperature data) back.

\$\endgroup\$
  • \$\begingroup\$ I see. Does 1-wire specify that command structure or does 1-wire specify when the slave is transmitting or receiving, or is this implementation dependant? \$\endgroup\$ – serpixo May 10 '19 at 18:11
  • \$\begingroup\$ Each chip works differently. You send something that makes a chip respond and then read the response. Take a look at first 1-wire component datasheet you can find such as the ds1820 temp sensor. \$\endgroup\$ – Justme May 10 '19 at 18:22
0
\$\begingroup\$

This would be done with a higher layer of the protocol. Write bits to select the device and start a read operation, then perform the proper number of read cycles when the device expects them to collect the response. You're correct that the read and write slots appear identical, there is no reason for them to differ.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.