Closed codeaholics closed 7 years ago
your issue is different and might be related to using the GPIO. Please check this wiki entry: eBus-with-Raspberry-Pi-Serial
I've already seen that page. It doesn't have much useful info on it, unfortunately. Interestingly, I'm using the same boiler as the original author (an EcoFit Pure).
It's not clear to me what could be causing this. I believe the latency issue is just on sending, but even if it's on reading that will surely just make the whole signal delayed - it won't affect the timing of individual bits and bytes.
@russss as the original author of that wiki page, can you add any further info here? (Also, do you have a CSV file for an EcoFit Pure and/or a VR33?)
try adding the --latency parameter as described on that page. and post a snippet of the ebusd log file after ebusd was started with --lograwdata=bytes, where the snippet covers some lines before and after the signal lost message.
Here's one without the --latency
2017-06-08 18:50:46.231 [bus notice] <aa
2017-06-08 18:50:46.424 [bus notice] <7f
2017-06-08 18:50:46.424 [bus notice] <08
2017-06-08 18:50:46.424 [bus notice] <b5
2017-06-08 18:50:46.425 [bus notice] <10
2017-06-08 18:50:46.425 [bus notice] <09
2017-06-08 18:50:46.425 [bus notice] <00
2017-06-08 18:50:46.425 [bus notice] <00
2017-06-08 18:50:46.425 [bus notice] <14
2017-06-08 18:50:46.467 [bus notice] <ff
2017-06-08 18:50:46.467 [bus notice] <ff
2017-06-08 18:50:46.468 [bus notice] <00
2017-06-08 18:50:46.468 [bus notice] <01
2017-06-08 18:50:46.468 [bus notice] <ff
2017-06-08 18:50:46.468 [bus notice] <00
2017-06-08 18:50:46.468 [bus notice] <d0
2017-06-08 18:50:46.497 [bus notice] <00
2017-06-08 18:50:46.497 [bus notice] <aa
2017-06-08 18:50:46.695 [bus notice] <7f
2017-06-08 18:50:46.695 [bus notice] <15
2017-06-08 18:50:46.695 [bus notice] <07
2017-06-08 18:50:46.695 [bus notice] <04
2017-06-08 18:50:46.696 [bus notice] <00
2017-06-08 18:50:46.696 [bus notice] <b4
2017-06-08 18:50:48.019 [bus debug] ERR: read timeout during skip, switching to no signal
2017-06-08 18:50:48.019 [bus error] signal lost
2017-06-08 18:50:48.048 [bus notice] <7f
2017-06-08 18:50:48.048 [bus notice] signal acquired
2017-06-08 18:50:48.048 [bus notice] <08
2017-06-08 18:50:48.048 [bus notice] <b5
2017-06-08 18:50:48.048 [bus notice] <11
2017-06-08 18:50:48.049 [bus notice] <01
2017-06-08 18:50:48.049 [bus notice] <80
2017-06-08 18:50:48.049 [bus notice] <9f
2017-06-08 18:50:48.114 [bus notice] <00
2017-06-08 18:50:48.114 [bus notice] <aa
Here's one with --latency
. It's fair to say it seems to survive longer with this parameter, but it could be my imagination. I thought this was only useful on the sending side?
2017-06-08 18:52:15.112 [bus notice] <aa
2017-06-08 18:52:15.314 [bus notice] <7f
2017-06-08 18:52:15.314 [bus notice] <08
2017-06-08 18:52:15.314 [bus notice] <b5
2017-06-08 18:52:15.314 [bus notice] <11
2017-06-08 18:52:15.314 [bus notice] <01
2017-06-08 18:52:15.314 [bus notice] <01
2017-06-08 18:52:15.314 [bus notice] <9e
2017-06-08 18:52:15.381 [bus notice] <00
2017-06-08 18:52:15.381 [bus notice] <aa
2017-06-08 18:52:15.585 [bus notice] <7f
2017-06-08 18:52:15.585 [bus notice] <08
2017-06-08 18:52:15.585 [bus notice] <b5
2017-06-08 18:52:15.585 [bus notice] <11
2017-06-08 18:52:15.585 [bus notice] <01
2017-06-08 18:52:15.585 [bus notice] <02
2017-06-08 18:52:15.586 [bus notice] <9d
2017-06-08 18:52:15.636 [bus notice] <00
2017-06-08 18:52:15.637 [bus notice] <aa
2017-06-08 18:52:17.055 [bus debug] ERR: read timeout during skip, switching to no signal
2017-06-08 18:52:17.055 [bus error] signal lost
2017-06-08 18:52:17.085 [bus notice] <7f
2017-06-08 18:52:17.085 [bus notice] signal acquired
2017-06-08 18:52:17.085 [bus notice] <08
2017-06-08 18:52:17.085 [bus notice] <b5
2017-06-08 18:52:17.085 [bus notice] <09
2017-06-08 18:52:17.085 [bus notice] <03
2017-06-08 18:52:17.085 [bus notice] <0d
2017-06-08 18:52:17.085 [bus notice] <4b
2017-06-08 18:52:17.085 [bus notice] <00
2017-06-08 18:52:17.102 [bus notice] <f3
2017-06-08 18:52:17.135 [bus notice] <00
2017-06-08 18:52:17.135 [bus notice] <aa
2017-06-08 18:52:15.637 [bus notice] <aa 2017-06-08 18:52:17.055 [bus debug] ERR: read timeout during skip, switching to no signal 2017-06-08 18:52:17.055 [bus error] signal lost 2017-06-08 18:52:17.085 [bus notice] <7f
as you can see in the snippet: the time between the last SYN and the next symbol is almost 1.5 seconds. That's just way too much and way beyond the specification. You need to get that down to below 250 millis. Otherwise the communication will always yield in signal loss. So you can either live with the signal loss messages or buy a decend USB to RS232 coupler :)
I'm stuggling to understand how the RPi GPIO/UART can be this bad? If it was this fundamentally broken, surely people would be up in arms about it and it would have been fixed? I'm using it successfully on another project at 115,200 baud with no noticeable issues.
Is it possible my error is down to trimming?
This looks relevant, but doesn't provide any kind of solution: https://www.raspberrypi.org/forums/viewtopic.php?t=170945&p=1095466
I wonder how @russss is getting his to work with no issues! Also, the fact that it seems to be kernel based but this article suggests it's a hardware thing. Perhaps the kernel can re-configure the hardware but doesn't expose that to anything in user-land.
Also... I've built from source which means I have the "low latency" fix. This is confirmed to fix sending issues, so I suppose it's possible it only fixes sending issues and not receiving issues.
I can't give you answers to those questions as I'm not using the GPIO based serial port and it is clearly not recommended to be used for eBUS communication. As said, go get yourself a decent converter for about 5 EUR and you're fine.
That's fair enough. I've got one on order so I'll see how it goes when it arrives. I was trying to avoid having yet another PCB and more wires in the box.
Out of interest, what's the benefit of enforcing such rigorous timing constraints on the receiving side? I understand what the spec says, and the sending side should totally respect that, but what's gained by making the receiving side so strict?
This is curious and unfortunately I have no answers for it.
My experience (using the Pi Zero W, which I understand should be broadly identical hardware-wise to the Pi3) has shown that the latency is a fairly constant 15-18ms when transmitting, so the variance of 1.5 seconds is odd.
I confirmed this with a logic analyzer - if you can get hold of one it would be interesting to see a dump of the bus which would show whether the delay occurs on sending or receiving (the periodic SYN bytes make this quite easy to determine).
Regarding the CSV file, the ecoFIT Pure gets detected as one of the existing supported boilers (I think it was 08.bai.HW7401.csv
) and the majority of channels in that file work as expected.
My long-term goal is to spin some new PCBs which include a small microcontroller which can (optionally) handle the bus access in firmware to completely remove the effect of userspace (and stupid UARTs) on bus timings.
Thanks for the feedback @russss. I'm doing no sending at all at the moment, so this is pure receive-side spikes.
(And thanks for the info on the boiler.)
I'd be interested in helping with that. Would be nice not to need the trim pot too. Perhaps using a voltage divider and an analogue input? Or using that to sense the high and low voltages and self-trim or something like that.
The trim pot really shouldn't be necessary as the voltage levels are clearly defined by the spec. It just makes it fiddlier than it needs to be. The board I'm testing with uses an op-amp comparator with fixed trim resistors, and that seems to work fine.
@codeaholics the idea is to be spec conformant. feel free to increase the values as you need :-)
there was already a PCB suggestion for having no poti any more in the fhem forum back some time ago
@john30 Unfortunately, I'm still getting timeouts even with an RS232 to USB converter. I'm going to try process priorities now to see if this is a kernel pause thing.
Is the converter FTDI based or something different?
FT232RL. I'm getting one error approximately every 10-15 seconds. Otherwise, everything seems to be working well.
I can now send without any problems too (I had a failed component on the board), so I suspect this is something to do with kernel scheduling. However, playing with priorities didn't improve things.
is it still the signal loss issue or something else?
Just read timeouts. So it does look like the USB/RS232 adapter has improved things and removed at least one source of trouble.
2017-06-14 08:29:27.318 [bus notice] <aa
2017-06-14 08:29:27.322 [bus notice] <7f
2017-06-14 08:29:27.326 [bus notice] <15
2017-06-14 08:29:27.331 [bus notice] <07
2017-06-14 08:29:27.335 [bus notice] <04
2017-06-14 08:29:27.339 [bus notice] <00
2017-06-14 08:29:27.343 [bus notice] <b4
2017-06-14 08:29:27.369 [bus debug] ERR: read timeout during receive command ACK, switching to skip
2017-06-14 08:29:27.848 [bus notice] <aa
Interestingly, it always seems to be the same message that causes the problem:
2017-06-14 08:32:07.136 [bus debug] ERR: read timeout during receive command ACK, switching to skip
2017-06-14 08:32:07.615 [bus notice] <7f15070400b4
...
2017-06-14 08:32:21.002 [bus debug] ERR: read timeout during receive command ACK, switching to skip
2017-06-14 08:32:21.481 [bus notice] <7f15070400b4
...
2017-06-14 08:32:35.004 [bus debug] ERR: read timeout during receive command ACK, switching to skip
2017-06-14 08:32:35.482 [bus notice] <7f15070400b4
...
2017-06-14 08:32:47.057 [bus debug] ERR: read timeout during receive command ACK, switching to skip
2017-06-14 08:32:47.533 [bus notice] <7f15070400b4
Device 0x7F is a Vaillant VR33 OpenTherm to eBus adapter:
version: ebusd 3.0pre.7a569e2
signal: acquired
symbol rate: 57
max symbol rate: 139
reconnects: 0
masters: 3
messages: 197
conditional: 2
poll: 0
update: 8
address 03: master #11
address 08: slave #11, scanned "MF=Vaillant;ID=BAI00;SW=0610;HW=1303", loaded "vaillant/bai.0010015600.inc" ([PROD='0010020398']), "vaillant/08.bai.csv"
address 31: master #8, ebusd
address 36: slave #8, ebusd
address 7f: master #24
address 84: slave #24, scanned "MF=Vaillant;ID=OTS00;SW=0205;HW=9101"
If my understanding of the message format is right, the VR33 is attempting to send a message to device 0x15, but that device isn't present. Is that right?
well then there is no slave that is willing to answer the query. as the message is at debug level, this isn't really an error, it's just normal behaviour when a master sends a message to a slave that either does not exist or is not willing to answer that message. so everything seems fine from my point of view
I agree. I have to wonder what device 0x15 is and why the VR33 is trying to talk to it when it's not present! But it's not doing any harm. Thank you for your help.
0x15 is usually the main user interface and/or controller that is expected to be present
I recently created a pull request (raspberrypi/linux#5794) to Raspberry Linux Kernel with a fix that solves problems originating from the response latencies. The PL011 UART chip indeed has FIFO queues which introduce latencies the eBUS obviously doesn't like, but thankfully it also allows to control whether these queues should be enabled or not (it's a matter of a single bit in one of the configuration registers). The current implementation of the driver always assumes that FIFOs should be enabled whenever they are present, at the same time not allowing to turn this feature off when it isn't appropriate.
@russss
My experience (using the Pi Zero W, which I understand should be broadly identical hardware-wise to the Pi3) has shown that the latency is a fairly constant 15-18ms when transmitting, so the variance of 1.5 seconds is odd.
I confirmed this with a logic analyzer - if you can get hold of one it would be interesting to see a dump of the bus which would show whether the delay occurs on sending or receiving (the periodic SYN bytes make this quite easy to determine).
From my observations it seemed that the problem was with RX queues. When I was sending data through UART, the output from a logic analyzer shown that data frames were flowing out of TX pin one after another with no delays in-between. But when I did "write and read and write", then I got a big (~13 ms) delay before the second write made its way on the wires. When I disabled FIFOs, the delay dropped to 30 microseconds, so it falls into eBUS's expectations just fine.
I'm now successfully running ebusd on Raspberry Pi Zero W for almost a whole week, and it works perfectly (I already tied it with my home automation). Between eBUS and Raspberry I have a custom made hat which I based on official schematics from the eBUS specification, just level convertions.
I'm now successfully running ebusd on Raspberry Pi Zero W for almost a whole week, and it works perfectly (I already tied it with my home automation). Between eBUS and Raspberry I have a custom made hat which I based on official schematics from the eBUS specification, just level convertions.
Ah, that's good news! I'll see if I have time to spin a new design for the Pi Zero hat. I unplugged mine quite a few years ago when I switched to the vSMART thermostat and I hadn't got round to trying it again...
Hello. I'm building this eBus converter and trying to connect it to ebusd: https://wiki.fhem.de/wiki/EBUS
I've trimmed it as best I can with my bench equipment, and measured the voltages, etc. and everything is looking pretty good, except I keep getting read timeouts just while listening to the bus - not trying to send. I've read #79 about latency, and I don't think that's the issue.
I've connected the board directly to the GPIO/UART of a RPi 3. (I've tested that the board works OK with 3.3v on the low-voltage side, and it seems to be just fine). I'm running Debian Jessie (I guess Raspbian) with this kernel:
Linux ebus 4.9.24-v7+ #993 SMP Wed Apr 26 18:01:23 BST 2017 armv7l GNU/Linux
. This kernel is known to have the latency issue, I believe.I've built the daemon myself from git rev 7a569e274a4f17358a1366e664db9fae6a4e405b which includes the source code fix for setting the low-latency flag on the serial port.
Here is a snippet of my output with
--logareas=bus --loglevel=debug --lograwdata
: