MarkusLange / OneWireSlave

38 stars 9 forks source link

Code writes HIGH to bus, when it probably should not #1

Open positron96 opened 10 years ago

positron96 commented 10 years ago

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 commented 10 years ago

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

MarkusLange commented 10 years ago

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

positron96 commented 10 years ago

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.

orgua commented 8 years ago

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