From 040ea4ab61f265415d3b2ea6d20dc0c2aa6389bd Mon Sep 17 00:00:00 2001 From: Hakan Bastedt Date: Tue, 14 Jan 2025 10:41:19 +0100 Subject: [PATCH] Closer to final version --- .../soes-esi/MetalMusings_EaserCAT_6000.xml | 665 ++++-------------- .../Firmware/lib/soes-esi/ecat_options.h | 4 +- .../Firmware/lib/soes-esi/eeprom.bin | Bin 2048 -> 2048 bytes .../Firmware/lib/soes-esi/eeprom.hex | 4 +- .../Firmware/lib/soes-esi/esi.json | 122 +--- .../Firmware/lib/soes-esi/objectlist.c | 119 +--- .../Firmware/lib/soes-esi/utypes.h | 5 +- .../Firmware/platformio.ini | 2 +- .../Firmware/src/main.cpp | 37 +- 9 files changed, 218 insertions(+), 740 deletions(-) diff --git a/Cards/EaserCAT-6000-THCAD-reader+Digital-IO/Firmware/lib/soes-esi/MetalMusings_EaserCAT_6000.xml b/Cards/EaserCAT-6000-THCAD-reader+Digital-IO/Firmware/lib/soes-esi/MetalMusings_EaserCAT_6000.xml index d83d547..4da764b 100755 --- a/Cards/EaserCAT-6000-THCAD-reader+Digital-IO/Firmware/lib/soes-esi/MetalMusings_EaserCAT_6000.xml +++ b/Cards/EaserCAT-6000-THCAD-reader+Digital-IO/Firmware/lib/soes-esi/MetalMusings_EaserCAT_6000.xml @@ -8,12 +8,12 @@ MachineControl - Incremental encoder + Plasma cutter - EaserCAT 6000 + EaserCAT 6000 MetalMusings EaserCAT 6000 MachineControl @@ -77,7 +77,7 @@ DT1600 - 144 + 48 0 Max SubIndex @@ -90,7 +90,7 @@ 1 - New array subitem + Output4 UDINT 32 16 @@ -98,40 +98,10 @@ ro - - 2 - New array subitem - UDINT - 32 - 48 - - ro - - - - 3 - New array subitem - UDINT - 32 - 80 - - ro - - - - 4 - New array subitem - UDINT - 32 - 112 - - ro - - DT1A00 - 400 + 48 0 Max SubIndex @@ -144,7 +114,7 @@ 1 - New array subitem + Input12 UDINT 32 16 @@ -152,116 +122,6 @@ ro - - 2 - New array subitem - UDINT - 32 - 48 - - ro - - - - 3 - New array subitem - UDINT - 32 - 80 - - ro - - - - 4 - New array subitem - UDINT - 32 - 112 - - ro - - - - 5 - New array subitem - UDINT - 32 - 144 - - ro - - - - 6 - New array subitem - UDINT - 32 - 176 - - ro - - - - 7 - New array subitem - UDINT - 32 - 208 - - ro - - - - 8 - New array subitem - UDINT - 32 - 240 - - ro - - - - 9 - New array subitem - UDINT - 32 - 272 - - ro - - - - 10 - New array subitem - UDINT - 32 - 304 - - ro - - - - 11 - New array subitem - UDINT - 32 - 336 - - ro - - - - 12 - New array subitem - UDINT - 32 - 368 - - ro - - DT1A01 @@ -287,6 +147,30 @@ + + DT1A02 + 48 + + 0 + Max SubIndex + USINT + 8 + 0 + + ro + + + + 1 + Frequency + UDINT + 32 + 16 + + ro + + + DT1C00ARR USINT @@ -354,15 +238,15 @@ DT1C13ARR UINT - 32 + 48 1 - 2 + 3 DT1C13 - 48 + 64 0 Max SubIndex @@ -376,79 +260,13 @@ Elements DT1C13ARR - 32 + 48 16 ro - - DT6000ARR - BOOL - 12 - - 1 - 12 - - - - DT6000 - 28 - - 0 - Max SubIndex - USINT - 8 - 0 - - ro - - - - Elements - DT6000ARR - 12 - 16 - - ro - T - - - - - DT7000ARR - BOOL - 4 - - 1 - 4 - - - - DT7000 - 20 - - 0 - Max SubIndex - USINT - 8 - 0 - - ro - - - - Elements - DT7000ARR - 4 - 16 - - ro - R - - - UDINT 32 @@ -474,8 +292,8 @@ 32 - BOOL - 1 + DINT + 32 @@ -550,13 +368,13 @@ Product Code - 13294767 + 24576 Revision Number - 3 + 2 @@ -572,38 +390,20 @@ #x1600 - Output + Output4 DT1600 - 144 + 48 Max SubIndex - 4 + 1 - New array subitem + Output4 - #x70000101 - - - - New array subitem - - #x70000201 - - - - New array subitem - - #x70000301 - - - - New array subitem - - #x70000401 + #x70000008 @@ -613,86 +413,20 @@ #x1A00 - Input + Input12 DT1A00 - 400 + 48 Max SubIndex - 12 + 1 - New array subitem + Input12 - #x60000101 - - - - New array subitem - - #x60000201 - - - - New array subitem - - #x60000301 - - - - New array subitem - - #x60000401 - - - - New array subitem - - #x60000501 - - - - New array subitem - - #x60000601 - - - - New array subitem - - #x60000701 - - - - New array subitem - - #x60000801 - - - - New array subitem - - #x60000901 - - - - New array subitem - - #x60000a01 - - - - New array subitem - - #x60000b01 - - - - New array subitem - - #x60000c01 + #x60000020 @@ -723,6 +457,29 @@ ro + + #x1A02 + Frequency + DT1A02 + 48 + + + Max SubIndex + + 1 + + + + Frequency + + #x60020020 + + + + + ro + + #x1C00 Sync Manager Communication Type @@ -791,12 +548,12 @@ #x1C13 Sync Manager 3 PDO Assignment DT1C13 - 48 + 64 Max SubIndex - 2 + 3 @@ -811,6 +568,12 @@ #x1A01 + + PDO Mapping + + #x1A02 + + ro @@ -830,91 +593,15 @@ #x6000 - Input - DT6000 - 28 + Input12 + DINT + 32 - - Max SubIndex - - 12 - - - - New array subitem - - 0 - - - - New array subitem - - 0 - - - - New array subitem - - 0 - - - - New array subitem - - 0 - - - - New array subitem - - 0 - - - - New array subitem - - 0 - - - - New array subitem - - 0 - - - - New array subitem - - 0 - - - - New array subitem - - 0 - - - - New array subitem - - 0 - - - - New array subitem - - 0 - - - - New array subitem - - 0 - - + 0 ro + T @@ -931,44 +618,29 @@ - #x7000 - Output - DT7000 - 20 + #x6002 + Frequency + UDINT + 32 - - Max SubIndex - - 4 - - - - New array subitem - - 0 - - - - New array subitem - - 0 - - - - New array subitem - - 0 - - - - New array subitem - - 0 - - + 0 ro + T + + + + #x7000 + Output4 + USINT + 8 + + 0 + + + ro + R @@ -983,122 +655,24 @@ Inputs #x1600 - Output + Output4 #x7000 - #x1 - 1 - New array subitem - BOOL - - - #x7000 - #x2 - 1 - New array subitem - BOOL - - - #x7000 - #x3 - 1 - New array subitem - BOOL - - - #x7000 - #x4 - 1 - New array subitem - BOOL + #x0 + 8 + Output4 + USINT #x1A00 - Input + Input12 #x6000 - #x1 - 1 - New array subitem - BOOL - - - #x6000 - #x2 - 1 - New array subitem - BOOL - - - #x6000 - #x3 - 1 - New array subitem - BOOL - - - #x6000 - #x4 - 1 - New array subitem - BOOL - - - #x6000 - #x5 - 1 - New array subitem - BOOL - - - #x6000 - #x6 - 1 - New array subitem - BOOL - - - #x6000 - #x7 - 1 - New array subitem - BOOL - - - #x6000 - #x8 - 1 - New array subitem - BOOL - - - #x6000 - #x9 - 1 - New array subitem - BOOL - - - #x6000 - #xa - 1 - New array subitem - BOOL - - - #x6000 - #xb - 1 - New array subitem - BOOL - - - #x6000 - #xc - 1 - New array subitem - BOOL + #x0 + 32 + Input12 + DINT @@ -1112,8 +686,19 @@ REAL + + #x1A02 + Frequency + + #x6002 + #x0 + 32 + Frequency + UDINT + + - + diff --git a/Cards/EaserCAT-6000-THCAD-reader+Digital-IO/Firmware/lib/soes-esi/ecat_options.h b/Cards/EaserCAT-6000-THCAD-reader+Digital-IO/Firmware/lib/soes-esi/ecat_options.h index 6f10889..9bf3003 100755 --- a/Cards/EaserCAT-6000-THCAD-reader+Digital-IO/Firmware/lib/soes-esi/ecat_options.h +++ b/Cards/EaserCAT-6000-THCAD-reader+Digital-IO/Firmware/lib/soes-esi/ecat_options.h @@ -33,8 +33,8 @@ #define SM3_smc 0x20 #define SM3_act 1 -#define MAX_MAPPINGS_SM2 4 -#define MAX_MAPPINGS_SM3 13 +#define MAX_MAPPINGS_SM2 1 +#define MAX_MAPPINGS_SM3 3 #define MAX_RXPDO_SIZE 512 #define MAX_TXPDO_SIZE 512 diff --git a/Cards/EaserCAT-6000-THCAD-reader+Digital-IO/Firmware/lib/soes-esi/eeprom.bin b/Cards/EaserCAT-6000-THCAD-reader+Digital-IO/Firmware/lib/soes-esi/eeprom.bin index 60cff241f75f6ff6f2a64cb66eeee4e8a5785427..3787c1bda0e04d7bb129853d9e4f9abd18e288e8 100755 GIT binary patch delta 28 jcmZn=Xb_kn!pV@pz`(@7z`!`sQDmaw97f@d=Zx3^QC|i@ delta 28 kcmZn=Xb_kn!nyv=DF$W+1_s87jv^Bc=P=4|JZHoX0C=?sLjV8( diff --git a/Cards/EaserCAT-6000-THCAD-reader+Digital-IO/Firmware/lib/soes-esi/eeprom.hex b/Cards/EaserCAT-6000-THCAD-reader+Digital-IO/Firmware/lib/soes-esi/eeprom.hex index d157a2e..625d11f 100755 --- a/Cards/EaserCAT-6000-THCAD-reader+Digital-IO/Firmware/lib/soes-esi/eeprom.hex +++ b/Cards/EaserCAT-6000-THCAD-reader+Digital-IO/Firmware/lib/soes-esi/eeprom.hex @@ -1,10 +1,10 @@ -:2000000080060344640000000000000000001400AA0A0000AFDCCA0003000000010000008E +:2000000080060344640000000000000000001400AA0A000000600000020000000100000084 :20002000000000000000000000000000000000000010000200120002040000000000000096 :200040000000000000000000000000000000000000000000000000000000000000000000A0 :20006000000000000000000000000000000000000000000000000000000000000F00010070 :200080000A002000040D456173657243415420363030300E4D616368696E65436F6E7472AE :2000A0006F6C06494D474342591A4D6574616C4D7573696E677320456173657243415420A9 -:2000C000363030301E00100002030104001F000000000000000000001100000000000000F2 +:2000C000363030301E001000020301040013000000000000000000001100000000000000FE :2000E000000000000000000028000200010203002900100000100002260001010012000249 :20010000220001020016000024000103001A000020000104FFFFFFFFFFFFFFFFFFFFFFFF49 :20012000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFDF diff --git a/Cards/EaserCAT-6000-THCAD-reader+Digital-IO/Firmware/lib/soes-esi/esi.json b/Cards/EaserCAT-6000-THCAD-reader+Digital-IO/Firmware/lib/soes-esi/esi.json index 8ab241d..61bc303 100755 --- a/Cards/EaserCAT-6000-THCAD-reader+Digital-IO/Firmware/lib/soes-esi/esi.json +++ b/Cards/EaserCAT-6000-THCAD-reader+Digital-IO/Firmware/lib/soes-esi/esi.json @@ -2,9 +2,9 @@ "form": { "VendorName": "MetalMusings", "VendorID": "0xaaa", - "ProductCode": "0xcadcaf", + "ProductCode": "0x6000", "ProfileNo": "5001", - "RevisionNumber": "0x003", + "RevisionNumber": "0x002", "SerialNumber": "0x001", "HWversion": "0.0.1", "SWversion": "0.0.1", @@ -15,7 +15,7 @@ "SM2Offset": "0x1600", "SM3Offset": "0x1A00", "TextGroupType": "MachineControl", - "TextGroupName5": "Incremental encoder", + "TextGroupName5": "Plasma cutter", "ImageName": "IMGCBY", "TextDeviceType": "EaserCAT 6000", "TextDeviceName": "MetalMusings EaserCAT 6000", @@ -71,78 +71,15 @@ "data": "&Obj.EncFrequency" }, "6000": { - "otype": "ARRAY", - "name": "Input", + "otype": "VAR", + "name": "Input12", "access": "RO", - "items": [ - { - "name": "Max SubIndex" - }, - { - "name": "New array subitem", - "data": "&Obj.Input[0]", - "value": "0" - }, - { - "name": "New array subitem", - "value": "0", - "data": "&Obj.Input[1]" - }, - { - "name": "New array subitem", - "value": "0", - "data": "&Obj.Input[2]" - }, - { - "name": "New array subitem", - "value": "0", - "data": "&Obj.Input[3]" - }, - { - "name": "New array subitem", - "value": "0", - "data": "&Obj.Input[4]" - }, - { - "name": "New array subitem", - "value": "0", - "data": "&Obj.Input[5]" - }, - { - "name": "New array subitem", - "value": "0", - "data": "&Obj.Input[6]" - }, - { - "name": "New array subitem", - "value": "0", - "data": "&Obj.Input[7]" - }, - { - "name": "New array subitem", - "value": "0", - "data": "&Obj.Input[8]" - }, - { - "name": "New array subitem", - "value": "0", - "data": "&Obj.Input[9]" - }, - { - "name": "New array subitem", - "value": "0", - "data": "&Obj.Input[10]" - }, - { - "name": "New array subitem", - "value": "0", - "data": "&Obj.Input[11]" - } - ], "pdo_mappings": [ "txpdo" ], - "dtype": "BOOLEAN" + "dtype": "INTEGER32", + "value": "0", + "data": "&Obj.Input12" }, "6001": { "otype": "VAR", @@ -154,41 +91,30 @@ "dtype": "REAL32", "value": "0", "data": "&Obj.Velocity" + }, + "6002": { + "otype": "VAR", + "name": "Frequency", + "access": "RO", + "pdo_mappings": [ + "txpdo" + ], + "dtype": "UNSIGNED32", + "value": "0", + "data": "&Obj.Frequency" } }, "rxpdo": { "7000": { - "otype": "ARRAY", - "name": "Output", + "otype": "VAR", + "name": "Output4", "access": "RO", - "items": [ - { - "name": "Max SubIndex" - }, - { - "name": "New array subitem", - "data": "&Obj.Output[0]" - }, - { - "name": "New array subitem", - "value": "0", - "data": "&Obj.Output[1]" - }, - { - "name": "New array subitem", - "value": "0", - "data": "&Obj.Output[2]" - }, - { - "name": "New array subitem", - "value": "0", - "data": "&Obj.Output[3]" - } - ], "pdo_mappings": [ "rxpdo" ], - "dtype": "BOOLEAN" + "dtype": "UNSIGNED8", + "value": "0", + "data": "&Obj.Output4" }, "60664": { "otype": "VAR", diff --git a/Cards/EaserCAT-6000-THCAD-reader+Digital-IO/Firmware/lib/soes-esi/objectlist.c b/Cards/EaserCAT-6000-THCAD-reader+Digital-IO/Firmware/lib/soes-esi/objectlist.c index 6a74bed..e060eb0 100755 --- a/Cards/EaserCAT-6000-THCAD-reader+Digital-IO/Firmware/lib/soes-esi/objectlist.c +++ b/Cards/EaserCAT-6000-THCAD-reader+Digital-IO/Firmware/lib/soes-esi/objectlist.c @@ -13,29 +13,18 @@ static const char acName1018_01[] = "Vendor ID"; static const char acName1018_02[] = "Product Code"; static const char acName1018_03[] = "Revision Number"; static const char acName1018_04[] = "Serial Number"; -static const char acName1600[] = "Output"; +static const char acName1600[] = "Output4"; static const char acName1600_00[] = "Max SubIndex"; -static const char acName1600_01[] = "New array subitem"; -static const char acName1600_02[] = "New array subitem"; -static const char acName1600_03[] = "New array subitem"; -static const char acName1600_04[] = "New array subitem"; -static const char acName1A00[] = "Input"; +static const char acName1600_01[] = "Output4"; +static const char acName1A00[] = "Input12"; static const char acName1A00_00[] = "Max SubIndex"; -static const char acName1A00_01[] = "New array subitem"; -static const char acName1A00_02[] = "New array subitem"; -static const char acName1A00_03[] = "New array subitem"; -static const char acName1A00_04[] = "New array subitem"; -static const char acName1A00_05[] = "New array subitem"; -static const char acName1A00_06[] = "New array subitem"; -static const char acName1A00_07[] = "New array subitem"; -static const char acName1A00_08[] = "New array subitem"; -static const char acName1A00_09[] = "New array subitem"; -static const char acName1A00_0a[] = "New array subitem"; -static const char acName1A00_0b[] = "New array subitem"; -static const char acName1A00_0c[] = "New array subitem"; +static const char acName1A00_01[] = "Input12"; static const char acName1A01[] = "Velocity"; static const char acName1A01_00[] = "Max SubIndex"; static const char acName1A01_01[] = "Velocity"; +static const char acName1A02[] = "Frequency"; +static const char acName1A02_00[] = "Max SubIndex"; +static const char acName1A02_01[] = "Frequency"; static const char acName1C00[] = "Sync Manager Communication Type"; static const char acName1C00_00[] = "Max SubIndex"; static const char acName1C00_01[] = "Communications Type SM0"; @@ -49,28 +38,12 @@ static const char acName1C13[] = "Sync Manager 3 PDO Assignment"; static const char acName1C13_00[] = "Max SubIndex"; static const char acName1C13_01[] = "PDO Mapping"; static const char acName1C13_02[] = "PDO Mapping"; +static const char acName1C13_03[] = "PDO Mapping"; static const char acName2000[] = "VelocityScale"; -static const char acName6000[] = "Input"; -static const char acName6000_00[] = "Max SubIndex"; -static const char acName6000_01[] = "New array subitem"; -static const char acName6000_02[] = "New array subitem"; -static const char acName6000_03[] = "New array subitem"; -static const char acName6000_04[] = "New array subitem"; -static const char acName6000_05[] = "New array subitem"; -static const char acName6000_06[] = "New array subitem"; -static const char acName6000_07[] = "New array subitem"; -static const char acName6000_08[] = "New array subitem"; -static const char acName6000_09[] = "New array subitem"; -static const char acName6000_0a[] = "New array subitem"; -static const char acName6000_0b[] = "New array subitem"; -static const char acName6000_0c[] = "New array subitem"; +static const char acName6000[] = "Input12"; static const char acName6001[] = "Velocity"; -static const char acName7000[] = "Output"; -static const char acName7000_00[] = "Max SubIndex"; -static const char acName7000_01[] = "New array subitem"; -static const char acName7000_02[] = "New array subitem"; -static const char acName7000_03[] = "New array subitem"; -static const char acName7000_04[] = "New array subitem"; +static const char acName6002[] = "Frequency"; +static const char acName7000[] = "Output4"; const _objd SDO1000[] = { @@ -92,39 +65,30 @@ const _objd SDO1018[] = { {0x00, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName1018_00, 4, NULL}, {0x01, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1018_01, 2730, NULL}, - {0x02, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1018_02, 13294767, NULL}, - {0x03, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1018_03, 3, NULL}, + {0x02, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1018_02, 24576, NULL}, + {0x03, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1018_03, 2, NULL}, {0x04, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1018_04, 1, &Obj.serial}, }; const _objd SDO1600[] = { - {0x00, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName1600_00, 4, NULL}, - {0x01, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1600_01, 0x70000101, NULL}, - {0x02, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1600_02, 0x70000201, NULL}, - {0x03, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1600_03, 0x70000301, NULL}, - {0x04, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1600_04, 0x70000401, NULL}, + {0x00, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName1600_00, 1, NULL}, + {0x01, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1600_01, 0x70000008, NULL}, }; const _objd SDO1A00[] = { - {0x00, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName1A00_00, 12, NULL}, - {0x01, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1A00_01, 0x60000101, NULL}, - {0x02, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1A00_02, 0x60000201, NULL}, - {0x03, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1A00_03, 0x60000301, NULL}, - {0x04, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1A00_04, 0x60000401, NULL}, - {0x05, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1A00_05, 0x60000501, NULL}, - {0x06, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1A00_06, 0x60000601, NULL}, - {0x07, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1A00_07, 0x60000701, NULL}, - {0x08, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1A00_08, 0x60000801, NULL}, - {0x09, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1A00_09, 0x60000901, NULL}, - {0x0a, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1A00_0a, 0x60000a01, NULL}, - {0x0b, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1A00_0b, 0x60000b01, NULL}, - {0x0c, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1A00_0c, 0x60000c01, NULL}, + {0x00, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName1A00_00, 1, NULL}, + {0x01, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1A00_01, 0x60000020, NULL}, }; const _objd SDO1A01[] = { {0x00, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName1A01_00, 1, NULL}, {0x01, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1A01_01, 0x60010020, NULL}, }; +const _objd SDO1A02[] = +{ + {0x00, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName1A02_00, 1, NULL}, + {0x01, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1A02_01, 0x60020020, NULL}, +}; const _objd SDO1C00[] = { {0x00, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName1C00_00, 4, NULL}, @@ -140,9 +104,10 @@ const _objd SDO1C12[] = }; const _objd SDO1C13[] = { - {0x00, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName1C13_00, 2, NULL}, + {0x00, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName1C13_00, 3, NULL}, {0x01, DTYPE_UNSIGNED16, 16, ATYPE_RO, acName1C13_01, 0x1A00, NULL}, {0x02, DTYPE_UNSIGNED16, 16, ATYPE_RO, acName1C13_02, 0x1A01, NULL}, + {0x03, DTYPE_UNSIGNED16, 16, ATYPE_RO, acName1C13_03, 0x1A02, NULL}, }; const _objd SDO2000[] = { @@ -150,31 +115,19 @@ const _objd SDO2000[] = }; const _objd SDO6000[] = { - {0x00, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName6000_00, 12, NULL}, - {0x01, DTYPE_BOOLEAN, 1, ATYPE_RO | ATYPE_TXPDO, acName6000_01, 0, &Obj.Input[0]}, - {0x02, DTYPE_BOOLEAN, 1, ATYPE_RO | ATYPE_TXPDO, acName6000_02, 0, &Obj.Input[1]}, - {0x03, DTYPE_BOOLEAN, 1, ATYPE_RO | ATYPE_TXPDO, acName6000_03, 0, &Obj.Input[2]}, - {0x04, DTYPE_BOOLEAN, 1, ATYPE_RO | ATYPE_TXPDO, acName6000_04, 0, &Obj.Input[3]}, - {0x05, DTYPE_BOOLEAN, 1, ATYPE_RO | ATYPE_TXPDO, acName6000_05, 0, &Obj.Input[4]}, - {0x06, DTYPE_BOOLEAN, 1, ATYPE_RO | ATYPE_TXPDO, acName6000_06, 0, &Obj.Input[5]}, - {0x07, DTYPE_BOOLEAN, 1, ATYPE_RO | ATYPE_TXPDO, acName6000_07, 0, &Obj.Input[6]}, - {0x08, DTYPE_BOOLEAN, 1, ATYPE_RO | ATYPE_TXPDO, acName6000_08, 0, &Obj.Input[7]}, - {0x09, DTYPE_BOOLEAN, 1, ATYPE_RO | ATYPE_TXPDO, acName6000_09, 0, &Obj.Input[8]}, - {0x0a, DTYPE_BOOLEAN, 1, ATYPE_RO | ATYPE_TXPDO, acName6000_0a, 0, &Obj.Input[9]}, - {0x0b, DTYPE_BOOLEAN, 1, ATYPE_RO | ATYPE_TXPDO, acName6000_0b, 0, &Obj.Input[10]}, - {0x0c, DTYPE_BOOLEAN, 1, ATYPE_RO | ATYPE_TXPDO, acName6000_0c, 0, &Obj.Input[11]}, + {0x0, DTYPE_INTEGER32, 32, ATYPE_RO | ATYPE_TXPDO, acName6000, 0, &Obj.Input12}, }; const _objd SDO6001[] = { {0x0, DTYPE_REAL32, 32, ATYPE_RO | ATYPE_TXPDO, acName6001, 0x00000000, &Obj.Velocity}, }; +const _objd SDO6002[] = +{ + {0x0, DTYPE_UNSIGNED32, 32, ATYPE_RO | ATYPE_TXPDO, acName6002, 0, &Obj.Frequency}, +}; const _objd SDO7000[] = { - {0x00, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName7000_00, 4, NULL}, - {0x01, DTYPE_BOOLEAN, 1, ATYPE_RO | ATYPE_RXPDO, acName7000_01, 0, &Obj.Output[0]}, - {0x02, DTYPE_BOOLEAN, 1, ATYPE_RO | ATYPE_RXPDO, acName7000_02, 0, &Obj.Output[1]}, - {0x03, DTYPE_BOOLEAN, 1, ATYPE_RO | ATYPE_RXPDO, acName7000_03, 0, &Obj.Output[2]}, - {0x04, DTYPE_BOOLEAN, 1, ATYPE_RO | ATYPE_RXPDO, acName7000_04, 0, &Obj.Output[3]}, + {0x0, DTYPE_UNSIGNED8, 8, ATYPE_RO | ATYPE_RXPDO, acName7000, 0, &Obj.Output4}, }; const _objectlist SDOobjects[] = @@ -184,15 +137,17 @@ const _objectlist SDOobjects[] = {0x1009, OTYPE_VAR, 0, 0, acName1009, SDO1009}, {0x100A, OTYPE_VAR, 0, 0, acName100A, SDO100A}, {0x1018, OTYPE_RECORD, 4, 0, acName1018, SDO1018}, - {0x1600, OTYPE_RECORD, 4, 0, acName1600, SDO1600}, - {0x1A00, OTYPE_RECORD, 12, 0, acName1A00, SDO1A00}, + {0x1600, OTYPE_RECORD, 1, 0, acName1600, SDO1600}, + {0x1A00, OTYPE_RECORD, 1, 0, acName1A00, SDO1A00}, {0x1A01, OTYPE_RECORD, 1, 0, acName1A01, SDO1A01}, + {0x1A02, OTYPE_RECORD, 1, 0, acName1A02, SDO1A02}, {0x1C00, OTYPE_ARRAY, 4, 0, acName1C00, SDO1C00}, {0x1C12, OTYPE_ARRAY, 1, 0, acName1C12, SDO1C12}, - {0x1C13, OTYPE_ARRAY, 2, 0, acName1C13, SDO1C13}, + {0x1C13, OTYPE_ARRAY, 3, 0, acName1C13, SDO1C13}, {0x2000, OTYPE_VAR, 0, 0, acName2000, SDO2000}, - {0x6000, OTYPE_ARRAY, 12, 0, acName6000, SDO6000}, + {0x6000, OTYPE_VAR, 0, 0, acName6000, SDO6000}, {0x6001, OTYPE_VAR, 0, 0, acName6001, SDO6001}, - {0x7000, OTYPE_ARRAY, 4, 0, acName7000, SDO7000}, + {0x6002, OTYPE_VAR, 0, 0, acName6002, SDO6002}, + {0x7000, OTYPE_VAR, 0, 0, acName7000, SDO7000}, {0xffff, 0xff, 0xff, 0xff, NULL, NULL} }; diff --git a/Cards/EaserCAT-6000-THCAD-reader+Digital-IO/Firmware/lib/soes-esi/utypes.h b/Cards/EaserCAT-6000-THCAD-reader+Digital-IO/Firmware/lib/soes-esi/utypes.h index 0590ed8..c6113d6 100755 --- a/Cards/EaserCAT-6000-THCAD-reader+Digital-IO/Firmware/lib/soes-esi/utypes.h +++ b/Cards/EaserCAT-6000-THCAD-reader+Digital-IO/Firmware/lib/soes-esi/utypes.h @@ -13,12 +13,13 @@ typedef struct /* Inputs */ - uint8_t Input[12]; + int32_t Input12; float Velocity; + uint32_t Frequency; /* Outputs */ - uint8_t Output[4]; + uint8_t Output4; /* Parameters */ diff --git a/Cards/EaserCAT-6000-THCAD-reader+Digital-IO/Firmware/platformio.ini b/Cards/EaserCAT-6000-THCAD-reader+Digital-IO/Firmware/platformio.ini index 06c389b..808a2f7 100755 --- a/Cards/EaserCAT-6000-THCAD-reader+Digital-IO/Firmware/platformio.ini +++ b/Cards/EaserCAT-6000-THCAD-reader+Digital-IO/Firmware/platformio.ini @@ -15,7 +15,7 @@ board = genericSTM32F407VGT6 upload_protocol = stlink debug_tool = stlink debug_build_flags = -O0 -g -ggdb -monitor_port = COM3 +monitor_port = COM9 monitor_filters = send_on_enter, time, colorize, log2file monitor_speed = 115200 build_flags = -Wl,--no-warn-rwx-segment diff --git a/Cards/EaserCAT-6000-THCAD-reader+Digital-IO/Firmware/src/main.cpp b/Cards/EaserCAT-6000-THCAD-reader+Digital-IO/Firmware/src/main.cpp index 10236fb..364f39e 100755 --- a/Cards/EaserCAT-6000-THCAD-reader+Digital-IO/Firmware/src/main.cpp +++ b/Cards/EaserCAT-6000-THCAD-reader+Digital-IO/Firmware/src/main.cpp @@ -32,23 +32,29 @@ HardwareTimer *EncoderTimer; void InputCapture_IT_callback(void); void Rollover_IT_callback(void); +#define bitset(byte, nbit) ((byte) |= (1 << (nbit))) +#define bitclear(byte, nbit) ((byte) &= ~(1 << (nbit))) +#define bitflip(byte, nbit) ((byte) ^= (1 << (nbit))) +#define bitcheck(byte, nbit) ((byte) & (1 << (nbit))) + volatile uint16_t ALEventIRQ; // ALEvent that caused the interrupt void cb_set_outputs(void) // Get Master outputs, slave inputs, first operation { // Update digital pins for (int i = 0; i < sizeof(outputPin); i++) - { - digitalWrite(outputPin[i], Obj.Output[i]); - } + digitalWrite(outputPin[i], bitcheck(Obj.Output4, i) ? HIGH : LOW); } void cb_get_inputs(void) // Set Master inputs, slave outputs, last operation { for (int i = 0; i < sizeof(inputPin); i++) - Obj.Input[i] = digitalRead(inputPin[i]); - - Obj.Velocity = Obj.VelocityScale * FrequencyMeasured; + Obj.Input12 = digitalRead(inputPin[i]) == HIGH ? bitset(Obj.Input12, i) : bitclear(Obj.Input12, i); + float scale = Obj.VelocityScale; + if (scale == 0.0) + scale = 1.0; + Obj.Velocity = scale * FrequencyMeasured; + Obj.Frequency = FrequencyMeasured; } void ESC_interrupt_enable(uint32_t mask); @@ -95,6 +101,14 @@ void setup(void) pinMode(outputPin[i], OUTPUT); digitalWrite(outputPin[i], LOW); } + pinMode(PB4, OUTPUT); + pinMode(PB5, OUTPUT); + pinMode(PB6, OUTPUT); + pinMode(PB7, OUTPUT); + digitalWrite(PB4, HIGH); + digitalWrite(PB5, HIGH); + digitalWrite(PB6, HIGH); + digitalWrite(PB7, HIGH); // Automatically retrieve TIM instance and channel associated to pin // This is used to be compatible with all STM32 series automatically. @@ -112,6 +126,8 @@ void setup(void) // To reduce minimum frequency, it is possible to increase prescaler. But this is at a cost of precision. // The maximum frequency depends on processing of the interruption and thus depend on board used // Example on Nucleo_L476RG with systemClock at 80MHz the interruption processing is around 4,5 microseconds and thus Max frequency is around 220kHz + + // A 16 bit timer is ok (but I use a 32-bit). Can measure down to 2.8 kHz, which is lower than 0 Volt on my card (3.8 kHz) uint32_t PrescalerFactor = 1; EncoderTimer->setPrescaleFactor(PrescalerFactor); EncoderTimer->setOverflow(0xFFFFFFF0); // Max Period value to have the largest possible time to detect rising edge and avoid timer rollover @@ -128,7 +144,6 @@ void setup(void) void loop(void) { -#if 0 // Sync 0 mode uint64_t dTime; if (serveIRQ) { @@ -139,12 +154,8 @@ void loop(void) ecat_slv_poll(); } dTime = longTime.extendTime(micros()) - irqTime; - if (dTime > 5000) // Don't run ecat_slv_poll when expecting to serve interrupt - ecat_slv_poll(); -#else // Freerun mode - ecat_slv(); - -#endif + if (dTime > 5000) // Not doing interrupts - handle free-run + ecat_slv(); } void sync0Handler(void)