Hi Henrik,
I can't answer you questions I'm afraid but I would add a few comments.
I have been using Pi's since they were first released and yes, I have
had a few problems as well. The most common problem I have found is
power supply, always worth using a decent one, I use Meanwell units in
critical situations. Second on the list is SD cards, I have had loads
of failures there and I generally use hard drives recovered from old
laptops instead of SD cards.
The biggest problem I have had with 1-wire is that it occasionally locks
up. I use a Sheepwalk RPi3 adapter to give me 8 channels, that uses the
DS2482-800 chip. When a lock-up occurs it needs a power cycle of
1-wire, reboot does not reset it. The solution I use for that is to use
a second Pi which drives a relay (driven via GPIO pins) and 1-wire power
is routed through a normally closed contact on the relay. Pi-monitor
reads a heartbeat file on pi-control and if the heartbeat is more than
30 seconds old it energises the relay for 10 seconds. This is
controlling a solar hot water system, which can easily boil (and has
several times) if the controls do not function correctly.
Best of luck with your system.
Mick
On 12/09/2020 11:32, Henrik Östman wrote:
Hi!
I have been following the OWFS project for 20+ years and I really
think it's a marvelous piece of software. It's been run on a Raspberry
Pi for many years now to control the heating in our house.
However lately my Raspberry Pi has been more and more unstable,
overheating problems, diskfailure, hanging, owserver unexpectedly
going down and soo forth. It really got me thinking if my setup is the
best approche, my wife and kids should not have to be Unix admins and
be able to SSH to my server and restart the Docker container with
Owserver just to not freeze when I'm out on a business trip! So in a
true Unix spirit I'm splitting my Home automation system appart into
well defined pieces that "do one thing and do it well".
My house is heated by water-based floor heating, and there are three
floor heating control centers, with relays opening and closing the
water-valves. Each control center has a DS2408 controlling the relayes
of 3-5 valves. A made a small circuit board with a commonly used
Arduino compatible microcontroller that reads the temperature in the
rooms using DS1820 sensors, then instructs the DS2408 to open/close
the right valve. There is one circuit board for each control center,
so if one goes down only a few rooms get affected. There is a
reset-button on each circuit board that could be used to restart it
for whatever reason, and since there are no filesystems mounted there
is no problem with corruption in case of power loss, and restarting
only takes a second. The Raspberry Pi is now only used for plotting
graphs, MQTT and other home automation tasks.
Since I no longer use Owserver in my setup, I understand that it may
be inappropriate to ask for help within this forum. But I know that
there are some 10+ years skilled developers here with deep knowledge
of 1-Wire systems so I'm still going to pop the questions, maybe you
could direct me to a more suitable forum where we could continue the
discussion?
The problem I'm having is with the DS2408 devices, I only seem to be
able to communicate with them using the SKIP-ROM command, if I try to
address them individually then I only get garbage and errors back. The
same code works great when addressing DS2423 and DS18(B/S)20 devices,
so I think the code itself should work. Maybe I have missed something
when communicating or initializing the DS2408? I tried to read all the
Maxim specs, and it feels like I'm doing everything right. During
startup I begin with initializing the DS2408 and set the pins to
output and to a known state.
void ds2408_reset(DS2480B &ds, onewireNode &node) {
ESP_LOGD(TAG, "Reset DS2408, id: %s.", node.idStr.c_str());
if (existTestMode(ds, node)) {
// Configure RSTZ as STRB output.
//ds.select(node.id <http://node.id>); // reselect last selected device.
ds.write(SKIP_ROM);// HACK, this select all devices on the bus, but we
should select only this single device. Though I get CRC-errors using
above line.
ds.write(0xCC);// Issue Write Conditional Search Register command
ds.write(0x8D);// TA1, target address = 8Dh
ds.write(0x00);// TA2, target address = 008Dh
ds.write(0x04);// Write byte to Control/Status Register, RSTZ as STRB
output
// Verify configuration setting
if (!ds.reset()) {
ESP_LOGW(TAG, "Reset DS2408 failed after non-success configure RSTZ as
STRB.");
node.errors++;
return;
}
ds.write(RESUME);// reselect last selected device.
ds.write(0xF0);// Issue Read PIO Registers command
ds.write(0x8D);// TA1, target address = 8Dh
ds.write(0x00);// TA2, target address = 008Dh
auto status = ds.read();// Read Control/Status Register and verify
ESP_LOGD(TAG, "DS2408 verify configuration setting: %s.",
String(status, HEX));
// Set all relays off.
setState(ds, node, B11111111);
} else {
ESP_LOGW(TAG, "Reset DS2408 failed for id: %s.", node.idStr.c_str());
}
}
/**
* Exit test-mode.
* "The DS2408 is sensitive to the power-on slew rate and can
inadvertently power up with a test mode
* feature enabled. When this occurs, the P0 port does not respond to
the Channel Access Write command."
* @return0=failed, 1=success
*/
bool existTestMode(DS2480B &ds, onewireNode &node) {
// RST PD 96h <64-bit DS2408 ROM Code> 3Ch RST PD
if (ds.reset()) {// onewire initialization sequence, to be followed by
other commands
ds.write(0x96);
for (uint8_t i = 0; i < 8; i++) {
ds.write(node.id[i]);
}
ds.write(0x3C);
if (ds.reset()) {
return 1;
}
}
return 0;
}
int16_t setState(DS2480B &ds, onewireNode &node, uint8_t state) {
if (node.id[0] != DS2408) {
ESP_LOGW(TAG, "Device is not a DS2408!");
return -1;
}
if (ds.reset()) {// onewire initialization sequence, to be followed by
other commands
ESP_LOGD(TAG, "Set DS2408 state to: %s.", String(state, BIN));
uint8_t retries = MAX_CONSECUTIVE_RETRIES;
//ds.select(node.id <http://node.id>); // issues onewire "MATCH ROM"
address which selects a SPECIFIC (only one) 1-Wire device
ds.write(SKIP_ROM);// HACK, this select all devices on the bus, but we
should select only this single device. Though I get CRC-errors using
above line.
do {
ds.write(0x5A);// Issue Channel-access Write command
ds.write(state);// Write byte to PIO
ds.write(~state);// Write inverted byte to PIO
auto status = ds.read();// Read for verification (AAh = success)
auto newState = ds.read();// DS2408 samples PIO pin status
if (status == 0xAA) {// AAh = success
ESP_LOGD(TAG, "DS2408 current state: %s.", String(newState, BIN));
node.success++;
return newState;
} else {
node.errors++;
ESP_LOGW(TAG, "DS2408 setState failed, trying again...");
if (ds.reset()) {
ds.write(RESUME);// reselect last selected device.
} else {
ESP_LOGW(TAG, "Reset DS2408 failed after non-success setState.");
node.errors++;
return -1;
}
}
} while (--retries);
return -1;
} else {
ESP_LOGW(TAG, "Reset DS2408 failed.");
node.errors++;
return -1;
}
}
When using "ds.select(node.id <http://node.id>);" it does not work,
with "ds.write(SKIP_ROM) it works better, the question is why? And if
it does matter, the circuit-board is using a DS2480 to communicate
with the other devices.
Any help or suggestions would be more than welcome!
Thanks!
// Henrik
_______________________________________________
Owfs-developers mailing list
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers
_______________________________________________
Owfs-developers mailing list
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers