[WIP/Released] P1 Data injector

Everything about software tools, new software development and toolchains. For developers, mostly.

Moderator: marcelr

Re: P1 Data injector

Postby timkoers » Wed Aug 29, 2018 5:24 pm

I've decompiled the hdrv_p1 binary, and I came across the following

isSmart web check.png
isSmart web check
isSmart web check.png (6.99 KiB) Viewed 693 times


The name of the function suggest that Toon checks with Quby/Eneco if the reported meter (with it's serial number) is a smart meter (mine is not, otherwhise this project didn't exist)
I'll try to do a man in the middle attack on my Toon to verify this :P
timkoers
Starting Member
Starting Member
 
Posts: 40
Joined: June 2018

Re: P1 Data injector

Postby marcelr » Wed Aug 29, 2018 5:27 pm

timkoers wrote:Could you send me the build environment you have for building packages for the Toon?
Thanks!


That's a tall order. The oe development tree has grown to a size of 30-odd GB. That's not easily transferred.
marcelr
Advanced Member
Advanced Member
 
Posts: 935
Joined: May 2012
Location: Ehv

Re: P1 Data injector

Postby timkoers » Wed Aug 29, 2018 5:31 pm

marcelr wrote:That's a tall order. The oe development tree has grown to a size of 30-odd GB. That's not easily transferred.

Yes I'm sorry!
I think the key to solving this problem is to pause the execution of the program and look at it's buffers, so that's why the gdb comes in handy.

Could you build it for me? :D
timkoers
Starting Member
Starting Member
 
Posts: 40
Joined: June 2018

Re: P1 Data injector

Postby marcelr » Wed Aug 29, 2018 5:33 pm

I think it's been built three to four years ago :-) . Will put it on the ftp server later today. You may also want strace and tcpdump, I guess?
marcelr
Advanced Member
Advanced Member
 
Posts: 935
Joined: May 2012
Location: Ehv

Re: P1 Data injector

Postby timkoers » Wed Aug 29, 2018 5:34 pm

marcelr wrote:I think it's been built three to four years ago :-) . Will put it on the ftp server later today. You may also want strace and tcpdump, I guess?


That would be really nice, whilest you're at it!
timkoers
Starting Member
Starting Member
 
Posts: 40
Joined: June 2018

Re: P1 Data injector

Postby marcelr » Wed Aug 29, 2018 7:36 pm

It should be all there. Same spot as last time, deps should be complete as well.
marcelr
Advanced Member
Advanced Member
 
Posts: 935
Joined: May 2012
Location: Ehv

Re: P1 Data injector

Postby timkoers » Wed Aug 29, 2018 9:46 pm

marcelr wrote:It should be all there. Same spot as last time, deps should be complete as well.


Hero!

I'll try to give it a try tomorrow!
timkoers
Starting Member
Starting Member
 
Posts: 40
Joined: June 2018

Re: P1 Data injector

Postby timkoers » Mon Sep 10, 2018 7:53 pm

marcelr wrote:It should be all there. Same spot as last time, deps should be complete as well.


During the installation it shows gdb: unsatisfied recommendation for glibc-thread-db, but it installs and works.

Could you build gdbserver? With that one I can debug the hdrv_p1 code remotely.
timkoers
Starting Member
Starting Member
 
Posts: 40
Joined: June 2018

Re: P1 Data injector

Postby marcelr » Mon Sep 10, 2018 8:19 pm

timkoers wrote:Could you build gdbserver? With that one I can debug the hdrv_p1 code remotely.

It's inside the oe-tree, will give it a shot.
marcelr
Advanced Member
Advanced Member
 
Posts: 935
Joined: May 2012
Location: Ehv

Re: P1 Data injector

Postby timkoers » Mon Sep 10, 2018 8:29 pm

marcelr wrote:
timkoers wrote:Could you build gdbserver? With that one I can debug the hdrv_p1 code remotely.

It's inside the oe-tree, will give it a shot.


Thanks!

According to TheHogNL, in /qmf/etc/qmf_release.xml there is a <uartcheck> enabled section under the hdrv_p1. Not sure what it does but maybe that is causing your issue.

I've turned off the uartcheck and I do get loads of ACTION_RESPONSES instead of only ACTION_INVOKES. Still no data. The Toon crashes regularly when (wrong) data is being fed into the P1 port.
timkoers
Starting Member
Starting Member
 
Posts: 40
Joined: June 2018

Re: P1 Data injector

Postby marcelr » Mon Sep 10, 2018 8:32 pm

Done, available from the usual location.
marcelr
Advanced Member
Advanced Member
 
Posts: 935
Joined: May 2012
Location: Ehv

Re: P1 Data injector

Postby timkoers » Sat Sep 15, 2018 4:07 pm

I think I've overseen a very important note.

Logical levels are specified as follows:
SPACE “0” usually > 4V
MARK “1” as < 1 V


Meaning, the levels are inverted. Right?

I'll try to add an inverter since I've not got any useful data out of my two day debugging session, other than that the hdrv_zwave decides if the meter report is unsolicited or not.

Also there seems to be some kind of table with meter information, and if you leave the CRC out of the telegram, it looks like the table gets resetted or something
timkoers
Starting Member
Starting Member
 
Posts: 40
Joined: June 2018

Re: P1 Data injector

Postby marcelr » Sat Sep 15, 2018 4:50 pm

Right. And port settings were a bit exotic as well : 7E1, instead of the usual 8N1.
marcelr
Advanced Member
Advanced Member
 
Posts: 935
Joined: May 2012
Location: Ehv

Re: P1 Data injector

Postby hvxl » Sat Sep 15, 2018 5:28 pm

DSMR 3 was 7E1, DSMR 4 and 5 use the normal 8N1.
Schelte
hvxl
Senior Member
Senior Member
 
Posts: 1106
Joined: June 2010

Re: P1 Data injector

Postby hvxl » Sat Sep 15, 2018 5:35 pm

timkoers wrote:Meaning, the levels are inverted. Right?

Correct. I was wondering before why you are messing with level shifters. The specs indicate that the interface may be accomplished by opto-couplers. So, that's what I would have done: Just attach the serial output of a Raspberry Pi or Arduino to an opto-coupler and you should be all set. That way you also avoid any issues with grounds being tied together. Unfortunately I didn't have time to check myself if that would work. I still don't.
Schelte
hvxl
Senior Member
Senior Member
 
Posts: 1106
Joined: June 2010

PreviousNext

Return to Toon software development

Who is online

Users browsing this forum: WickedMaster and 1 guest