Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@pstolarz
Copy link

The changes are:

  1. Modifications of low level w1 bus activites (read/write bit/byte/bytes) to align with open-drain character of the w1 bus. Providing direct voltage on the open-drain medium (as in the current version) is asking for troubles and may cause damage of some types of slaves. To mimic open-drain output all high GPIO outputs on the data wire are replaced by switching the data GPIO to the input mode and therefore setting the wire high by the pull-up resistor.
  2. write() and write_bytes() handling of the power supply in the parasitic mode is changed accordingly. From now bus in the high state is always provided with the voltage by the pull-up resistor.
  3. Added touch bus activities. If you need more info about this activity look at Maxim's iButton related spec:
    http://pdfserv.maximintegrated.com/en/an/AN937.pdf
  4. Provided example for DS temperature sensors using new touch functionality. I'm not sure it's really needed but added it to illustrate the new functionality.

NOTE: The changes were tested on the AVR platform (ATmega328) with DS temp. sensors with and w/o parasitic mode. I'd be grateful for more tests on other platforms and slaves.

1. All HIGH GPIO outputs on the data wire (that is providing DIRECT voltage
   source on the bus) have been replaced by switching the GPIO to the INPUT and
   therefore setting the wire high by the pull-up resistor.
2. write() and write_bytes() handling of the pulled-up power are changed
   accordingly.
3. Added support for the touching the bus: new functtions: touch_bit(), touch()
   and touch_bytes().
Minor typos & bug fixes.
@PaoloP74
Copy link

PaoloP74 commented Jan 7, 2016

.pde extension is no longer used, change to .ino

karrots added a commit to karrots/nodemcu-firmware that referenced this pull request Apr 29, 2016
karrots added a commit to karrots/nodemcu-firmware that referenced this pull request Apr 29, 2016
karrots added a commit to karrots/nodemcu-firmware that referenced this pull request May 7, 2016
karrots added a commit to karrots/nodemcu-firmware that referenced this pull request May 11, 2016
karrots added a commit to karrots/nodemcu-firmware that referenced this pull request May 11, 2016
karrots added a commit to karrots/nodemcu-firmware that referenced this pull request Jun 6, 2016
marcelstoer pushed a commit to nodemcu/nodemcu-firmware that referenced this pull request Jun 28, 2016
@ghost
Copy link

ghost commented Aug 26, 2016

This is a pretty awesome change, any reason is hasn't been incorporated yet? :)

@PaulStoffregen
Copy link
Owner

Not yet tested on non-AVR platforms. Very likely breaks them, since this seems to assume AVR's quirky hardware register features.

@pstolarz
Copy link
Author

In what point the code "assumes AVR's quirky hardware register features" and will break non-AVR platforms?

@ghost
Copy link

ghost commented Aug 26, 2016

Testing it on other platforms might be sensible, sadly I only have an ESP8266 :) But are you sure about quirky hardware register features? Looking at the code changes I'm pretty sure it doesn't change anything at that level..

@ghost
Copy link

ghost commented Sep 15, 2016

So how are we gonna get this integrated? :) Should we ask someone to test? I don't have other platforms.. Is there a Arduino twitter or so we could throw this out to? :) Honestly I think the code is good tho, I don't see any changes related to "assumes AVR's quirky hardware register features" :)

@PaulStoffregen
Copy link
Owner

It must be tested on other boards.

@bzub
Copy link

bzub commented Jan 15, 2017

I've used the OneWire library on ESP-12E (nodemcu) with my home "MicroLan" and have had many issues achieving a stable network. After applying this pull request everything works very well without dropping sensors.

In time I can test against Arduino Uno and atmega328p-pu on the same "MicroLan". Please let me know if there are any extra testing steps I should take and report on.

I use three separate OneWire buses to separate branches of the network. Each is roughly 30m in radius and likely 50m in weight. The topology is primarily Stubbed, with some Star like branches. So it's nowhere near ideal, but perhaps good for testing the limits of a OneWire master. Please note that I had issues even testing on a breadboard with short wires without @pstolarz patch.

@bzub bzub mentioned this pull request Jan 16, 2017
@PaulStoffregen
Copy link
Owner

Sorry, I can't help with this. I don't use ESP8266. I'm depending on the ESP community to submit good pull requests.

@gunchev
Copy link

gunchev commented Jan 18, 2017

What kind of tests and on what boards are required for the change to be verified?

I have Arduino UNO, Mega, Due, Nano, micro pro, pro and some bare AVRs. On UNO/nano I used the master branch plus this change to communicate with 10 DS18B20 sensors with no problem. 5 sensors were logging data to a CSV file for 5 hours (5xDS18B29 - nano - PC).

@PaulStoffregen
Copy link
Owner

PaulStoffregen commented Jan 19, 2017

Generally, if the changes are all within the ifdefs for one type of board, it only needs to be verified on that board.

Changes outside the ifdefs should be avoided. By "avoided", you can read as "unlikely to ever be accepted".

@pstolarz
Copy link
Author

pstolarz commented Jan 19, 2017

@PaulStoffregen - thanks for stating it clear after over 1 year since issuing this PR. I think this statement should be expressed on the main page of the project (so called README) to save time other people issuing PRs to this project.

Since this implementation of one-wire is useless (at least for me) w/o this patch, I'm gonna to create my own fork of this project with more sensible support (you can read as "unlikely to wait over 1 year to reject your PR").

You may safely close this PR, as it has no more sense to hang here.

BTW. Thanks for all people for time spent on testing this PR. I appreciate it!

@Testato
Copy link

Testato commented Jan 19, 2017

This is not an "ifdef" PR.
It is for all board, it is for 328p also.

@orgua
Copy link

orgua commented Jul 16, 2017

there is one critical DIRECT_WRITE_HIGH() in write_bit() that powers the bus. All it takes to make the master open drain compatible is to put a DIRECT_MODE_INPUT() in front of it, or replace it accordingly. 200 LOC for this change are crazy. 6 lines with a proper compileswitch are enough.
even if you want to change the behaviour on runtime you just had to pass the power-argument from send() and send_bytes() deeper to send_bit() and act on it.

@pstolarz pstolarz closed this Jun 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants