The idea is to use DS18B20U and DS2401 on the same wire (ESP12, pin IO0). On that line I have a 4.7K pull-up resistor.
The DS2401 can work only in setup as obviously it doesn't need to work in loop. But the temperature sensor should work all the time.
I tried both devices separated and both works.
Libs I used:
When both connected, the DS18B20U works. The 2401 does not.
Any idea what is wrong? Can those two different ICs work on the same wire?
Two data lines connected to the IO0, with a pull-up resistor. I can make a schematic if you need. But it is so simple circuit. If those devices are separated, if I try them one by one, both works, one by one. When both are connected to IO0, only temp sensor works. The DS2401 throw this error with the lib example:
CRC Not Valid!!!
Examples are from the libraries I provided. There is no sketch of my own.
64-BIT Lasered ROM code
Each DS18B20 contains a unique 64–bit code (see Figure
8) stored in ROM. The least significant 8 bits of the ROM
code contain the DS18B20’s 1-Wire family code: 28h. The
next 48 bits contain a unique serial number. The most
significant 8 bits contain a cyclic redundancy check (CRC)
byte that is calculated from the first 56 bits of the ROM
code.
Read ROM [33h]
This command allows the bus master to read the DS2401’s 8-bit family code, unique 48-bit serial number, and 8-bit CRC. This command can only be used if there is a single DS2401 on the bus. If more than one slave is present on the bus, a data collision will occur when all slaves try to transmit at the same time (open drain will produce a wired-AND result).
A similar statement appears in the DS18B20 datasheet:
Read Rom [33h]
This command can only be used when there is one slave on the bus. It allows the bus master to read the slave’s 64-bit ROM code without using the Search ROM procedure. If this command is used when there is more than one slave present on the bus, a data collision will occur when all the slaves attempt to respond at the same time
Counterfeit DS18B20 do not conform.
I have some of these that worked fine with an Arduino sketch that ignores the ROM check (but not with RP2040 programs - that are dependent on it).
The libraries I'm familiar with use the search algorithm described in this application note: One Wire Search Algorithm
to determine the addresses of multiple slaves on the bus.