From 28f01a9919808e5d7d1682f075787cac405a93e3 Mon Sep 17 00:00:00 2001 From: Hakan Bastedt Date: Sun, 31 Dec 2023 20:09:55 +0100 Subject: [PATCH] WIP, non-functional --- EEPROM_generator/index.html | 4 +- .../lib/soes/MetalMusings_EaserCAT_2000.xml | 116 +++++++++--------- Firmware/lib/soes/esi.json | 4 +- Firmware/lib/soes/objectlist.c | 34 ++--- Firmware/lib/soes/utypes.h | 2 +- Firmware/src/main.cpp | 17 +-- 6 files changed, 92 insertions(+), 85 deletions(-) diff --git a/EEPROM_generator/index.html b/EEPROM_generator/index.html index f7fa81f..abe93a0 100644 --- a/EEPROM_generator/index.html +++ b/EEPROM_generator/index.html @@ -52,12 +52,12 @@ - + - + diff --git a/Firmware/lib/soes/MetalMusings_EaserCAT_2000.xml b/Firmware/lib/soes/MetalMusings_EaserCAT_2000.xml index 2397c98..407a034 100755 --- a/Firmware/lib/soes/MetalMusings_EaserCAT_2000.xml +++ b/Firmware/lib/soes/MetalMusings_EaserCAT_2000.xml @@ -23,7 +23,7 @@ DT1018 - 144 + 272 0 Max SubIndex @@ -37,8 +37,8 @@ 1 Vendor ID - UDINT - 32 + ULINT + 64 16 ro @@ -47,9 +47,9 @@ 2 Product Code - UDINT - 32 - 48 + ULINT + 64 + 80 ro @@ -57,9 +57,9 @@ 3 Revision Number - UDINT - 32 - 80 + ULINT + 64 + 144 ro @@ -67,9 +67,9 @@ 4 Serial Number - UDINT - 32 - 112 + ULINT + 64 + 208 ro @@ -77,7 +77,7 @@ DT1600 - 48 + 80 0 Max SubIndex @@ -91,8 +91,8 @@ 1 EncPosScale - UDINT - 32 + ULINT + 64 16 ro @@ -101,7 +101,7 @@ DT1601 - 48 + 80 0 Max SubIndex @@ -115,8 +115,8 @@ 1 IndexLatchEnable - UDINT - 32 + ULINT + 64 16 ro @@ -125,7 +125,7 @@ DT1602 - 48 + 80 0 Max SubIndex @@ -139,8 +139,8 @@ 1 CommandedPosition - UDINT - 32 + ULINT + 64 16 ro @@ -149,7 +149,7 @@ DT1A00 - 48 + 80 0 Max SubIndex @@ -163,8 +163,8 @@ 1 EncPos - UDINT - 32 + ULINT + 64 16 ro @@ -173,7 +173,7 @@ DT1A01 - 48 + 80 0 Max SubIndex @@ -187,8 +187,8 @@ 1 EncFrequency - UDINT - 32 + ULINT + 64 16 ro @@ -197,7 +197,7 @@ DT1A02 - 48 + 80 0 Max SubIndex @@ -211,8 +211,8 @@ 1 DiffT - UDINT - 32 + ULINT + 64 16 ro @@ -221,7 +221,7 @@ DT1A03 - 48 + 80 0 Max SubIndex @@ -235,8 +235,8 @@ 1 IndexByte - UDINT - 32 + ULINT + 64 16 ro @@ -245,7 +245,7 @@ DT1A04 - 48 + 80 0 Max SubIndex @@ -259,8 +259,8 @@ 1 IndexStatus - UDINT - 32 + ULINT + 64 16 ro @@ -269,7 +269,7 @@ DT1A05 - 48 + 80 0 Max SubIndex @@ -283,8 +283,8 @@ 1 ActualPosition - UDINT - 32 + ULINT + 64 16 ro @@ -438,8 +438,8 @@ - UDINT - 32 + ULINT + 64 STRING(26) @@ -461,6 +461,10 @@ REAL 32 + + UDINT + 32 + DINT 32 @@ -470,8 +474,8 @@ #x1000 Device Type - UDINT - 32 + ULINT + 64 5001 @@ -521,7 +525,7 @@ #x1018 Identity Object DT1018 - 144 + 272 Max SubIndex @@ -562,7 +566,7 @@ #x1600 EncPosScale DT1600 - 48 + 80 Max SubIndex @@ -585,7 +589,7 @@ #x1601 IndexLatchEnable DT1601 - 48 + 80 Max SubIndex @@ -608,7 +612,7 @@ #x1602 StepGenIn1 DT1602 - 48 + 80 Max SubIndex @@ -631,7 +635,7 @@ #x1A00 EncPos DT1A00 - 48 + 80 Max SubIndex @@ -654,7 +658,7 @@ #x1A01 EncFrequency DT1A01 - 48 + 80 Max SubIndex @@ -677,7 +681,7 @@ #x1A02 DiffT DT1A02 - 48 + 80 Max SubIndex @@ -700,7 +704,7 @@ #x1A03 IndexByte DT1A03 - 48 + 80 Max SubIndex @@ -723,7 +727,7 @@ #x1A04 IndexStatus DT1A04 - 48 + 80 Max SubIndex @@ -744,9 +748,9 @@ #x1A05 - StepgenOut1 + StepGenOut1 DT1A05 - 48 + 80 Max SubIndex @@ -961,7 +965,7 @@ #x6005 - StepgenOut1 + StepGenOut1 DT6005 48 @@ -1131,7 +1135,7 @@ #x1A05 - StepgenOut1 + StepGenOut1 #x6005 #x1 diff --git a/Firmware/lib/soes/esi.json b/Firmware/lib/soes/esi.json index b30c7ad..7e6c7f7 100755 --- a/Firmware/lib/soes/esi.json +++ b/Firmware/lib/soes/esi.json @@ -107,7 +107,7 @@ }, "6005": { "otype": "RECORD", - "name": "StepgenOut1", + "name": "StepGenOut1", "access": "RO", "items": [ { @@ -116,7 +116,7 @@ { "name": "ActualPosition", "dtype": "INTEGER32", - "data": "&Obj.StepgenOut1.ActualPosition", + "data": "&Obj.StepGenOut1.ActualPosition", "value": "0", "access": "RO" } diff --git a/Firmware/lib/soes/objectlist.c b/Firmware/lib/soes/objectlist.c index 45e6fd6..e4db87c 100755 --- a/Firmware/lib/soes/objectlist.c +++ b/Firmware/lib/soes/objectlist.c @@ -37,7 +37,7 @@ static const char acName1A03_01[] = "IndexByte"; static const char acName1A04[] = "IndexStatus"; static const char acName1A04_00[] = "Max SubIndex"; static const char acName1A04_01[] = "IndexStatus"; -static const char acName1A05[] = "StepgenOut1"; +static const char acName1A05[] = "StepGenOut1"; static const char acName1A05_00[] = "Max SubIndex"; static const char acName1A05_01[] = "ActualPosition"; static const char acName1C00[] = "Sync Manager Communication Type"; @@ -64,7 +64,7 @@ static const char acName6001[] = "EncFrequency"; static const char acName6002[] = "DiffT"; static const char acName6003[] = "IndexByte"; static const char acName6004[] = "IndexStatus"; -static const char acName6005[] = "StepgenOut1"; +static const char acName6005[] = "StepGenOut1"; static const char acName6005_00[] = "Max SubIndex"; static const char acName6005_01[] = "ActualPosition"; static const char acName7000[] = "EncPosScale"; @@ -75,7 +75,7 @@ static const char acName7002_01[] = "CommandedPosition"; const _objd SDO1000[] = { - {0x0, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1000, 5001, NULL}, + {0x0, DTYPE_UNSIGNED64, 64, ATYPE_RO, acName1000, 5001, NULL}, }; const _objd SDO1008[] = { @@ -92,55 +92,55 @@ const _objd SDO100A[] = 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, 12303564, NULL}, - {0x03, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1018_03, 2, NULL}, - {0x04, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1018_04, 1, &Obj.serial}, + {0x01, DTYPE_UNSIGNED64, 64, ATYPE_RO, acName1018_01, 2730, NULL}, + {0x02, DTYPE_UNSIGNED64, 64, ATYPE_RO, acName1018_02, 12303564, NULL}, + {0x03, DTYPE_UNSIGNED64, 64, ATYPE_RO, acName1018_03, 2, NULL}, + {0x04, DTYPE_UNSIGNED64, 64, ATYPE_RO, acName1018_04, 1, &Obj.serial}, }; const _objd SDO1600[] = { {0x00, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName1600_00, 1, NULL}, - {0x01, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1600_01, 0x70000020, NULL}, + {0x01, DTYPE_UNSIGNED64, 64, ATYPE_RO, acName1600_01, 0x70000020, NULL}, }; const _objd SDO1601[] = { {0x00, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName1601_00, 1, NULL}, - {0x01, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1601_01, 0x70010020, NULL}, + {0x01, DTYPE_UNSIGNED64, 64, ATYPE_RO, acName1601_01, 0x70010020, NULL}, }; const _objd SDO1602[] = { {0x00, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName1602_00, 1, NULL}, - {0x01, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1602_01, 0x70020120, NULL}, + {0x01, DTYPE_UNSIGNED64, 64, ATYPE_RO, acName1602_01, 0x70020120, NULL}, }; const _objd SDO1A00[] = { {0x00, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName1A00_00, 1, NULL}, - {0x01, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1A00_01, 0x60000020, NULL}, + {0x01, DTYPE_UNSIGNED64, 64, 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}, + {0x01, DTYPE_UNSIGNED64, 64, 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}, + {0x01, DTYPE_UNSIGNED64, 64, ATYPE_RO, acName1A02_01, 0x60020020, NULL}, }; const _objd SDO1A03[] = { {0x00, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName1A03_00, 1, NULL}, - {0x01, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1A03_01, 0x60030020, NULL}, + {0x01, DTYPE_UNSIGNED64, 64, ATYPE_RO, acName1A03_01, 0x60030020, NULL}, }; const _objd SDO1A04[] = { {0x00, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName1A04_00, 1, NULL}, - {0x01, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1A04_01, 0x60040020, NULL}, + {0x01, DTYPE_UNSIGNED64, 64, ATYPE_RO, acName1A04_01, 0x60040020, NULL}, }; const _objd SDO1A05[] = { {0x00, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName1A05_00, 1, NULL}, - {0x01, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1A05_01, 0x60050120, NULL}, + {0x01, DTYPE_UNSIGNED64, 64, ATYPE_RO, acName1A05_01, 0x60050120, NULL}, }; const _objd SDO1C00[] = { @@ -190,7 +190,7 @@ const _objd SDO6004[] = const _objd SDO6005[] = { {0x00, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName6005_00, 1, NULL}, - {0x01, DTYPE_INTEGER32, 32, ATYPE_RO, acName6005_01, 0, &Obj.StepgenOut1.ActualPosition}, + {0x01, DTYPE_INTEGER32, 32, ATYPE_RO, acName6005_01, 0, &Obj.StepGenOut1.ActualPosition}, }; const _objd SDO7000[] = { diff --git a/Firmware/lib/soes/utypes.h b/Firmware/lib/soes/utypes.h index de80673..9f77c40 100755 --- a/Firmware/lib/soes/utypes.h +++ b/Firmware/lib/soes/utypes.h @@ -21,7 +21,7 @@ typedef struct struct { int32_t ActualPosition; - } StepgenOut1; + } StepGenOut1; /* Outputs */ diff --git a/Firmware/src/main.cpp b/Firmware/src/main.cpp index 9ecbc50..fa188a4 100755 --- a/Firmware/src/main.cpp +++ b/Firmware/src/main.cpp @@ -86,7 +86,7 @@ uint16_t dc_checker(void); static esc_cfg_t config = { .user_arg = NULL, - .use_interrupt = 1, + .use_interrupt = 0, .watchdog_cnt = 150, .set_defaults_hook = NULL, .pre_state_change_hook = NULL, @@ -97,10 +97,13 @@ static esc_cfg_t config = .post_object_download_hook = NULL, .rxpdo_override = NULL, .txpdo_override = NULL, - .esc_hw_interrupt_enable = ESC_interrupt_enable, - .esc_hw_interrupt_disable = ESC_interrupt_disable, + //.esc_hw_interrupt_enable = ESC_interrupt_enable, + //.esc_hw_interrupt_disable = ESC_interrupt_disable, + .esc_hw_interrupt_enable = NULL, + .esc_hw_interrupt_disable = NULL, .esc_hw_eep_handler = NULL, - .esc_check_dc_handler = dc_checker, + // .esc_check_dc_handler = dc_checker, + .esc_check_dc_handler = NULL, }; void setup(void) @@ -161,13 +164,13 @@ volatile int32_t requestedPosition; volatile uint32_t pulsesToGo = 0; volatile byte forwardDirection = 0; // 1 if going forward #define STEPPER_DIR PA12 -//#define STEPPER_STEP PA11 // Set in StepperSetup +// #define STEPPER_STEP PA11 // Set in StepperSetup void sync0Handler(void) { // Update the actual position actualPosition += pulsesToGo; - Obj.StepgenOut1.ActualPosition = actualPosition; + Obj.StepGenOut1.ActualPosition = actualPosition; // Get new end position requestedPosition = Obj.StepGenIn1.CommandedPosition; // Get the diff and the direction @@ -176,7 +179,7 @@ void sync0Handler(void) // Set direction pin digitalWrite(STEPPER_DIR, forwardDirection); // I think one should really wait a bit when changed // Make the pulses using hardware timer - makePulses(sync0CycleTime/1000, pulsesToGo); + makePulses(sync0CycleTime / 1000, pulsesToGo); } void ESC_interrupt_enable(uint32_t mask)