I tried your library, it works flawlessly, congratulations!
I would like to implement a 1 wire slave which responds to two different ROM-s, one would send the temperature, the other would send the humidity, both being measured by a SHT21 sensor. Do you have any suggestions on how to implement it using your library? Getting data out of the SHT21 is no big deal, the trick I need is how to use your library to simulate two devices at the same time.
I am thinking of something similar to what is achieved in this library https://github.com/orgua/OneWireHub that uses normal timing and not interrupts like yours.
Any suggestion is welcome!
Hello,
I tried your library, it works flawlessly, congratulations!
I would like to implement a 1 wire slave which responds to two different ROM-s, one would send the temperature, the other would send the humidity, both being measured by a SHT21 sensor. Do you have any suggestions on how to implement it using your library? Getting data out of the SHT21 is no big deal, the trick I need is how to use your library to simulate two devices at the same time.
I am thinking of something similar to what is achieved in this library https://github.com/orgua/OneWireHub that uses normal timing and not interrupts like yours.
Any suggestion is welcome!
This should be possible with a few modifications of the library.
I don't know if you're familiar with the 1-wire protocol about ROM response. The master will send a search ROM command, then read bits. Each device sends its ROM, bit by bit. They first send the bit, then the inverse. The master reads this, and sends it back. At some point, multiple devices will send a different bit, in which case the one sending a zero "wins", because pulling the bus low is stronger than letting it float high. Therefor, when the master sends the bit back, it won't match for some devices, which will stop trying to send their ROM at that point. At the end, the master reads an entire ROM. To get the other ROMs, it will restart the sequence, but when it detects a conflict (this is why devices send a ROM bit and then its inverse, allowing the master to detect when two devices try to send a different bit), it will choose to response with the ROM it hasn't already found, allowing another device to continue sending its ROM.
So, what you need to do is emulate two devices responding simultaneously ; that is, when you get two different bits to send at the same time, send a zero.
The implementation is in OneWireSlave::beginSearchRomSendBit_ to send one ROM bit, and OneWireSlave::searchRomOnBitReceived_ to receive what the master has seen on the bus (and decide wether you continue sending your ROM or stop at that point). You will need to maintain two ROM states (which byte you are currently sending, and if search has already stopped for one or the other ROM).
I think it's not too complicated to get working, but I don't have time to work on this (and I don't expect to get more free time any time soon), so I just hope this gives you clues about how to do it yourself.
Let me know of your findings, or if you want more details on something.
Hello,
This should be possible with a few modifications of the library.
I don't know if you're familiar with the 1-wire protocol about ROM response. The master will send a search ROM command, then read bits. Each device sends its ROM, bit by bit. They first send the bit, then the inverse. The master reads this, and sends it back. At some point, multiple devices will send a different bit, in which case the one sending a zero "wins", because pulling the bus low is stronger than letting it float high. Therefor, when the master sends the bit back, it won't match for some devices, which will stop trying to send their ROM at that point. At the end, the master reads an entire ROM. To get the other ROMs, it will restart the sequence, but when it detects a conflict (this is why devices send a ROM bit and then its inverse, allowing the master to detect when two devices try to send a different bit), it will choose to response with the ROM it hasn't already found, allowing another device to continue sending its ROM.
So, what you need to do is emulate two devices responding simultaneously ; that is, when you get two different bits to send at the same time, send a zero.
The implementation is in `OneWireSlave::beginSearchRomSendBit_` to send one ROM bit, and `OneWireSlave::searchRomOnBitReceived_` to receive what the master has seen on the bus (and decide wether you continue sending your ROM or stop at that point). You will need to maintain two ROM states (which byte you are currently sending, and if search has already stopped for one or the other ROM).
I think it's not too complicated to get working, but I don't have time to work on this (and I don't expect to get more free time any time soon), so I just hope this gives you clues about how to do it yourself.
Let me know of your findings, or if you want more details on something.
Hello,
I tried your library, it works flawlessly, congratulations!
I would like to implement a 1 wire slave which responds to two different ROM-s, one would send the temperature, the other would send the humidity, both being measured by a SHT21 sensor. Do you have any suggestions on how to implement it using your library? Getting data out of the SHT21 is no big deal, the trick I need is how to use your library to simulate two devices at the same time.
I am thinking of something similar to what is achieved in this library https://github.com/orgua/OneWireHub that uses normal timing and not interrupts like yours.
Any suggestion is welcome!
Hello,
This should be possible with a few modifications of the library.
I don't know if you're familiar with the 1-wire protocol about ROM response. The master will send a search ROM command, then read bits. Each device sends its ROM, bit by bit. They first send the bit, then the inverse. The master reads this, and sends it back. At some point, multiple devices will send a different bit, in which case the one sending a zero "wins", because pulling the bus low is stronger than letting it float high. Therefor, when the master sends the bit back, it won't match for some devices, which will stop trying to send their ROM at that point. At the end, the master reads an entire ROM. To get the other ROMs, it will restart the sequence, but when it detects a conflict (this is why devices send a ROM bit and then its inverse, allowing the master to detect when two devices try to send a different bit), it will choose to response with the ROM it hasn't already found, allowing another device to continue sending its ROM.
So, what you need to do is emulate two devices responding simultaneously ; that is, when you get two different bits to send at the same time, send a zero.
The implementation is in
OneWireSlave::beginSearchRomSendBit_
to send one ROM bit, andOneWireSlave::searchRomOnBitReceived_
to receive what the master has seen on the bus (and decide wether you continue sending your ROM or stop at that point). You will need to maintain two ROM states (which byte you are currently sending, and if search has already stopped for one or the other ROM).I think it's not too complicated to get working, but I don't have time to work on this (and I don't expect to get more free time any time soon), so I just hope this gives you clues about how to do it yourself.
Let me know of your findings, or if you want more details on something.
Hello,
Thanks, this is a good starting point. I will come back to you if I have made progress or if I face some big issues.
Regards,