initial commit
This commit is contained in:
71
Investigation/ProtocolAnalyse.txt
Normal file
71
Investigation/ProtocolAnalyse.txt
Normal file
@ -0,0 +1,71 @@
|
||||
0011: 02 17 9C B9 00 08 9C 41 00 02 04 3E 03 00 00 EB CC (Lese 9CB9:08), (Sende) (zähler)3E (cmd)03 (Data) 0000
|
||||
0015: 02 17 10 3E 00 03 01 00 00 00 00 00 00 00 00 00 00 00 00 74 1B Default response
|
||||
-----------
|
||||
00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18
|
||||
0015: 02 17 10 70 00 03 01 02 10 00 00 00 00 00 00 00 00 00 00 6C 88 <- Tor auf pressed
|
||||
0015: 02 17 10 78 00 03 01 01 10 00 00 00 00 00 00 00 00 00 00 6F 4A <- Tor auf released
|
||||
ORG: 00 00
|
||||
0015: 02 17 10 6C 00 03 01 02 20 00 00 00 00 00 00 00 00 00 00 9B 41 <- Tor zu pressed
|
||||
0015: 02 17 10 78 00 03 01 01 20 00 00 00 00 00 00 00 00 00 00 90 4A <- Tor zu released
|
||||
ORG: 00 00
|
||||
0015: 02 17 10 02 00 03 01 02 40 00 00 00 00 00 00 00 00 00 00 C9 0C <- Stop pressed
|
||||
0015: 02 17 10 05 00 03 01 01 40 00 00 00 00 00 00 00 00 00 00 8F 3A <- Stop released
|
||||
ORG 00 00
|
||||
0015: 02 17 10 48 00 03 01 02 00 40 00 00 00 00 00 00 00 00 00 29 4E <- Lüftunsschalter pressed
|
||||
0015: 02 17 10 4C 00 03 01 01 00 40 00 00 00 00 00 00 00 00 00 2F 89 <- Lüftunsschalter released
|
||||
ORG: 00 00
|
||||
0015: 02 17 10 44 00 03 01 02 00 04 00 00 00 00 00 00 00 00 00 6F 4A <- 1/2 pressed
|
||||
0015: 02 17 10 53 00 03 01 01 00 04 00 00 00 00 00 00 00 00 00 24 B0 <- 1/2 released
|
||||
ORG 00 00
|
||||
0015: 02 17 10 0A 00 03 01 10 00 02 00 00 00 00 00 00 00 00 00 02 F9 <- Lichtschalter pressed
|
||||
0015: 02 17 10 0D 00 03 01 08 00 02 00 00 00 00 00 00 00 00 00 60 EB <- Lichtschalter released
|
||||
ORG: 00 00
|
||||
-----------
|
||||
0011: 02 17 9C B9 00 02 9C 41 00 02 04 0F04 1700 7B 21 <- 0F zähler, 04 cmd? data: 1700 (licht an) oder 1701 (licht aus)
|
||||
0009: 02 17 04 0F00 04FD 0A 72 <- 0F00 zähler, 04FD 04 cmd, FD result?
|
||||
|
||||
|
||||
###################################################################################
|
||||
# Broadcast Message
|
||||
###################################################################################
|
||||
001B: 00 10 9D 31 00 09 12 65 00 00 00 40 60 00 00 00 00 00 00 00 10 00 01 00 00 5A 1D <- Licht startet
|
||||
001B: 00 10 9D 31 00 09 12 66 00 00 00 40 60 00 00 00 00 00 00 00 14 00 01 00 00 5B 99 <- Licht an
|
||||
001B: 00 10 9D 31 00 09 12 3A 00 00 00 40 60 00 00 00 00 00 00 00 04 00 01 00 00 48 18 <- Licht geht aus
|
||||
001B: 00 10 9D 31 00 09 12 3D 00 00 00 40 60 00 00 00 00 00 00 00 00 00 01 00 00 08 AD <- Licht ist aus
|
||||
00
|
||||
------------------
|
||||
|
||||
AA: Zielwert?
|
||||
BB: Istwert
|
||||
CC: 0x40 Tor zu, 0x01 Tor öffnet, 0x20 Tor komplett auf, 0x02 Tor schließt, 0x05 1/2 öffnen, 0x80 Teilgeöffnet, 0x00 gestoppt
|
||||
0x42(66) kurz beim schließen
|
||||
|
||||
|
||||
DD: ? Geschwindigkeit / Kraft?
|
||||
|
||||
AA BB CC DD
|
||||
00 01 02 03 04 05 06 07 08 09 00 01 02 03 04 05 06 07 08 09 00 01 02 03 04 05 06
|
||||
001B: 00 10 9D 31 00 09 12 53 00 00 00 40 60 00 00 00 00 00 00 00 14 00 01 00 00 44 5B <- Tor zu
|
||||
001B: 00 10 9D 31 00 09 12 55 00 C8 00 01 60 00 00 00 00 00 00 00 14 00 01 00 00 B2 05 <- Tor öffnet komplett
|
||||
001B: 00 10 9D 31 00 09 12 5B 00 C8 04 01 60 00 00 00 00 0E 00 00 14 00 01 00 00 55 61
|
||||
001B: 00 10 9D 31 00 09 12 5D 00 C8 04 01 60 00 00 00 00 0E 00 00 14 00 01 00 00 B5 E8
|
||||
001B: 00 10 9D 31 00 09 12 60 00 C8 06 01 60 00 00 00 00 0E 00 00 14 00 01 00 00 AA 49
|
||||
001B: 00 10 9D 31 00 09 12 63 00 C8 08 01 60 00 00 00 00 0E 00 00 14 00 01 00 00 D4 09
|
||||
001B: 00 10 9D 31 00 09 12 65 00 C8 0A 01 60 00 00 00 00 0E 00 00 14 00 01 00 00 B6 81
|
||||
001B: 00 10 9D 31 00 09 12 67 00 C8 0C 01 60 00 00 00 00 0E 00 00 14 00 01 00 00 91 3B
|
||||
001B: 00 10 9D 31 00 09 12 68 00 C8 0E 01 60 00 00 00 00 0E 00 00 14 00 01 00 00 20 2D
|
||||
001B: 00 10 9D 31 00 09 12 6A 00 C8 10 01 60 00 00 00 00 0E 00 00 14 00 01 00 00 1F 9D
|
||||
001B: 00 10 9D 31 00 09 12 6C 00 C8 12 01 60 00 00 00 00 0E 00 00 14 00 01 00 00 7D 15
|
||||
..
|
||||
001B: 00 10 9D 31 00 09 12 2F 00 C8 C6 01 60 00 00 00 00 02 00 00 14 00 01 00 00 4C 8F
|
||||
001B: 00 10 9D 31 00 09 12 30 00 C8 C8 20 60 00 00 00 00 00 00 00 14 00 01 00 00 55 A1 <- Tor komplett auf
|
||||
..
|
||||
001B: 00 10 9D 31 00 09 12 11 00 00 38 02 60 00 00 00 00 09 00 00 14 00 01 00 00 4A 0D <- Tor schließt
|
||||
001B: 00 10 9D 31 00 09 12 4F 00 00 16 02 60 00 00 00 00 06 00 00 14 00 01 00 00 D7 AB
|
||||
001B: 00 10 9D 31 00 09 12 53 00 00 14 02 60 00 00 00 00 06 00 00 14 00 01 00 00 92 3C
|
||||
001B: 00 10 9D 31 00 09 12 0A 00 00 00 02 60 00 00 00 00 03 00 00 14 00 01 00 00 84 83
|
||||
001B: 00 10 9D 31 00 09 12 0B 00 00 00 40 60 00 00 00 00 00 00 00 14 00 01 00 00 D7 28 <- Tor komplett zu
|
||||
|
||||
|
||||
001B: 00 10 9D 31 00 09 12 30 00 C8 00 05 60 00 00 00 00 00 00 00 14 00 01 00 00 B9 12 <- 1/2 Öffnung
|
||||
001B: 00 10 9D 31 00 09 12 59 00 18 18 80 60 00 00 00 00 00 00 00 14 00 01 00 00 B5 41 <- 1/2 Teilgeöffnet
|
5
Investigation/bussniffer/.gitignore
vendored
Normal file
5
Investigation/bussniffer/.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
.pio
|
||||
.vscode/.browse.c_cpp.db*
|
||||
.vscode/c_cpp_properties.json
|
||||
.vscode/launch.json
|
||||
.vscode/ipch
|
39
Investigation/bussniffer/include/README
Normal file
39
Investigation/bussniffer/include/README
Normal file
@ -0,0 +1,39 @@
|
||||
|
||||
This directory is intended for project header files.
|
||||
|
||||
A header file is a file containing C declarations and macro definitions
|
||||
to be shared between several project source files. You request the use of a
|
||||
header file in your project source file (C, C++, etc) located in `src` folder
|
||||
by including it, with the C preprocessing directive `#include'.
|
||||
|
||||
```src/main.c
|
||||
|
||||
#include "header.h"
|
||||
|
||||
int main (void)
|
||||
{
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
Including a header file produces the same results as copying the header file
|
||||
into each source file that needs it. Such copying would be time-consuming
|
||||
and error-prone. With a header file, the related declarations appear
|
||||
in only one place. If they need to be changed, they can be changed in one
|
||||
place, and programs that include the header file will automatically use the
|
||||
new version when next recompiled. The header file eliminates the labor of
|
||||
finding and changing all the copies as well as the risk that a failure to
|
||||
find one copy will result in inconsistencies within a program.
|
||||
|
||||
In C, the usual convention is to give header files names that end with `.h'.
|
||||
It is most portable to use only letters, digits, dashes, and underscores in
|
||||
header file names, and at most one dot.
|
||||
|
||||
Read more about using header files in official GCC documentation:
|
||||
|
||||
* Include Syntax
|
||||
* Include Operation
|
||||
* Once-Only Headers
|
||||
* Computed Includes
|
||||
|
||||
https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html
|
46
Investigation/bussniffer/lib/README
Normal file
46
Investigation/bussniffer/lib/README
Normal file
@ -0,0 +1,46 @@
|
||||
|
||||
This directory is intended for project specific (private) libraries.
|
||||
PlatformIO will compile them to static libraries and link into executable file.
|
||||
|
||||
The source code of each library should be placed in a an own separate directory
|
||||
("lib/your_library_name/[here are source files]").
|
||||
|
||||
For example, see a structure of the following two libraries `Foo` and `Bar`:
|
||||
|
||||
|--lib
|
||||
| |
|
||||
| |--Bar
|
||||
| | |--docs
|
||||
| | |--examples
|
||||
| | |--src
|
||||
| | |- Bar.c
|
||||
| | |- Bar.h
|
||||
| | |- library.json (optional, custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html
|
||||
| |
|
||||
| |--Foo
|
||||
| | |- Foo.c
|
||||
| | |- Foo.h
|
||||
| |
|
||||
| |- README --> THIS FILE
|
||||
|
|
||||
|- platformio.ini
|
||||
|--src
|
||||
|- main.c
|
||||
|
||||
and a contents of `src/main.c`:
|
||||
```
|
||||
#include <Foo.h>
|
||||
#include <Bar.h>
|
||||
|
||||
int main (void)
|
||||
{
|
||||
...
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
PlatformIO Library Dependency Finder will find automatically dependent
|
||||
libraries scanning project source files.
|
||||
|
||||
More information about PlatformIO Library Dependency Finder
|
||||
- https://docs.platformio.org/page/librarymanager/ldf.html
|
14
Investigation/bussniffer/platformio.ini
Normal file
14
Investigation/bussniffer/platformio.ini
Normal file
@ -0,0 +1,14 @@
|
||||
; PlatformIO Project Configuration File
|
||||
;
|
||||
; Build options: build flags, source filter
|
||||
; Upload options: custom upload port, speed and extra flags
|
||||
; Library options: dependencies, extra library storages
|
||||
; Advanced options: extra scripting
|
||||
;
|
||||
; Please visit documentation for the other options and examples
|
||||
; https://docs.platformio.org/page/projectconf.html
|
||||
|
||||
[env:esp12e]
|
||||
platform = espressif8266
|
||||
board = esp12e
|
||||
framework = arduino
|
81
Investigation/bussniffer/src/main.cpp
Normal file
81
Investigation/bussniffer/src/main.cpp
Normal file
@ -0,0 +1,81 @@
|
||||
#include <Arduino.h>
|
||||
#include <SoftwareSerial.h>
|
||||
|
||||
|
||||
SoftwareSerial RS485(D6,D7);
|
||||
#define RS485IF RS485
|
||||
//#define RS485IF Serial
|
||||
|
||||
|
||||
void setup()
|
||||
{
|
||||
// Hörmann HCP2 based on modbus rtu @57.6kB 8E1
|
||||
RS485IF.begin(57600,SWSERIAL_8E1);
|
||||
Serial.begin(115200,SERIAL_8N1);
|
||||
}
|
||||
|
||||
#define T3_5 1750
|
||||
|
||||
#define BUFFERSIZE 255
|
||||
int rxlen = 0;
|
||||
int txlen = 0;
|
||||
byte rxbbuffer[BUFFERSIZE];
|
||||
byte txbbuffer[BUFFERSIZE];
|
||||
|
||||
unsigned long recvTime =0;
|
||||
unsigned long recvStartTime =0;
|
||||
unsigned long recvGapTime = 0;
|
||||
|
||||
void sendUShort(ushort data){
|
||||
Serial.write(data>>8);
|
||||
Serial.write(data&0xFF);
|
||||
}
|
||||
|
||||
int loopcount = 0;
|
||||
void loop()
|
||||
{
|
||||
if(loopcount==0)
|
||||
{
|
||||
rxlen=0;
|
||||
rxbbuffer[rxlen++] = 0x8;
|
||||
rxbbuffer[rxlen++] = 0xDE;
|
||||
rxbbuffer[rxlen++] = 0xAD;
|
||||
rxbbuffer[rxlen++] = 0xBE;
|
||||
rxbbuffer[rxlen++] = 0xEF;
|
||||
rxbbuffer[rxlen++] = 0xDE;
|
||||
rxbbuffer[rxlen++] = 0xAD;
|
||||
rxbbuffer[rxlen++] = 0xBE;
|
||||
rxbbuffer[rxlen++] = 0xEF;
|
||||
|
||||
Serial.write(rxbbuffer,rxlen);
|
||||
|
||||
rxlen=0;
|
||||
loopcount=1;
|
||||
}
|
||||
|
||||
if(RS485IF.available() >0)
|
||||
{
|
||||
if(rxlen==0){
|
||||
recvStartTime = micros();
|
||||
recvGapTime = recvStartTime-recvTime;
|
||||
}
|
||||
rxlen+= RS485IF.readBytes((char*)(rxbbuffer+rxlen), _min(BUFFERSIZE-rxlen,RS485IF.available()));
|
||||
recvTime = micros();
|
||||
|
||||
}
|
||||
|
||||
if(rxlen>0 && (micros()-recvTime > T3_5 || rxlen > 0x80))
|
||||
{
|
||||
Serial.write(rxlen); // Len
|
||||
sendUShort((short)recvGapTime); // Gap
|
||||
sendUShort((short)recvTime-recvStartTime); // Packagelen
|
||||
Serial.write(rxbbuffer,rxlen);
|
||||
rxlen=0;
|
||||
}
|
||||
|
||||
if(Serial.available() >0)
|
||||
{
|
||||
rxlen= Serial.readBytes((char*)(rxbbuffer), _min(BUFFERSIZE,Serial.available()));
|
||||
RS485IF.write(rxbbuffer,rxlen);
|
||||
}
|
||||
}
|
11
Investigation/bussniffer/test/README
Normal file
11
Investigation/bussniffer/test/README
Normal file
@ -0,0 +1,11 @@
|
||||
|
||||
This directory is intended for PlatformIO Unit Testing and project tests.
|
||||
|
||||
Unit Testing is a software testing method by which individual units of
|
||||
source code, sets of one or more MCU program modules together with associated
|
||||
control data, usage procedures, and operating procedures, are tested to
|
||||
determine whether they are fit for use. Unit testing finds problems early
|
||||
in the development cycle.
|
||||
|
||||
More information about PlatformIO Unit Testing:
|
||||
- https://docs.platformio.org/page/plus/unit-testing.html
|
BIN
Investigation/oszi/busscan.png
Normal file
BIN
Investigation/oszi/busscan.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 106 KiB |
53
Investigation/readme.txt
Normal file
53
Investigation/readme.txt
Normal file
@ -0,0 +1,53 @@
|
||||
Hardware/Protocol:
|
||||
####################
|
||||
RS 485 Modbus 57,6 kB - 8E1 LSB
|
||||
IOLevel 0-3,2 V
|
||||
|
||||
|
||||
Protocol:
|
||||
##########
|
||||
https://modbus.org/docs/Modbus_Application_Protocol_V1_1b.pdf
|
||||
|
||||
Request (Master):
|
||||
92 SlaveID
|
||||
17 Function code: Read/Write Multiple registers
|
||||
9C B9 Read Starting Address
|
||||
00 05 Quantity to Read
|
||||
9C 41 Write Starting Address
|
||||
00 03 Quantity to Write
|
||||
06 Write Byte Count
|
||||
00 02 00 00 01 00
|
||||
15 D9 CRC ModBUS
|
||||
|
||||
Response (Slave)
|
||||
92 SlaveID
|
||||
17 Function code
|
||||
05 Byte Count
|
||||
XX XX XX XX XX
|
||||
YY YY CRC ModBus
|
||||
|
||||
|
||||
Antwortzeitverhalten Master<> Slave:
|
||||
min 3974 ms
|
||||
max 5916 ms
|
||||
|
||||
|
||||
Kommunikation (siehe ProtocolAnalyse.txt):
|
||||
nach dem BUS-Scan wird folgendes Muster immer wieder durchlaufen:
|
||||
|
||||
Master: Statusabfrage
|
||||
02 17 9C B9 00 08 9C 41 00 02 04 3E 03 00 00 EB CC
|
||||
Slave: Status des Erweiterungsboards
|
||||
02 17 10 3E 00 03 01 00 00 00 00 00 00 00 00 00 00 00 00 74 1B
|
||||
Master (Broadcast): Status des Antriebs
|
||||
00 10 9D 31 00 09 12 16 00 C8 C8 20 60 00 00 00 00 00 00 00 14 00 01 00 00 BE E2
|
||||
|
||||
|
||||
Besondere Nachrichten:
|
||||
1. Beim Lichtschalten:
|
||||
Master: 02 17 9C B9 00 02 9C 41 00 02 04 0F 04 17 00 7B 21 <- 0F zähler, 04 cmd? data: 1700 (licht an) oder 1701 (licht aus)
|
||||
Slave: 02 17 04 0F00 04FD 0A 72 <- 0F00 zähler, 04FD 04 cmd, FD result? Konstante Nachricht?
|
||||
|
||||
2. Busscan
|
||||
Master: 02 17 9C B9 00 05 9C 41 00 03 06 00 02 00 00 01 02 f8 35
|
||||
Slave: 02 17 0a 00 00 02 05 04 30 10 ff a8 45 0e df
|
Reference in New Issue
Block a user