Ankündigung

Einklappen
Keine Ankündigung bisher.

KonnektING library

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

    KonnektING library

    Hello,

    I'm trying the Konnekting library for the first time. I tested the communicationTest sketch, and it worked fine.
    Now I tried to implement it into a bigger project, but nothing happens, serial moniter is blanked out.. It should print lots of info on the TX/RX buffer I'm sending to the heatpump. It seems like the sketch never reaches the loop.
    If I comment away the KNX-parts, the sketch works fine polling info from the heat-pump and print it on serial monitor.

    The board seem to reboot in loop, it never prints the "Setup complete" on the serial monitor.

    Anyone have any idea, what I'm doing wrong?
    Sorry for 800 lines of code..

    Code:
    #include <REGO637.h>
    #include <Arduino.h>   // required before wiring_private.h
    #include "wiring_private.h" // pinPeripheral() function
    #include <KonnektingDevice.h>
    
    #define NUM_SYSTEMREGS     52
    #define NUM_FRONTPANEL     5
    
    #define KNX_SERIAL Serial    // D0=RX/D1=TX
    #define TEST_LED A5  // On board LED on pin D13
    #define DEBUGSERIAL SerialUSB // USB port
    
    word individualAddress = P_ADDR(1, 1, 62);
    word groupAddressOutput0 = G_ADDR(7, 1, 0);
    word groupAddressOutput1 = G_ADDR(7, 1, 1);
    word groupAddressOutput2 = G_ADDR(7, 1, 2);
    word groupAddressOutput3 = G_ADDR(7, 1, 3);
    word groupAddressOutput4 = G_ADDR(7, 1, 4);
    word groupAddressOutput5 = G_ADDR(7, 1, 5);
    word groupAddressOutput6 = G_ADDR(7, 1, 6);
    word groupAddressOutput7 = G_ADDR(7, 1, 7);
    word groupAddressOutput8 = G_ADDR(7, 1, 8);
    word groupAddressOutput9 = G_ADDR(7, 1, 9);
    word groupAddressOutput10 = G_ADDR(7, 1, 10);
    word groupAddressOutput11 = G_ADDR(7, 1, 11);
    word groupAddressOutput12 = G_ADDR(7, 1, 12);
    word groupAddressOutput13 = G_ADDR(7, 1, 13);
    word groupAddressOutput14 = G_ADDR(7, 1, 14);
    word groupAddressOutput15 = G_ADDR(7, 1, 15);
    word groupAddressOutput16 = G_ADDR(7, 1, 16);
    word groupAddressOutput17 = G_ADDR(7, 1, 17);
    word groupAddressOutput18 = G_ADDR(7, 1, 18);
    word groupAddressOutput19 = G_ADDR(7, 1, 19);
    word groupAddressOutput20 = G_ADDR(7, 1, 20);
    word groupAddressOutput21 = G_ADDR(7, 1, 21);
    word groupAddressOutput22 = G_ADDR(7, 1, 22);
    word groupAddressOutput23 = G_ADDR(7, 1, 23);
    word groupAddressOutput24 = G_ADDR(7, 1, 24);
    word groupAddressOutput25 = G_ADDR(7, 1, 25);
    word groupAddressOutput26 = G_ADDR(7, 1, 26);
    word groupAddressOutput27 = G_ADDR(7, 1, 27);
    word groupAddressOutput28 = G_ADDR(7, 1, 28);
    word groupAddressOutput29 = G_ADDR(7, 1, 29);
    word groupAddressOutput30 = G_ADDR(7, 1, 30);
    word groupAddressOutput31 = G_ADDR(7, 1, 31);
    word groupAddressOutput32 = G_ADDR(7, 1, 32);
    word groupAddressOutput33 = G_ADDR(7, 1, 33);
    word groupAddressOutput34 = G_ADDR(7, 1, 34);
    word groupAddressOutput35 = G_ADDR(7, 1, 35);
    word groupAddressOutput36 = G_ADDR(7, 1, 36);
    word groupAddressOutput37 = G_ADDR(7, 1, 37);
    word groupAddressOutput38 = G_ADDR(7, 1, 38);
    word groupAddressOutput39 = G_ADDR(7, 1, 39);
    word groupAddressOutput40 = G_ADDR(7, 1, 40);
    word groupAddressOutput41 = G_ADDR(7, 1, 41);
    word groupAddressOutput42 = G_ADDR(7, 1, 42);
    word groupAddressOutput43 = G_ADDR(7, 1, 43);
    word groupAddressOutput44 = G_ADDR(7, 1, 44);
    word groupAddressOutput45 = G_ADDR(7, 1, 45);
    word groupAddressOutput46 = G_ADDR(7, 1, 46);
    word groupAddressOutput47 = G_ADDR(7, 1, 47);
    word groupAddressOutput48 = G_ADDR(7, 1, 48);
    word groupAddressOutput49 = G_ADDR(7, 1, 49);
    word groupAddressOutput50 = G_ADDR(7, 1, 50);
    word groupAddressOutput51 = G_ADDR(7, 1, 51);
    word groupAddressOutput52 = G_ADDR(7, 1, 52);
    word groupAddressOutput53 = G_ADDR(7, 1, 53);
    word groupAddressOutput54 = G_ADDR(7, 1, 54);
    word groupAddressOutput55 = G_ADDR(7, 1, 55);
    word groupAddressOutput56 = G_ADDR(7, 1, 56);
    
    // ################################################
    // ### DEBUG Configuration
    // ################################################
    //#define KDEBUG // comment this line to disable DEBUG mode
    
    #ifdef KDEBUG
    #include <DebugUtil.h>
    #endif
    
    // Define KONNEKTING Device related IDs
    #define MANUFACTURER_ID 57005
    #define DEVICE_ID 255
    #define REVISION 0 
    KnxComObject KnxDevice::_comObjectsList[] = {
        /* Suite-Index 0 : */ KnxComObject(KNX_DPT_9_001, COM_OBJ_SENSOR),
        /* Suite-Index 1 : */ KnxComObject(KNX_DPT_9_001, COM_OBJ_SENSOR),
        /* Suite-Index 2 : */ KnxComObject(KNX_DPT_9_001, COM_OBJ_SENSOR),
        /* Suite-Index 3 : */ KnxComObject(KNX_DPT_9_001, COM_OBJ_SENSOR),
        /* Suite-Index 4 : */ KnxComObject(KNX_DPT_9_001, COM_OBJ_SENSOR),
        /* Suite-Index 5 : */ KnxComObject(KNX_DPT_9_001, COM_OBJ_SENSOR),
        /* Suite-Index 6 : */ KnxComObject(KNX_DPT_5_001, COM_OBJ_SENSOR),
        /* Suite-Index 7 : */ KnxComObject(KNX_DPT_9_001, COM_OBJ_SENSOR),
        /* Suite-Index 8 : */ KnxComObject(KNX_DPT_9_001, COM_OBJ_SENSOR),
        /* Suite-Index 9 : */ KnxComObject(KNX_DPT_9_001, COM_OBJ_SENSOR),
        /* Suite-Index 10 : */ KnxComObject(KNX_DPT_9_001, COM_OBJ_SENSOR),
        /* Suite-Index 11 : */ KnxComObject(KNX_DPT_9_001, COM_OBJ_SENSOR),
        /* Suite-Index 12 : */ KnxComObject(KNX_DPT_9_001, COM_OBJ_SENSOR),
        /* Suite-Index 13 : */ KnxComObject(KNX_DPT_9_001, COM_OBJ_SENSOR),
        /* Suite-Index 14 : */ KnxComObject(KNX_DPT_9_001, COM_OBJ_SENSOR),
        /* Suite-Index 15 : */ KnxComObject(KNX_DPT_9_001, COM_OBJ_SENSOR),
        /* Suite-Index 16 : */ KnxComObject(KNX_DPT_9_001, COM_OBJ_SENSOR),
        /* Suite-Index 17 : */ KnxComObject(KNX_DPT_9_001, COM_OBJ_SENSOR),
        /* Suite-Index 18 : */ KnxComObject(KNX_DPT_1_002, COM_OBJ_SENSOR),
        /* Suite-Index 19 : */ KnxComObject(KNX_DPT_1_002, COM_OBJ_SENSOR),
        /* Suite-Index 20 : */ KnxComObject(KNX_DPT_1_002, COM_OBJ_SENSOR),
        /* Suite-Index 21 : */ KnxComObject(KNX_DPT_1_002, COM_OBJ_SENSOR),
        /* Suite-Index 22 : */ KnxComObject(KNX_DPT_1_002, COM_OBJ_SENSOR),
        /* Suite-Index 23 : */ KnxComObject(KNX_DPT_1_002, COM_OBJ_SENSOR),
        /* Suite-Index 24 : */ KnxComObject(KNX_DPT_1_002, COM_OBJ_SENSOR),
        /* Suite-Index 25 : */ KnxComObject(KNX_DPT_1_002, COM_OBJ_SENSOR),
        /* Suite-Index 26 : */ KnxComObject(KNX_DPT_9_000, COM_OBJ_SENSOR),
        /* Suite-Index 27 : */ KnxComObject(KNX_DPT_9_000, COM_OBJ_SENSOR),
        /* Suite-Index 28 : */ KnxComObject(KNX_DPT_9_000, COM_OBJ_SENSOR),
        /* Suite-Index 29 : */ KnxComObject(KNX_DPT_9_000, COM_OBJ_SENSOR),
        /* Suite-Index 30 : */ KnxComObject(KNX_DPT_9_000, COM_OBJ_SENSOR),
        /* Suite-Index 31 : */ KnxComObject(KNX_DPT_9_000, COM_OBJ_SENSOR),
        /* Suite-Index 32 : */ KnxComObject(KNX_DPT_9_000, COM_OBJ_SENSOR),
        /* Suite-Index 33 : */ KnxComObject(KNX_DPT_9_000, COM_OBJ_SENSOR),
        /* Suite-Index 34 : */ KnxComObject(KNX_DPT_9_000, COM_OBJ_SENSOR),
        /* Suite-Index 35 : */ KnxComObject(KNX_DPT_9_000, COM_OBJ_SENSOR),
        /* Suite-Index 36 : */ KnxComObject(KNX_DPT_9_000, COM_OBJ_SENSOR),
        /* Suite-Index 37 : */ KnxComObject(KNX_DPT_9_000, COM_OBJ_SENSOR),
        /* Suite-Index 38 : */ KnxComObject(KNX_DPT_9_000, COM_OBJ_SENSOR),
        /* Suite-Index 39 : */ KnxComObject(KNX_DPT_9_000, COM_OBJ_SENSOR),
        /* Suite-Index 40 : */ KnxComObject(KNX_DPT_9_000, COM_OBJ_SENSOR),
        /* Suite-Index 41 : */ KnxComObject(KNX_DPT_9_000, COM_OBJ_SENSOR),
        /* Suite-Index 42 : */ KnxComObject(KNX_DPT_9_000, COM_OBJ_SENSOR),
        /* Suite-Index 43 : */ KnxComObject(KNX_DPT_9_000, COM_OBJ_SENSOR),
        /* Suite-Index 44 : */ KnxComObject(KNX_DPT_9_000, COM_OBJ_SENSOR),
        /* Suite-Index 45 : */ KnxComObject(KNX_DPT_9_000, COM_OBJ_SENSOR),
        /* Suite-Index 46 : */ KnxComObject(KNX_DPT_9_000, COM_OBJ_SENSOR),
        /* Suite-Index 47 : */ KnxComObject(KNX_DPT_9_000, COM_OBJ_SENSOR),
        /* Suite-Index 48 : */ KnxComObject(KNX_DPT_9_000, COM_OBJ_SENSOR),
        /* Suite-Index 49 : */ KnxComObject(KNX_DPT_9_000, COM_OBJ_SENSOR),
        /* Suite-Index 50 : */ KnxComObject(KNX_DPT_9_000, COM_OBJ_SENSOR),
        /* Suite-Index 51 : */ KnxComObject(KNX_DPT_9_000, COM_OBJ_SENSOR),
        /* Suite-Index 52 : */ KnxComObject(KNX_DPT_1_002, COM_OBJ_SENSOR),
        /* Suite-Index 53 : */ KnxComObject(KNX_DPT_1_002, COM_OBJ_SENSOR),
        /* Suite-Index 54 : */ KnxComObject(KNX_DPT_1_002, COM_OBJ_SENSOR),
        /* Suite-Index 55 : */ KnxComObject(KNX_DPT_1_002, COM_OBJ_SENSOR),
        /* Suite-Index 56 : */ KnxComObject(KNX_DPT_1_002, COM_OBJ_SENSOR),
    };
    const byte KnxDevice::_numberOfComObjects = sizeof (_comObjectsList) / sizeof (KnxComObject); // do no change this code
    
    // Definition of parameter size
    byte KonnektingDevice::_paramSizeList[] = {
        /* Param Index 0 */ PARAM_UINT16
    };
    const int KonnektingDevice::_numberOfParams = sizeof (_paramSizeList); // do no change this code
    
    //we do not need a ProgLED, but this function muss be defined
    void progLed (bool state){ 
        //nothing to do here
        Debug.println(F("Toggle ProgLED, actual state: %d"),state);
    }
    
    unsigned long sendDelay = 2000;
    unsigned long lastmillis = millis(); 
    bool lastState = false;
    bool lastLedState = false;
    byte virtualEEPROM[16];
    
    
    // ################################################
    // ### KNX EVENT CALLBACK
    // ################################################
    
    void knxEvents(byte index) {
        switch (index) {
    
            //case 0: // object index has been updated
                //Debug.println(F("ComObject 0 received: %d, let's trigger LED state"), Knx.read(0));
                //lastLedState = !lastLedState;
                //digitalWrite(TEST_LED,lastLedState);
               // break;
    
            default:
                break;
        }
    }
    
    byte readMemory(int index){
        return virtualEEPROM[index];
    }
    
    void writeMemory(int index, byte val) {
        virtualEEPROM[index] = val;
    }
    
    void updateMemory(int index, byte val) {
        if (readMemory(index) != val) {
            writeMemory(index, val);
        }
    }
    
    void commitMemory() {
    
    }
    
    int   readtoggle = 0;
    
    const uint16_t SystemRegsRead[NUM_SYSTEMREGS] =
    {
        REGO637_GT1_TGT_VALUE, //0
        REGO637_GT1_ON_VALUE, //1
        REGO637_GT1_OFF_VALUE, //2
        REGO637_GT3_ON_VALUE, //3
        REGO637_GT3_OFF_VALUE, //4
        REGO637_GT4_TGT_VALUE, //5
        REGO637_ADD_HEAT_PCT, //6
        REGO637_REG_RADRTN, //7
        REGO637_REG_OUTDOOR, //8
        REGO637_REG_HOTWATER, //9
        REGO637_REG_FORWARD, //10
        REGO637_REG_ROOM, //11
        REGO637_REG_COMPRESSOR, //12
        REGO637_REG_HEAT_FLUID_OUT, //13
        REGO637_REG_HEAT_FLUID_IN, //14
        REGO637_REG_COLD_FLUID_OUT, //15
        REGO637_REG_COLD_FLUID_IN, //16
        REGO637_REG_EXTRN_HOT_WATER, //17
        REGO637_REG_GND_LOOP_PMP, //18
        REGO637_REG_COMPR_ST, //19
        REGO637_ADDNL_HT_3KW, //20
        REGO637_ADDNL_HT_6KW, //21
        REGO637_RADIATOR_PUMP, //22
        REGO637_HEAT_CARRIER_PUMP, //23
        REGO637_THREEWAY_VALVE, //24
        REGO637_ALARM, //25
        REGO637_SETTINGS_HEAT_CURVE, //26
        REGO637_SETTINGS_HEAT_CURVE_FINE_ADJ, //27
        REGO637_SETTINGS_HEAT_CURVE_COUPL_DIFF, //28
        REGO637_SETTINGS_HEAT_CURVE_TWO, //29
        REGO637_SETTINGS_HEAT_CURVE_TW_FINE_ADJ, //30
        REGO637_SETTINGS_ADJ_CURVE_20, //31
        REGO637_SETTINGS_ADJ_CURVE_15, //32
        REGO637_SETTINGS_ADJ_CURVE_10, //33
        REGO637_SETTINGS_ADJ_CURVE_5, //34
        REGO637_SETTINGS_ADJ_CURVE_0, //35
        REGO637_SETTINGS_ADJ_CURVE_MINUS_5, //36
        REGO637_SETTINGS_ADJ_CURVE_MINUS_10, //37
        REGO637_SETTINGS_ADJ_CURVE_MINUS_15, //38
        REGO637_SETTINGS_ADJ_CURVE_MINUS_20, //39
        REGO637_SETTINGS_ADJ_CURVE_MINUS_25, //40
        REGO637_SETTINGS_ADJ_CURVE_MINUS_30, //41
        REGO637_SETTINGS_ADJ_CURVE_MINUS_35, //42
        REGO637_SETTINGS_INDOOR_TEMP_SETTING, //43
        REGO637_SETTINGS_CURVE_INF_BY_INTEMP, //44
        REGO637_SETTINGS_SUMMER_DISCONNECTION, //45
        REGO637_SETTINGS_HOT_WATER_TARGET, //46
        REGO637_SETTINGS_HOT_WATER_HYSTERESIS, //47
        REGO637_OH_RAD, //48
        REGO637_OH_DHW, //49
        REGO637_OH_ADDHEAT_RAD, //50
        REGO637_OH_ADDHEAT_DHW //51
        
    };
    
    const char *SystemRegsNames[NUM_SYSTEMREGS] =
    {
        "GT1 Target value...:", //1 temp
        "GT1 ON value.......:", //2 temp
        "GT1 OFF value......:", //3 temp
        "GT3 ON value.......:", //4 temp
        "GT3 OFF value......:", //5 temp
        "GT4 Target Value...:", //6 temp
        "ADD HEAT PCT.......:", //7 percent
        "Radiator Return....: ", //8 temp
        "Outdoor............: ", //9 temp
        "Hot water..........: ", //10 temp
        "Forward............: ", //11 temp
        "Room...............: ", //12 temp
        "Compressor.........: ", //13 temp
        "Heat fluid out.....: ", //14 temp
        "Heat fluid in......: ", //15 temp
        "Cold fluid out.....: ", //16 temp
        "Cold fluid in......: ", //17 temp
        "External hot water.: ", //18 temp
        "Ground loop pump...: ", //19 BOOL
        "Compressor on/off..: ", //20 BOOL
        "Additional 3Kw.....: ", //21 BOOL
        "Additional 6Kw.....: ", //22 BOOL
        "Radiator pump [P1].: ", //23 BOOL
        "Heat Carrier pump [P2].:", //24 BOOL
        "3-way valve on/off.:", //25 BOOL
        "Alarm..............:", //26 BOOL
        "Heat curve...................:",  //27 TEMP
        "Heat Curve fine adj..........:", //28 TEMP
        "Heat curve coupl. diff.......:", //29 TEMP
        "Heat curve two...............:", //30 TEMP
        "Heat curve two fine adj......:", //31 TEMP
        "Adjustment curve at 20.......:", //32 TEMP
        "Adjustment curve at 15.......:", //33 TEMP
        "Adjustment curve at 10.......:", //34 TEMP
        "Adjustment curve at 5........:", //35 TEMP
        "Adjustment curve at 0........:", //36 TEMP
        "Adjustment curve at min 5....:", //37 TEMP
        "Adjustment curve at min 10...:", //38 TEMP
        "Adjustment curve at min 15...:", //39 TEMP
        "Adjustment curve at min 20...:", //40 TEMP
        "Adjustment curve at min 25...:", //41 TEMP
        "Adjustment curve at min 30...:", //42 TEMP
        "Adjustment curve at min 35...:", //43 TEMP
        "Indoor temp setting..........:", //44 TEMP
        "Curve infl. by intemp........:", //45 TEMP
        "Summer Disconnection.........:", //46 TEMP
        "Hot water setpoint value.....:", //47 TEMP
        "Hot water hysteresis.........:", //48 TEMP
        "Oper.hours RAD...............:",
        "Oper.hours DHW...............:",
        "Oper.hours add heat RAD......:",
        "Oper.hours add heat DHW......:"
            
    };
    
    const int SystemRegsKNX[NUM_SYSTEMREGS] =
    {
        1,
        2,
        3,
        4,
        5,
        6,
        7,
        8,
        9,
        10,
        11,
        12,
        13,
        14,
        15,
        16,
        17,
        18,
        19,
        20,
        21,
        22,
        23,
        24,
        25,
        26,
        27,
        28,
        29,
        30,
        31,
        32,
        33,
        34,
        35,
        36,
        37,
        38,
        39,
        40,
        41,
        42,
        43,
        44,
        45,
        46,
        47,
        48,
        49,
        50,
        51,
        52,       
    };
    
    const uint16_t FrntPnlRead[NUM_FRONTPANEL] =
    {
        REGO637_FRNTPNL_LED_POWER, //52
        REGO637_FRNTPNL_LED_PUMP, //53
        REGO637_FRNTPNL_LED_ADD_HEAT, //54
        REGO637_FRNTPNL_LED_BOILER, //55
        REGO637_FRNTPNL_ALARM //56
    };
    
    const char *FrntPnlNames[NUM_FRONTPANEL] =
    {
        "LED Power.....................:", //bool
        "LED Heat pump.................:", //bool
        "LED Add heat..................:", //bool
        "LED Boiler....................:", //bool
        "LED Alarm.....................:", //bool
    };
    
    const int FrntPnlKNX[NUM_FRONTPANEL] =
    {
        52, //bool
        53, //bool
        54, //bool
        55, //bool
        56, //bool
    };
    
    Uart Serial2 (&sercom1, 11, 10, SERCOM_RX_PAD_0, UART_TX_PAD_2);
    void SERCOM1_Handler()
    {
      Serial2.IrqHandler();
    }
    
    //heatpump is on Serial2
    Rego637 Heatpump( Serial2 );
    
    byte
        nSystemRegs;
    byte
        nFrontPanel;
    
    
    void setup( void )
    { 
        memset(virtualEEPROM,0xFF,16);
        Konnekting.setMemoryReadFunc(&readMemory);
        Konnekting.setMemoryWriteFunc(&writeMemory);
        Konnekting.setMemoryUpdateFunc(&updateMemory);
        Konnekting.setMemoryCommitFunc(&commitMemory);
    
        // simulating allready programmed Konnekting device:
        // in this case we don't need Konnekting Suite
        // write hardcoded PA and GAs
        writeMemory(0,  0x7F);  //Set "not factory" flag
        writeMemory(1,  (byte)(individualAddress >> 8));
        writeMemory(2,  (byte)(individualAddress));
        writeMemory(10, (byte)(groupAddressOutput0 >> 8));
        writeMemory(11, (byte)(groupAddressOutput0));
        writeMemory(12, 0x80);  //activate InputGA
        writeMemory(13, (byte)(groupAddressOutput1 >> 8));
        writeMemory(14, (byte)(groupAddressOutput1));
        writeMemory(15, 0x80);  //activate InputGA
        writeMemory(16, (byte)(groupAddressOutput2 >> 8));
        writeMemory(17, (byte)(groupAddressOutput2));
        writeMemory(18, 0x80);  //activate InputGA
        writeMemory(19, (byte)(groupAddressOutput3 >> 8));
        writeMemory(20, (byte)(groupAddressOutput3));
        writeMemory(21, 0x80);  //activate InputGA
        writeMemory(22, (byte)(groupAddressOutput4 >> 8));
        writeMemory(23, (byte)(groupAddressOutput4));
        writeMemory(24, 0x80);  //activate InputGA
        writeMemory(25, (byte)(groupAddressOutput5 >> 8));
        writeMemory(26, (byte)(groupAddressOutput5));
        writeMemory(27, 0x80);  //activate InputGA
        writeMemory(28, (byte)(groupAddressOutput6 >> 8));
        writeMemory(29, (byte)(groupAddressOutput6));
        writeMemory(30, 0x80);  //activate InputGA
        writeMemory(31, (byte)(groupAddressOutput7 >> 8));
        writeMemory(32, (byte)(groupAddressOutput7));
        writeMemory(33, 0x80);  //activate InputGA
        writeMemory(34, (byte)(groupAddressOutput8 >> 8));
        writeMemory(35, (byte)(groupAddressOutput8));
        writeMemory(36, 0x80);  //activate InputGA
        writeMemory(37, (byte)(groupAddressOutput9 >> 8));
        writeMemory(38, (byte)(groupAddressOutput9));
        writeMemory(39, 0x80);  //activate InputGA
        writeMemory(40, (byte)(groupAddressOutput10 >> 8));
        writeMemory(41, (byte)(groupAddressOutput10));
        writeMemory(42, 0x80);  //activate InputGA
        writeMemory(43, (byte)(groupAddressOutput11 >> 8));
        writeMemory(44, (byte)(groupAddressOutput11));
        writeMemory(45, 0x80);  //activate InputGA
        writeMemory(46, (byte)(groupAddressOutput12 >> 8));
        writeMemory(47, (byte)(groupAddressOutput12));
        writeMemory(48, 0x80);  //activate InputGA
        writeMemory(49, (byte)(groupAddressOutput13 >> 8));
        writeMemory(50, (byte)(groupAddressOutput13));
        writeMemory(51, 0x80);  //activate InputGA
        writeMemory(52, (byte)(groupAddressOutput14 >> 8));
        writeMemory(53, (byte)(groupAddressOutput14));
        writeMemory(54, 0x80);  //activate InputGA
        writeMemory(55, (byte)(groupAddressOutput15 >> 8));
        writeMemory(56, (byte)(groupAddressOutput15));
        writeMemory(57, 0x80);  //activate InputGA
        writeMemory(58, (byte)(groupAddressOutput16 >> 8));
        writeMemory(59, (byte)(groupAddressOutput16));
        writeMemory(60, 0x80);  //activate InputGA
        writeMemory(61, (byte)(groupAddressOutput17 >> 8));
        writeMemory(62, (byte)(groupAddressOutput17));
        writeMemory(63, 0x80);  //activate InputGA
        writeMemory(64, (byte)(groupAddressOutput18 >> 8));
        writeMemory(65, (byte)(groupAddressOutput18));
        writeMemory(66, 0x80);  //activate InputGA
        writeMemory(67, (byte)(groupAddressOutput19 >> 8));
        writeMemory(68, (byte)(groupAddressOutput19));
        writeMemory(69, 0x80);  //activate InputGA
        writeMemory(70, (byte)(groupAddressOutput20 >> 8));
        writeMemory(71, (byte)(groupAddressOutput20));
        writeMemory(72, 0x80);  //activate InputGA
        writeMemory(73, (byte)(groupAddressOutput21 >> 8));
        writeMemory(74, (byte)(groupAddressOutput21));
        writeMemory(75, 0x80);  //activate InputGA
        writeMemory(76, (byte)(groupAddressOutput22 >> 8));
        writeMemory(77, (byte)(groupAddressOutput22));
        writeMemory(78, 0x80);  //activate InputGA
        writeMemory(79, (byte)(groupAddressOutput23 >> 8));
        writeMemory(80, (byte)(groupAddressOutput23));
        writeMemory(81, 0x80);  //activate InputGA
        writeMemory(82, (byte)(groupAddressOutput24 >> 8));
        writeMemory(83, (byte)(groupAddressOutput24));
        writeMemory(84, 0x80);  //activate InputGA
        writeMemory(85, (byte)(groupAddressOutput25 >> 8));
        writeMemory(86, (byte)(groupAddressOutput25));
        writeMemory(87, 0x80);  //activate InputGA
        writeMemory(88, (byte)(groupAddressOutput26 >> 8));
        writeMemory(89, (byte)(groupAddressOutput26));
        writeMemory(90, 0x80);  //activate InputGA
        writeMemory(91, (byte)(groupAddressOutput27 >> 8));
        writeMemory(92, (byte)(groupAddressOutput27));
        writeMemory(93, 0x80);  //activate InputGA
        writeMemory(94, (byte)(groupAddressOutput28 >> 8));
        writeMemory(95, (byte)(groupAddressOutput28));
        writeMemory(96, 0x80);  //activate InputGA
        writeMemory(97, (byte)(groupAddressOutput29 >> 8));
        writeMemory(98, (byte)(groupAddressOutput29));
        writeMemory(99, 0x80);  //activate InputGA
        writeMemory(100, (byte)(groupAddressOutput30 >> 8));
        writeMemory(101, (byte)(groupAddressOutput30));
        writeMemory(102, 0x80);  //activate InputGA
        writeMemory(103, (byte)(groupAddressOutput31 >> 8));
        writeMemory(104, (byte)(groupAddressOutput31));
        writeMemory(105, 0x80);  //activate InputGA
        writeMemory(106, (byte)(groupAddressOutput32 >> 8));
        writeMemory(107, (byte)(groupAddressOutput32));
        writeMemory(108, 0x80);  //activate InputGA
        writeMemory(109, (byte)(groupAddressOutput33 >> 8));
        writeMemory(110, (byte)(groupAddressOutput33));
        writeMemory(111, 0x80);  //activate InputGA
        writeMemory(112, (byte)(groupAddressOutput34 >> 8));
        writeMemory(113, (byte)(groupAddressOutput34));
        writeMemory(114, 0x80);  //activate InputGA
        writeMemory(115, (byte)(groupAddressOutput35 >> 8));
        writeMemory(116, (byte)(groupAddressOutput35));
        writeMemory(117, 0x80);  //activate InputGA
        writeMemory(118, (byte)(groupAddressOutput36 >> 8));
        writeMemory(119, (byte)(groupAddressOutput36));
        writeMemory(120, 0x80);  //activate InputGA
        writeMemory(121, (byte)(groupAddressOutput37 >> 8));
        writeMemory(122, (byte)(groupAddressOutput37));
        writeMemory(123, 0x80);  //activate InputGA7
        writeMemory(124, (byte)(groupAddressOutput38 >> 8));
        writeMemory(125, (byte)(groupAddressOutput38));
        writeMemory(126, 0x80);  //activate InputGA
        writeMemory(127, (byte)(groupAddressOutput39 >> 8));
        writeMemory(128, (byte)(groupAddressOutput39));
        writeMemory(129, 0x80);  //activate InputGA
        writeMemory(130, (byte)(groupAddressOutput40 >> 8));
        writeMemory(131, (byte)(groupAddressOutput40));
        writeMemory(132, 0x80);  //activate InputGA
        writeMemory(133, (byte)(groupAddressOutput41 >> 8));
        writeMemory(134, (byte)(groupAddressOutput41));
        writeMemory(135, 0x80);  //activate InputGA
        writeMemory(136, (byte)(groupAddressOutput42 >> 8));
        writeMemory(137, (byte)(groupAddressOutput42));
        writeMemory(138, 0x80);  //activate InputGA
        writeMemory(139, (byte)(groupAddressOutput43 >> 8));
        writeMemory(140, (byte)(groupAddressOutput43));
        writeMemory(141, 0x80);  //activate InputGA
        writeMemory(142, (byte)(groupAddressOutput44 >> 8));
        writeMemory(143, (byte)(groupAddressOutput44));
        writeMemory(144, 0x80);  //activate InputGA
        writeMemory(145, (byte)(groupAddressOutput45 >> 8));
        writeMemory(146, (byte)(groupAddressOutput45));
        writeMemory(147, 0x80);  //activate InputGA
        writeMemory(148, (byte)(groupAddressOutput46 >> 8));
        writeMemory(149, (byte)(groupAddressOutput46));
        writeMemory(150, 0x80);  //activate InputGA
        writeMemory(151, (byte)(groupAddressOutput47 >> 8));
        writeMemory(152, (byte)(groupAddressOutput47));
        writeMemory(153, 0x80);  //activate InputGA
        writeMemory(154, (byte)(groupAddressOutput48 >> 8));
        writeMemory(155, (byte)(groupAddressOutput48));
        writeMemory(156, 0x80);  //activate InputGA
        writeMemory(157, (byte)(groupAddressOutput49 >> 8));
        writeMemory(158, (byte)(groupAddressOutput49));
        writeMemory(159, 0x80);  //activate InputGA
        writeMemory(160, (byte)(groupAddressOutput50 >> 8));
        writeMemory(161, (byte)(groupAddressOutput50));
        writeMemory(162, 0x80);  //activate InputGA
        writeMemory(163, (byte)(groupAddressOutput51 >> 8));
        writeMemory(164, (byte)(groupAddressOutput51));
        writeMemory(165, 0x80);  //activate InputGA
        writeMemory(166, (byte)(groupAddressOutput52 >> 8));
        writeMemory(167, (byte)(groupAddressOutput52));
        writeMemory(168, 0x80);  //activate InputGA
        writeMemory(169, (byte)(groupAddressOutput53 >> 8));
        writeMemory(170, (byte)(groupAddressOutput53));
        writeMemory(171, 0x80);  //activate InputGA
        writeMemory(172, (byte)(groupAddressOutput54 >> 8));
        writeMemory(173, (byte)(groupAddressOutput54));
        writeMemory(174, 0x80);  //activate InputGA
        writeMemory(175, (byte)(groupAddressOutput55 >> 8));
        writeMemory(176, (byte)(groupAddressOutput55));
        writeMemory(177, 0x80);  //activate InputGA
        writeMemory(178, (byte)(groupAddressOutput56 >> 8));
        writeMemory(179, (byte)(groupAddressOutput56));
        writeMemory(180, 0x80);  //activate InputGA
        
        // debug related stuff
    #ifdef KDEBUG
    
        // Start debug serial with 115200 bauds
        DEBUGSERIAL.begin(115200);
    
        //waiting 3 seconds, so you have enough time to start serial monitor
        delay(3000);
    
        // make debug serial port known to debug class
        // Means: KONNEKTING will use the same serial port for console debugging
        Debug.setPrintStream(&DEBUGSERIAL);
    #endif
    
        // Initialize KNX enabled Arduino Board
        Konnekting.init(KNX_SERIAL,
                &progLed,
                MANUFACTURER_ID,
                DEVICE_ID,
                REVISION);
    
        pinMode(TEST_LED,OUTPUT);
        
        Debug.println(F("Toggle LED every %d ms."), sendDelay);
        Debug.println(F("Setup is ready. Turning LED on and going to loop..."));
        
      
        SerialUSB.begin( 19200 );         //serial monitor
        while(!SerialUSB);
        SerialUSB.println("Setup complete");
         
        Heatpump.start( 19200 );      //Rego637 heatpump
        
       pinPeripheral(10, PIO_SERCOM);
       pinPeripheral(11, PIO_SERCOM);
        
        nSystemRegs = 0;
        nFrontPanel = 0;
    
                
    }//setup
    
    void loop( void )
    {
      SerialUSB.println("Inside loop");
    
      Knx.task();
      
        static unsigned long
            timeReadRegister = 0;
    
    //    if the heatpump logic is ready, send a request for sensor data
        if( millis() - timeReadRegister > 1000 )
        {
            timeReadRegister = millis();
    
            if( readtoggle == 0)
            {
              if( Heatpump.GetMsgStatus() == MSG_IDLE )
                  Heatpump.ReadSystemRegisters( SystemRegsRead[nSystemRegs] );
            }
            else if ( readtoggle == 1)
            {
                  if( Heatpump.GetMsgStatus() == MSG_IDLE )
                  Heatpump.ReadFrontPanelRegisters( FrntPnlRead[nFrontPanel] );
            }
            
        }//if
    
        if( readtoggle == 0)
        {
          CheckSystemRegsReadMessage();
        }
        else if(readtoggle == 1)
        {
          CheckFrontPanelReadMessage();
        }
    
    
    
    
    }//loop
    
    void CheckSystemRegsReadMessage( void )
    {
      
        uint8_t
            chkRtn;
        int16_t
            sysregval;
            
        //while spinning in main, keep an eye out for a message
        chkRtn = Heatpump.CheckSysRegMessage( &sysregval );
        switch( chkRtn )
        {
            case    MSG_COMPLETE:
    
           if (Konnekting.isReadyForApplication()) {
    
               
                //message is complete; print what was received
                Heatpump.ClrMsgStatus();
                SerialUSB.print( SystemRegsNames[nSystemRegs] );
                if( (nSystemRegs >= 1) && (nSystemRegs <= 6))
                {
                  SerialUSB.print( (float)sysregval/10.0, 1 );
                  SerialUSB.println( " C" );
                  SerialUSB.println(SystemRegsKNX[nSystemRegs]);
                  Knx.write(SystemRegsKNX[nSystemRegs], (float)sysregval/10.0);
                }
     
                else if( (nSystemRegs >= 8) && (nSystemRegs <= 18))
                {
                  SerialUSB.print( (float)sysregval/10.0, 1 );
                  SerialUSB.println( " C" );
                  SerialUSB.println(SystemRegsKNX[nSystemRegs]);
                  Knx.write(SystemRegsKNX[nSystemRegs], (float)sysregval/10.0);
                }
                else if( (nSystemRegs >= 27) && (nSystemRegs <= 48))
                {
                  SerialUSB.print( (float)sysregval/10.0, 1 );
                  SerialUSB.println( " C" );
                  SerialUSB.println(SystemRegsKNX[nSystemRegs]);
                  Knx.write(SystemRegsKNX[nSystemRegs], (float)sysregval/10.0);
                }
                else
                {
                  SerialUSB.println( sysregval );
                  SerialUSB.println(SystemRegsKNX[nSystemRegs]);
                  Knx.write(SystemRegsKNX[nSystemRegs], sysregval);
                }
    
                
                nSystemRegs++;
                if( nSystemRegs == NUM_SYSTEMREGS )
                {
                    readtoggle = 1;
                    nSystemRegs = 0;
                }
            }
            break;
    
            case    MSG_IDLE:
            case    MSG_WAITING:
                //do nothing if just waiting or in idle state...
                
            break;
    
            default:
    
                //something else is going on; print verbose message of what the problem is
                //print a message to the monitor identifying the error
                SerialUSB.print( "Message error.....: " );
                SerialUSB.println( RegoErrorMsgs[chkRtn] );
                
            break;
                
        }//switch
        
    }//CheckSensorMessage
    
    
    void CheckFrontPanelReadMessage( void )
    {
        
        uint8_t
            chkRtn;
        int16_t
            frntpnlval;
            
        //while spinning in main, keep an eye out for a message
        chkRtn = Heatpump.CheckFrontPanelMessage( &frntpnlval );
        switch( chkRtn )
        {
            case    MSG_COMPLETE:
    
            if (Konnekting.isReadyForApplication()) {
                //message is complete; print what was received
                Heatpump.ClrMsgStatus();
                SerialUSB.print( FrntPnlNames[nFrontPanel] );
                SerialUSB.println( frntpnlval);       //<-- change to display oC
                Knx.write(FrntPnlKNX[nSystemRegs], frntpnlval);
    
                
                nFrontPanel++;
                if( nFrontPanel == NUM_FRONTPANEL )
                {
                    readtoggle = 0;
                    nFrontPanel = 0;
                }
            }
            break;
    
            case    MSG_IDLE:
            case    MSG_WAITING:
                //do nothing if just waiting or in idle state...
                
            break;
    
            default:
                //something else is going on; print verbose message of what the problem is
                //print a message to the monitor identifying the error
                SerialUSB.print( "Message error.....: " );
                SerialUSB.println( RegoErrorMsgs[chkRtn] );
                
            break;
                
        }//switch
        
    }//CheckSensorMessage
    Zuletzt geändert von sx3; 22.03.2019, 18:45.

    #2
    When Debug is on, this is my output:

    Code:
    DEBUG! free ram: 26319 bytes 
    Initialize KonnektingDevice
    15/7/255 = 0x7fff
    Toggle ProgLED, actual state: 0
    PrgLed 0
    PrgState 0
    Manufacturer: 0xdead Device: 0xff Revision: 0x00
    numberOfCommObjects: 57
    memRead: index=0x00 using fctptr data=0x7f
    _deviceFlags: 01111111
    ->EEPROM
    memRead: index=0x01 using fctptr data=0x11
    memRead: index=0x02 using fctptr data=0x3e
    memRead: index=0x0a using fctptr data=0x39
    memRead: index=0x0b using fctptr data=0x00
    memRead: index=0x0c using fctptr data=0x80
    ComObj index=0 HI=0x39 LO=0x00 GA=0x3900 setting=0x80 active=1
    memRead: index=0x0d using fctptr data=0x39
    memRead: index=0x0e using fctptr data=0x01
    memRead: index=0x0f using fctptr data=0x80
    ComObj index=1 HI=0x39 LO=0x01 GA=0x3901 setting=0x80 active=1
    memRead: index=0x10 using fctptr data=0x39
    memRead: index=0x11 using fctptr data=0x02
    memRead: index=0x12 using fctptr data=0x80
    ComObj index=2 HI=0x39 LO=0x02 GA=0x3902 setting=0x80 active=1
    memRead: index=0x13 using fctptr data=0x39
    memRead: index=0x14 using fctptr data=0x03
    memRead: index=0x15 using fctptr data=0x80
    ComObj index=3 HI=0x39 LO=0x03 GA=0x3903 setting=0x80 active=1
    memRead: index=0x16 using fctptr data=0x39
    memRead: index=0x17 using fctptr data=0x04
    memRead: index=0x18 using fctptr data=0x80
    ComObj index=4 HI=0x39 LO=0x04 GA=0x3904 setting=0x80 active=1
    memRead: index=0x19 using fctptr data=0x39
    memRead: index=0x1a using fctptr data=0x05
    memRead: index=0x1b using fctptr data=0x80
    ComObj index=5 HI=0x39 LO=0x05 GA=0x3905 setting=0x80 active=1
    memRead: index=0x1c using fctptr data=0x39
    memRead: index=0x1d using fctptr data=0x06
    memRead: index=0x1e using fctptr data=0x80
    ComObj index=6 HI=0x39 LO=0x06 GA=0x3906 setting=0x80 active=1
    memRead: index=0x1f using fctptr data=0x39
    memRead: index=0x20 using fctptr data=0x07
    memRead: index=0x21 using fctptr data=0x80
    ComObj index=7 HI=0x39 LO=0x07 GA=0x3907 setting=0x80 active=1
    memRead: index=0x22 using fctptr data=0x39
    memRead: index=0x23 using fctptr data=0x08
    memRead: index=0x24 using fctptr data=0x80
    ComObj index=8 HI=0x39 LO=0x08 GA=0x3908 setting=0x80 active=1
    memRead: index=0x25 using fctptr data=0x39
    memRead: index=0x26 using fctptr data=0x09
    memRead: index=0x27 using fctptr data=0x80
    ComObj index=9 HI=0x39 LO=0x09 GA=0x3909 setting=0x80 active=1
    memRead: index=0x28 using fctptr data=0x39
    memRead: index=0x29 using fctptr data=0x0a
    memRead: index=0x2a using fctptr data=0x80
    ComObj index=10 HI=0x39 LO=0x0a GA=0x390a setting=0x80 active=1
    memRead: index=0x2b using fctptr data=0x39
    memRead: index=0x2c using fctptr data=0x0b
    memRead: index=0x2d using fctptr data=0x80
    ComObj index=11 HI=0x39 LO=0x0b GA=0x390b setting=0x80 active=1
    memRead: index=0x2e using fctptr data=0x39
    memRead: index=0x2f using fctptr data=0x0c
    memRead: index=0x30 using fctptr data=0x80
    ComObj index=12 HI=0x39 LO=0x0c GA=0x390c setting=0x80 active=1
    memRead: index=0x31 using fctptr data=0x39
    memRead: index=0x32 using fctptr data=0x0d
    memRead: index=0x33 using fctptr data=0x80
    ComObj index=13 HI=0x39 LO=0x0d GA=0x390d setting=0x80 active=1
    memRead: index=0x34 using fctptr data=0x39
    memRead: index=0x35 using fctptr data=0x0e
    memRead: index=0x36 using fctptr data=0x80
    ComObj index=14 HI=0x39 LO=0x0e GA=0x390e setting=0x80 active=1
    memRead: index=0x37 using fctptr data=0x39
    memRead: index=0x38 using fctptr data=0x0f
    memRead: index=0x39 using fctptr data=0x80
    ComObj index=15 HI=0x39 LO=0x0f GA=0x390f setting=0x80 active=1
    memRead: index=0x3a using fctptr data=0x39
    memRead: index=0x3b using fctptr data=0x10
    memRead: index=0x3c using fctptr data=0x80
    ComObj index=16 HI=0x39 LO=0x10 GA=0x3910 setting=0x80 active=1
    memRead: index=0x3d using fctptr data=0x39
    memRead: index=0x3e using fctptr data=0x11
    memRead: index=0x3f using fctptr data=0x80
    ComObj index=17 HI=0x39 LO=0x11 GA=0x3911 setting=0x80 active=1
    memRead: index=0x40 using fctptr data=0x39
    memRead: index=0x41 using fctptr data=0x12
    memRead: index=0x42 using fctptr data=0x80
    ComObj index=18 HI=0x39 LO=0x12 GA=0x3912 setting=0x80 active=1
    memRead: index=0x43 using fctptr data=0x39
    memRead: index=0x44 using fctptr data=0x13
    memRead: index=0x45 using fctptr data=0x80
    ComObj index=19 HI=0x39 LO=0x13 GA=0x3913 setting=0x80 active=1
    memRead: index=0x46 using fctptr data=0x39
    memRead: index=0x47 using fctptr data=0x80
    memRead: index=0x48 using fctptr data=0x80
    ComObj index=20 HI=0x39 LO=0x80 GA=0x3980 setting=0x80 active=1
    memRead: index=0x49 using fctptr data=0x80
    memRead: index=0x4a using fctptr data=0x07
    memRead: index=0x4b using fctptr data=0x80
    ComObj index=21 HI=0x80 LO=0x07 GA=0x8007 setting=0x80 active=1
    memRead: index=0x4c using fctptr data=0x08
    memRead: index=0x4d using fctptr data=0x39
    memRead: index=0x4e using fctptr data=0x80
    ComObj index=22 HI=0x08 LO=0x39 GA=0x0839 setting=0x80 active=1
    memRead: index=0x4f using fctptr data=0x39
    memRead: index=0x50 using fctptr data=0x80
    memRead: index=0x51 using fctptr data=0x80
    ComObj index=23 HI=0x39 LO=0x80 GA=0x3980 setting=0x80 active=1
    memRead: index=0x52 using fctptr data=0x80
    memRead: index=0x53 using fctptr data=0x09
    memRead: index=0x54 using fctptr data=0x80
    ComObj index=24 HI=0x80 LO=0x09 GA=0x8009 setting=0x80 active=1
    memRead: index=0x55 using fctptr data=0x0a
    memRead: index=0x56 using fctptr data=0x39
    memRead: index=0x57 using fctptr data=0x80
    ComObj index=25 HI=0x0a LO=0x39 GA=0x0a39 setting=0x80 active=1
    memRead: index=0x58 using fctptr data=0x39
    memRead: index=0x59 using fctptr data=0x80
    memRead: index=0x5a using fctptr data=0x80
    ComObj index=26 HI=0x39 LO=0x80 GA=0x3980 setting=0x80 active=1
    memRead: index=0x5b using fctptr data=0x80
    memRead: index=0x5c using fctptr data=0x0b
    memRead: index=0x5d using fctptr data=0x80
    ComObj index=27 HI=0x80 LO=0x0b GA=0x800b setting=0x80 active=1
    memRead: index=0x5e using fctptr data=0x0c
    memRead: index=0x5f using fctptr data=0x39
    memRead: index=0x60 using fctptr data=0x80
    ComObj index=28 HI=0x0c LO=0x39 GA=0x0c39 setting=0x80 active=1
    memRead: index=0x61 using fctptr data=0x39
    memRead: index=0x62 using fctptr data=0x80
    memRead: index=0x63 using fctptr data=0x80
    ComObj index=29 HI=0x39 LO=0x80 GA=0x3980 setting=0x80 active=1
    memRead: index=0x64 using fctptr data=0x39
    memRead: index=0x65 using fctptr data=0x1e
    memRead: index=0x66 using fctptr data=0x80
    ComObj index=30 HI=0x39 LO=0x1e GA=0x391e setting=0x80 active=1
    memRead: index=0x67 using fctptr data=0x39
    memRead: index=0x68 using fctptr data=0x1f
    memRead: index=0x69 using fctptr data=0x80
    ComObj index=31 HI=0x39 LO=0x1f GA=0x391f setting=0x80 active=1
    memRead: index=0x6a using fctptr data=0x39
    memRead: index=0x6b using fctptr data=0x20
    memRead: index=0x6c using fctptr data=0x80
    ComObj index=32 HI=0x39 LO=0x20 GA=0x3920 setting=0x80 active=1
    memRead: index=0x6d using fctptr data=0x39
    memRead: index=0x6e using fctptr data=0x21
    memRead: index=0x6f using fctptr data=0x80
    ComObj index=33 HI=0x39 LO=0x21 GA=0x3921 setting=0x80 active=1
    memRead: index=0x70 using fctptr data=0x39
    memRead: index=0x71 using fctptr data=0x22
    memRead: index=0x72 using fctptr data=0x80
    ComObj index=34 HI=0x39 LO=0x22 GA=0x3922 setting=0x80 active=1
    memRead: index=0x73 using fctptr data=0x39
    memRead: index=0x74 using fctptr data=0x23
    memRead: index=0x75 using fctptr data=0x80
    ComObj index=35 HI=0x39 LO=0x23 GA=0x3923 setting=0x80 active=1
    memRead: index=0x76 using fctptr data=0x39
    memRead: index=0x77 using fctptr data=0x24
    memRead: index=0x78 using fctptr data=0x80
    ComObj index=36 HI=0x39 LO=0x24 GA=0x3924 setting=0x80 active=1
    memRead: index=0x79 using fctptr data=0x39
    memRead: index=0x7a using fctptr data=0x25
    memRead: index=0x7b using fctptr data=0x80
    ComObj index=37 HI=0x39 LO=0x25 GA=0x3925 setting=0x80 active=1
    memRead: index=0x7c using fctptr data=0x39
    memRead: index=0x7d using fctptr data=0x26
    memRead: index=0x7e using fctptr data=0x80
    ComObj index=38 HI=0x39 LO=0x26 GA=0x3926 setting=0x80 active=1
    memRead: index=0x7f using fctptr data=0x02
    memRead: index=0x80 using fctptr data=0x39
    memRead: index=0x81 using fctptr data=0x80
    ComObj index=39 HI=0x02 LO=0x39 GA=0x0239 setting=0x80 active=1
    memRead: index=0x82 using fctptr data=0x39
    memRead: index=0x83 using fctptr data=0x28
    memRead: index=0x84 using fctptr data=0x80
    ComObj index=40 HI=0x39 LO=0x28 GA=0x3928 setting=0x80 active=1
    memRead: index=0x85 using fctptr data=0x39
    memRead: index=0x86 using fctptr data=0x29
    memRead: index=0x87 using fctptr data=0x80
    ComObj index=41 HI=0x39 LO=0x29 GA=0x3929 setting=0x80 active=1
    memRead: index=0x88 using fctptr data=0x39
    memRead: index=0x89 using fctptr data=0x2a
    memRead: index=0x8a using fctptr data=0x80
    ComObj index=42 HI=0x39 LO=0x2a GA=0x392a setting=0x80 active=1
    memRead: index=0x8b using fctptr data=0x80
    memRead: index=0x8c using fctptr data=0x0d
    memRead: index=0x8d using fctptr data=0x80
    ComObj index=43 HI=0x80 LO=0x0d GA=0x800d setting=0x80 active=1
    memRead: index=0x8e using fctptr data=0x0e
    memRead: index=0x8f using fctptr data=0x39
    memRead: index=0x90 using fctptr data=0x80
    ComObj index=44 HI=0x0e LO=0x39 GA=0x0e39 setting=0x80 active=1
    memRead: index=0x91 using fctptr data=0x39
    memRead: index=0x92 using fctptr data=0x80
    memRead: index=0x93 using fctptr data=0x80
    ComObj index=45 HI=0x39 LO=0x80 GA=0x3980 setting=0x80 active=1
    memRead: index=0x94 using fctptr data=0x80
    memRead: index=0x95 using fctptr data=0x0f
    memRead: index=0x96 using fctptr data=0x80
    ComObj index=46 HI=0x80 LO=0x0f GA=0x800f setting=0x80 active=1
    memRead: index=0x97 using fctptr data=0x10
    memRead: index=0x98 using fctptr data=0x39
    memRead: index=0x99 using fctptr data=0x80
    ComObj index=47 HI=0x10 LO=0x39 GA=0x1039 setting=0x80 active=1
    memRead: index=0x9a using fctptr data=0x04
    memRead: index=0x9b using fctptr data=0x39
    memRead: index=0x9c using fctptr data=0x80
    ComObj index=48 HI=0x04 LO=0x39 GA=0x0439 setting=0x80 active=1
    memRead: index=0x9d using fctptr data=0x80
    memRead: index=0x9e using fctptr data=0x11
    memRead: index=0x9f using fctptr data=0x80
    ComObj index=49 HI=0x80 LO=0x11 GA=0x8011 setting=0x80 active=1
    memRead: index=0xa0 using fctptr data=0x39
    memRead: index=0xa1 using fctptr data=0x32
    memRead: index=0xa2 using fctptr data=0x80
    ComObj index=50 HI=0x39 LO=0x32 GA=0x3932 setting=0x80 active=1
    memRead: index=0xa3 using fctptr data=0x39
    memRead: index=0xa4 using fctptr data=0x33
    memRead: index=0xa5 using fctptr data=0x80
    ComObj index=51 HI=0x39 LO=0x33 GA=0x3933 setting=0x80 active=1
    memRead: index=0xa6 using fctptr data=0x39
    memRead: index=0xa7 using fctptr data=0x80
    memRead: index=0xa8 using fctptr data=0x80
    ComObj index=52 HI=0x39 LO=0x80 GA=0x3980 setting=0x80 active=1
    memRead: index=0xa9 using fctptr data=0x80
    memRead: index=0xaa using fctptr data=0x03
    memRead: index=0xab using fctptr data=0x80
    ComObj index=53 HI=0x80 LO=0x03 GA=0x8003 setting=0x80 active=1
    memRead: index=0xac using fctptr data=0x39
    memRead: index=0xad using fctptr data=0x80
    memRead: index=0xae using fctptr data=0x80
    ComObj index=54 HI=0x39 LO=0x80 GA=0x3980 setting=0x80 active=1
    memRead: index=0xaf using fctptr data=0x39
    memRead: index=0xb0 using fctptr data=0x37
    memRead: index=0xb1 using fctptr data=0x80
    ComObj index=55 HI=0x39 LO=0x37 GA=0x3937 setting=0x80 active=1
    memRead: index=0xb2 using fctptr data=0x39
    memRead: index=0xb3 using fctptr data=0x38
    memRead: index=0xb4 using fctptr data=0x80
    ComObj index=56 HI=0x39 LO=0x38 GA=0x3938 setting=0x80 active=1
    IA: 0x113e
    Reset triggered!
    Reset attempts: 9
    Data available: 1
    data not useable: 0x01. Expected: 0x03
    Reset attempts: 8
    Reset attempts: 7
    Reset attempts: 6
    Reset attempts: 5
    Reset attempts: 4
    Reset attempts: 3
    Reset attempts: 2
    Reset attempts: 1
    Zuletzt geändert von sx3; 22.03.2019, 19:40.

    Kommentar


      #3
      It's hard to see any faulty lin in the code. It's too big :-)

      You have two options:

      1) use a hardware debugger to see what's happening and causing the issue
      2) Add code-line by code-line to see which part breaks the sketchs.

      You're using a lot of variables, whcih consume also a lot of RAM, and KONNEKTING is also using a lot of RAM.
      On which hardware you're trying to run the code? Maybe you're running out of RAM?!
      Remember: 328p has just 2kb of RAM and 32u4 just 2,5kb, while SAMD has 32kb!

      Can you check your "freemem" when running without KONNEKTING lib? The way to access the freemem information depends on your used board/µC.

      br,
      Alex

      Kommentar


        #4
        It's one of Eugens Multi Interface with SAMD hardware. I don't think the RAM is bogged down on this HW.
        I have posted the output from Konnekting Debug in post #2, but I can't interpret the meaning of it and why it's failing/resetting.
        How would I hardware debug?
        Zuletzt geändert von sx3; 22.03.2019, 19:34.

        Kommentar


          #5
          Ok, if it's the MI, then it's unlikely that you're running out of memory.

          Doing hardware debugging requires something like this: https://www.microchip.com/developmen...ls/atatmel-ice

          I'll check your logs.

          [update]
          Hmm, it seems to loop in the KNX UART Initialization phase.
          Do you have the KNX bus connected? Otherwise the device will not be able to init the KNX UART.

          If bus is connected: is the demo sketch (still) working?
          Zuletzt geändert von tuxedo; 22.03.2019, 20:20.

          Kommentar


            #6
            Nope, no KNX bus connected.. Didn't know it had to be connected.
            I tested again (with bus connected), now the setup finnishes, I get a message that it will enter the loop.
            However, the loop doesn't seem to start according to serial monitor, it just stays white, it should give me message since I have
            Code:
            SerialUSB.println("Inside loop");
            .
            I don't get any more messages from KonnektingDebug, and I can't see any telegrams in ETS either. makes me think the loop doesn't start?

            Kommentar


              #7
              I tested again (with bus connected), now the setup finnishes, I get a message that it will enter the loop.
              How does this message look like?
              if your code is not changed: Put at end of setup() an additional println() to see it really reaches the end.
              Then the next thing that will happen is the loop(). Or an interrupt that then just happened.

              Kommentar


                #8
                After some trial and error I've come to the conclusion that something happens when I try to start the serial for my heatpump.

                in the sketch:
                Code:
                //heatpump is on Serial2
                Rego637 Heatpump( Serial2 );
                Heatpump.start( 19200 );      //Rego637 heatpump

                In the class I have following:
                Code:
                    Stream          *_RegoStream;
                    HardwareSerial  *_hwRegoPort;
                Code:
                //public stuff///////////////////////////////////////////////////////
                void Rego637::start( unsigned long baudrate )
                {
                    if( _hwRegoPort )
                    {
                        SerialUSB.println("we have port");
                        _hwRegoPort->begin( baudrate);
                        SerialUSB.println("Begin finnished");
                        _RegoStream = (Stream *)_hwRegoPort;
                        SerialUSB.println("Stream finnished");
                    }//if
                
                    ClrMsgStatus();
                
                }//start
                In serial monitor, it only gives me "We have port", it doesn't seem to be able to Begin the serial.
                I'm using the standard Hardwareserial & stream library.

                If I don't have any Konnekting/KNX code in the sketch, my original code runs fine.. But together with the konn-library it seems to collide somewhere.
                Zuletzt geändert von sx3; 22.03.2019, 22:22.

                Kommentar


                  #9
                  Seems to be something like an "sercom" conflict. Eugenius is your expert of choice when it comes to sercom issues :-)

                  In my sketches I use "Serial1" for KNX and "SerialUSB" for debugging. I have not yet touched a 3rd serial port. But I will, with one of my upcoming projects.

                  Kommentar


                    #10
                    You're using sercom1 for serial2:

                    Code:
                    Uart Serial2 (&sercom1, 11, 10, SERCOM_RX_PAD_0, UART_TX_PAD_2);
                    void SERCOM1_Handler()
                    {
                      Serial2.IrqHandler();
                    }
                    
                    //heatpump is on Serial2
                    Rego637 Heatpump( Serial2 );
                    I guess (without actually knowing it) sercom1 is also used by default Serial1?!

                    Check Eugen's mi.h for example:

                    https://github.com/KONNEKTING/Konnek...itter_1.0/mi.h

                    He's using a different sercom for Serial2

                    But as I said: I'm not an sercom expert, haven't look into it yet.

                    Kommentar


                      #11

                      small hint:
                      Code:
                      //#define KDEBUG // comment this line to disable DEBUG mode

                      Edit: Sorry, just saw post #2

                      BTW your sketch is hard to read, e.g. you are using debugserial and serialUSB to write debug messages, both initialized, but are actually the same...

                      Edit 2: check Eugens mi.h for more explanation on SERCOMs - for example here:
                      https://github.com/KONNEKTING/Konnek...ransmitter_1.0
                      Zuletzt geändert von Sonnengruesser; 23.03.2019, 09:31.

                      Kommentar


                        #12
                        BTW your sketch is hard to read, e.g. you are using debugserial and serialUSB to write debug messages, both initialized, but are actually the same...
                        Sorry for this, debug is from the konn-code, and my sketch is SerialUSB, they are the same but different variables. I will clean up the code later, and probably migrate to the konn-suite.

                        It could be the Sercom handler, I don't know.
                        But what I know is, the sketch including sercom (Sercom1/serial2) handler works without the konn-code. and according to variants.cpp it should be compatible.
                        Code:
                         [TABLE]
                         	 		[TR]
                         			[TD]* | 10 | ~10 | PA18 | | EIC/EXTINT[2] PTC/X[6] +SERCOM1/PAD[2] SERCOM3/PAD[2] *TC3/WO[0] TCC0/WO[2][/TD]
                         		[/TR]
                         		[TR]
                         			[TD]* | 11 | ~11 | PA16 | | EIC/EXTINT[0] PTC/X[4] +SERCOM1/PAD[0] SERCOM3/PAD[0] *TCC2/WO[0] TCC0/WO[6][/TD]
                         			[TD] [/TD]
                         		[/TR]
                         	 [/TABLE]
                        The KNX TPUART is by default on "Serial" with Sercom5, I haven't changed this one.
                        Code:
                         [TABLE]
                         	 		[TR]
                         			[TD]* | 30 | | PB22 | EDBG_UART TX | *SERCOM5/PAD[2][/TD]
                         		[/TR]
                         		[TR]
                         			[TD] 			[TABLE]
                         				 					[TR]
                         						[TD]* | 31 | | PB23 | EDBG_UART RX | *SERCOM5/PAD[3][/TD]
                         					[/TR]
                         				 			[/TABLE]
                         			[/TD]
                         			[TD] [/TD]
                         		[/TR]
                         	 [/TABLE]
                        The sketch doesn't use Serial1, and even if it would have been on Sercom1, my code would have overwritten that default parameter if I have understood Sercoms correctly.

                        I suspect that both my sketch, and the konn-code uses the HardwareSerial/Stream library, and using the same variables, and this is where the conflict is?

                        Kommentar


                          #13
                          Hi, sx3
                          pls, don't use communication sketch as example for a big project.

                          If you will use Konnekting Library in a right way, you have to create a XML DeviceDescription file for you project.
                          After that ycan generate alot of stuff with code generator and you do not need to copy&paste a lot of lines.

                          First problem that I see: you defined not enough "virtual EEPROM"...
                          Code:
                          byte virtualEEPROM[16];
                          this was only for communication sketch demonstration... you need at least 180 bytes...

                          Second (may be not a) problem:
                          For debug, don't use
                          Code:
                          SerialUSB.print( ...)
                          but:
                          Code:
                          Debug.print(F( ...));
                          Zuletzt geändert von Eugenius; 23.03.2019, 19:08.

                          Kommentar


                            #14
                            Thanks for the info..
                            I would like to use the library in a correct way, I just haven't found any beginners guide thats's easy to digest.
                            Where should I start? It isn't that easy to just jump in and create an XML

                            Kommentar


                              #15
                              look at the MI examples here

                              and an explanation of how to create the XML can be found at the KonnektING Wiki
                              Zuletzt geändert von Sonnengruesser; 23.03.2019, 19:57.

                              Kommentar

                              Lädt...
                              X