From 72ec3e38a0da78c06ef516b126d310a93fc60ec4 Mon Sep 17 00:00:00 2001 From: Hakan Bastedt Date: Thu, 20 Feb 2025 11:09:42 +0100 Subject: [PATCH] Seems RW access now works in esi file (but not in eeprom, does not genrate that info) = tested --- Cards/.gitignore | 1 + .../Firmware/.vscode/c_cpp_properties.json | 4 +-- .../soes-esi/MetalMusings_EaserCAT_7000.xml | 31 ++++++------------- .../Firmware/lib/soes-esi/esi.json | 16 +++++----- .../Firmware/lib/soes-esi/objectlist.c | 8 ++--- .../Firmware/lib/soes-esi/utypes.h | 4 +-- .../Firmware/platformio.ini | 2 +- .../Firmware/src/main.cpp | 11 ++++--- Cards/THTIC2/Kicad/THTIC2.kicad_pro | 2 +- 9 files changed, 35 insertions(+), 44 deletions(-) diff --git a/Cards/.gitignore b/Cards/.gitignore index 2ed550b..1039639 100644 --- a/Cards/.gitignore +++ b/Cards/.gitignore @@ -34,4 +34,5 @@ fp-info-cache *.csv *.step *.stp +*.stl .~lock.* diff --git a/Cards/EaserCAT-7000-DIO+I2C/Firmware/.vscode/c_cpp_properties.json b/Cards/EaserCAT-7000-DIO+I2C/Firmware/.vscode/c_cpp_properties.json index f3f5151..5e22e26 100755 --- a/Cards/EaserCAT-7000-DIO+I2C/Firmware/.vscode/c_cpp_properties.json +++ b/Cards/EaserCAT-7000-DIO+I2C/Firmware/.vscode/c_cpp_properties.json @@ -108,8 +108,8 @@ "PLATFORMIO=60117", "STM32F407xx", "STM32F4", - "NO_ECAT", - "ADS1xxx", + "ECAT", + "ADC_MCP3221", "STM32F4xx", "ARDUINO=10808", "ARDUINO_ARCH_STM32", diff --git a/Cards/EaserCAT-7000-DIO+I2C/Firmware/lib/soes-esi/MetalMusings_EaserCAT_7000.xml b/Cards/EaserCAT-7000-DIO+I2C/Firmware/lib/soes-esi/MetalMusings_EaserCAT_7000.xml index 6aa5a7e..63a26ca 100755 --- a/Cards/EaserCAT-7000-DIO+I2C/Firmware/lib/soes-esi/MetalMusings_EaserCAT_7000.xml +++ b/Cards/EaserCAT-7000-DIO+I2C/Firmware/lib/soes-esi/MetalMusings_EaserCAT_7000.xml @@ -360,11 +360,11 @@ 16 - REAL + DINT 32 - DINT + REAL 32 @@ -457,7 +457,6 @@ - ro @@ -480,7 +479,6 @@ - ro @@ -503,7 +501,6 @@ - ro @@ -526,7 +523,6 @@ - ro @@ -549,7 +545,6 @@ - ro @@ -572,7 +567,6 @@ - ro @@ -595,7 +589,6 @@ - ro @@ -618,7 +611,6 @@ - ro @@ -659,7 +651,6 @@ - ro @@ -694,7 +685,6 @@ - ro @@ -735,31 +725,30 @@ - ro #x2000 - Scale - REAL - 32 + I2C_devicetype + USINT + 8 0 - ro + rw #x2001 - Offset - REAL - 32 + I2C_address + USINT + 8 0 - ro + rw diff --git a/Cards/EaserCAT-7000-DIO+I2C/Firmware/lib/soes-esi/esi.json b/Cards/EaserCAT-7000-DIO+I2C/Firmware/lib/soes-esi/esi.json index faf9995..4e2118f 100755 --- a/Cards/EaserCAT-7000-DIO+I2C/Firmware/lib/soes-esi/esi.json +++ b/Cards/EaserCAT-7000-DIO+I2C/Firmware/lib/soes-esi/esi.json @@ -36,21 +36,21 @@ "sdo": { "2000": { "otype": "VAR", - "name": "Scale", - "access": "RO", - "dtype": "REAL32", + "name": "I2C_devicetype", + "access": "RW", + "dtype": "UNSIGNED8", "value": "0", "isSDOitem": true, - "data": "&Obj.Scale" + "data": "&Obj.I2C_devicetype" }, "2001": { "otype": "VAR", - "name": "Offset", - "access": "RO", - "dtype": "REAL32", + "name": "I2C_address", + "access": "RW", + "dtype": "UNSIGNED8", "value": "0", "isSDOitem": true, - "data": "&Obj.Offset" + "data": "&Obj.I2C_address" }, "A": { "otype": "RECORD", diff --git a/Cards/EaserCAT-7000-DIO+I2C/Firmware/lib/soes-esi/objectlist.c b/Cards/EaserCAT-7000-DIO+I2C/Firmware/lib/soes-esi/objectlist.c index b6e0a7a..195131a 100755 --- a/Cards/EaserCAT-7000-DIO+I2C/Firmware/lib/soes-esi/objectlist.c +++ b/Cards/EaserCAT-7000-DIO+I2C/Firmware/lib/soes-esi/objectlist.c @@ -51,8 +51,8 @@ static const char acName1C13_01[] = "PDO Mapping"; static const char acName1C13_02[] = "PDO Mapping"; static const char acName1C13_03[] = "PDO Mapping"; static const char acName1C13_04[] = "PDO Mapping"; -static const char acName2000[] = "Scale"; -static const char acName2001[] = "Offset"; +static const char acName2000[] = "I2C_devicetype"; +static const char acName2001[] = "I2C_address"; static const char acName6000[] = "Input12"; static const char acName6001[] = "RawData"; static const char acName6002[] = "CalculatedVoltage"; @@ -145,11 +145,11 @@ const _objd SDO1C13[] = }; const _objd SDO2000[] = { - {0x0, DTYPE_REAL32, 32, ATYPE_RO, acName2000, 0x00000000, &Obj.Scale}, + {0x0, DTYPE_UNSIGNED8, 8, ATYPE_RW, acName2000, 0, &Obj.I2C_devicetype}, }; const _objd SDO2001[] = { - {0x0, DTYPE_REAL32, 32, ATYPE_RO, acName2001, 0x00000000, &Obj.Offset}, + {0x0, DTYPE_UNSIGNED8, 8, ATYPE_RW, acName2001, 0, &Obj.I2C_address}, }; const _objd SDO6000[] = { diff --git a/Cards/EaserCAT-7000-DIO+I2C/Firmware/lib/soes-esi/utypes.h b/Cards/EaserCAT-7000-DIO+I2C/Firmware/lib/soes-esi/utypes.h index ed13654..216029b 100755 --- a/Cards/EaserCAT-7000-DIO+I2C/Firmware/lib/soes-esi/utypes.h +++ b/Cards/EaserCAT-7000-DIO+I2C/Firmware/lib/soes-esi/utypes.h @@ -26,8 +26,8 @@ typedef struct /* Parameters */ - float Scale; - float Offset; + uint8_t I2C_devicetype; + uint8_t I2C_address; } _Objects; extern _Objects Obj; diff --git a/Cards/EaserCAT-7000-DIO+I2C/Firmware/platformio.ini b/Cards/EaserCAT-7000-DIO+I2C/Firmware/platformio.ini index d63e300..dbdce3b 100755 --- a/Cards/EaserCAT-7000-DIO+I2C/Firmware/platformio.ini +++ b/Cards/EaserCAT-7000-DIO+I2C/Firmware/platformio.ini @@ -18,7 +18,7 @@ debug_build_flags = -O0 -g -ggdb monitor_port = COM19 monitor_filters = send_on_enter, time, colorize, log2file monitor_speed = 115200 -build_flags = -Wl,--no-warn-rwx-segment -DNO_ECAT -DADS1xxx +build_flags = -Wl,--no-warn-rwx-segment -DECAT -DADC_MCP3221 lib_deps = SPI pilotak/MCP3X21@^1.0.1 diff --git a/Cards/EaserCAT-7000-DIO+I2C/Firmware/src/main.cpp b/Cards/EaserCAT-7000-DIO+I2C/Firmware/src/main.cpp index 60914ee..6882167 100755 --- a/Cards/EaserCAT-7000-DIO+I2C/Firmware/src/main.cpp +++ b/Cards/EaserCAT-7000-DIO+I2C/Firmware/src/main.cpp @@ -22,10 +22,10 @@ uint32_t I2C_restarts = 0; #include "Wire.h" TwoWire Wire2(PB11, PB10); -#ifdef MCP3221 +#ifdef ADC_MCP3221 #include "MyMCP3221.h" MyMCP3221 mcp3221_0(0x48, &Wire2); -MyMCP3221 mcp3221_7(0x4f, &Wire2); +//MyMCP3221 mcp3221_7(0x4f, &Wire2); #endif #ifdef ADS1xxx #include "ADS1X15.h" @@ -64,7 +64,7 @@ void cb_get_inputs(void) // Set Master inputs, slave outputs, last operation float scale = Obj.VoltageScale; if (scale == 0.0) scale = 1.0; -#ifdef MCP3221 +#ifdef ADC_MCP3221 int data0 = mcp3221_0.getData(); int stat = mcp3221_0.ping(); #endif @@ -93,6 +93,7 @@ void cb_get_inputs(void) // Set Master inputs, slave outputs, last operation #endif } Obj.Status = I2C_restarts + (stat << 28); // Put status as bits 28-31, the lower are number of restarts (restart attempts) + Obj.Status = Obj.I2C_devicetype + Obj.I2C_address; } void ESC_interrupt_enable(uint32_t mask); @@ -153,7 +154,7 @@ void setup(void) ecat_slv_init(&config); #endif -#if 1 // Uncomment for commissioning tests +#if 0 // Uncomment for commissioning tests digitalWrite(outputPin[0], HIGH); // All four output leds should go high digitalWrite(outputPin[1], HIGH); digitalWrite(outputPin[2], HIGH); @@ -173,7 +174,7 @@ void setup(void) } if (!nDevices) Serial1.printf("No devices\n"); -#ifdef MCP3221 +#ifdef ADC_MCP3221 Serial1.printf("I2C status=%d rawdata=%d ", mcp3221_0.ping(), mcp3221_0.getData()); #endif #ifdef ADS1xxx diff --git a/Cards/THTIC2/Kicad/THTIC2.kicad_pro b/Cards/THTIC2/Kicad/THTIC2.kicad_pro index 9d5e62b..3971cfe 100644 --- a/Cards/THTIC2/Kicad/THTIC2.kicad_pro +++ b/Cards/THTIC2/Kicad/THTIC2.kicad_pro @@ -469,7 +469,7 @@ "plot": "Gerbers/", "pos_files": "", "specctra_dsn": "THCIC.dsn", - "step": "", + "step": "THTIC2.step", "svg": "", "vrml": "" },