thelsing / knx

knx stack (TP, IP and RF) for arduino and linux, Can be configured with ETS
GNU General Public License v3.0
269 stars 94 forks source link

Via ETS: Programming the physical address only works very rarely. Mostly never. At some point, with luck, it works. #287

Open radontec opened 1 month ago

radontec commented 1 month ago

Hello everyone. I have a question. I have the example knx-demo.ino working in Platform IO. knx-demo-ip.knxprod works.

I have already made my own project. Not much changed. Just adapted the channels. But everything is still on a demo basis.

Via ETS: Programming the physical address only works very rarely. Mostly never. At some point, with luck, it works. Then I can transfer the application program over and over again. Always works perfectly. No matter how often, it works great.

I delete the ESP. Then I can no longer get the device programmed via ETS With a lot of patience and luck, it works at some point. Can't say what the problem is.

Can anyone tell me where I could look? What information do you need? Possibly my project?

2

1

thelsing commented 1 month ago

Its hard to say what the problem is. You probably have compare the telegrams ETS sends and receives with the one the devices sends and recieves. People were having issues with igmp-proxies. Maybe that's your problem too.

The hex codes are hard to read. It might be good to add a toString() method to the CemiFrame class and print them out in DataLinkLayer::frameReceived and IpDataLinkLayer::sendFrame (it would be even better to add it to DataLinkLayer::sendFrame but this requires a bit more work, as DataLinkLayer::sendFrame is currently a pure virtual method.

Trexis5 commented 1 month ago

Proxy is not aktiv.

11 10 09 08

Trexis5 commented 1 month ago

Here the Debug:

AddressType is not GroupAddress or Destination is not 0 -> 06 10 05 30 00 13 29 00 B4 D0 11 41 30 46 03 00 80 38 00 KnxIpServiceType: 530 RoutingIndication len: 19 Pufferinhalt: 06 10 05 30 00 13 29 00 B4 D0 11 41 30 46 03 00 80 38 00


CemiFrame Received: AckType: 0 AddressType: 128 Destination: 12358 Source: 4417 FrameFormat: 128 Priority: 4 NPDU: 0x3ffb1d10 Own Address: 65535 SystemBroadcast: 16 29 00 B4 D0 11 41 30 46 03 00 80 38 00 CemiFrame Received: Header: 29 00 B4 D0 11 41 Msg Code: 30 Add.Info Length: 46 Ctrl 1: | 03 (Frame Type: 0, Reserved: 0, Repeat Flag: 0, System Broadcast: 0, Priority: 0, Acknowledge Request: 1, Confirm: 1) Ctrl 2: | 00 (Destination Address Type: 0, Hop Count: 0, Extended Frame Format: 0) Source Address: 8038 (32824) Dest. Address: 0000 (0) Data Length: 00 APDU: 00 00

` std::string toStringdecode() const { std::stringstream ss; ss << std::hex << std::uppercase << std::setw(2) << std::setfill('0');

    // Header (6 bytes)
    ss << "Header: ";
    for (int i = 0; i < 6; ++i) {
        ss << std::setw(2) << static_cast<int>(_data[i]) << " ";
    }
    ss << "\r\n";

    // Message Code (1 byte)
    ss << "Msg Code: " << std::setw(2) << static_cast<int>(_data[6]) << "\r\n";

    // Add.Info Length (1 byte)
    ss << "Add.Info Length: " << std::setw(2) << static_cast<int>(_data[7]) << "\r\n";

    // Control Field 1 (1 byte)
    ss << "Ctrl 1: | " << std::setw(2) << static_cast<int>(_data[8]) << " (";
    ss << "Frame Type: " << ((_data[8] >> 7) & 1) << ", ";
    ss << "Reserved: " << ((_data[8] >> 6) & 1) << ", ";
    ss << "Repeat Flag: " << ((_data[8] >> 5) & 1) << ", ";
    ss << "System Broadcast: " << ((_data[8] >> 4) & 1) << ", ";
    ss << "Priority: " << ((_data[8] >> 3) & 3) << ", ";
    ss << "Acknowledge Request: " << ((_data[8] >> 1) & 1) << ", ";
    ss << "Confirm: " << (_data[8] & 1) << ")\r\n";

    // Control Field 2 (1 byte)
    ss << "Ctrl 2: | " << std::setw(2) << static_cast<int>(_data[9]) << " (";
    ss << "Destination Address Type: " << ((_data[9] >> 7) & 1) << ", ";
    ss << "Hop Count: " << ((_data[9] >> 4) & 7) << ", ";
    ss << "Extended Frame Format: " << (_data[9] & 15) << ")";

    // Source Address (2 bytes as uint16)
    uint16_t sourceAddress = (_data[10] << 8) | _data[11];
    ss << "\r\nSource Address: " << std::setw(4) << std::setfill('0') << std::hex << sourceAddress << " (" << std::dec << sourceAddress << ")\r\n";

    // Destination Address (2 bytes as uint16)
    uint16_t destAddress = (_data[12] << 8) | _data[13];
    ss << "Dest. Address: " << std::setw(4) << std::setfill('0') << std::hex << destAddress << " (" << std::dec << destAddress << ")\r\n";

    // Data Length (1 byte)
    ss << "Data Length: " << std::setw(2) << static_cast<int>(_data[14]) << "\r\n";

    // APDU (2 bytes)
    ss << "APDU: ";
    for (int i = 15; i < 17; ++i) {
        ss << std::setw(2) << static_cast<int>(_data[i]) << " ";
    }

    return ss.str();
}; 

`

thelsing commented 2 weeks ago

I added more logging in the devel branch. If you set the ApplicationLayer Logger to Info you should be able to spot the difference between ets monitor and the telegrams that reach the device.