OneWireSlave icon indicating copy to clipboard operation
OneWireSlave copied to clipboard

Code writes HIGH to bus, when it probably should not

Open positron96 opened this issue 11 years ago • 4 comments

Hello. I noticed DIRECT_WRITE_HIGH call in sendBit. Shoul not it be changed to DIRECT_MODE_INPUT to make bus float? The specs say that devices should not (and do not have to) pull the bus high. This issue will probably break my project where an raspberry master (with 3.3V) communicates with arduino slave (by pulling the bus to 5V arduino will probably damage rpi).

positron96 avatar Mar 02 '14 14:03 positron96

https://github.com/MarkusLange/OneWireSlave/blob/master/OneWireSlave.cpp#L565

positron96 avatar Mar 02 '14 14:03 positron96

It has to call DIRECT_WRITE_HIGH to send the bit that has to be send, and yes it will kill your raspberry pi input you will need an levelchanger or an uC running at 3.3V to use it save

MarkusLange avatar Mar 05 '14 00:03 MarkusLange

Could you explain why it has to write high? High level should be provided by external pullups on the bus automatically without software intervention if I am not missing anything.

positron96 avatar Mar 19 '14 07:03 positron96

just for the record: this is a bug, since the bus is used only as open-drain by master and slaves. if someone wants to communicate, the bus will be pulled low, the HIGH part comes from the PU-Resistor. if you replace this line with DIRECT_INPUT it will work as needed

orgua avatar Feb 24 '16 10:02 orgua