134 Commits
Video9 ... main

Author SHA1 Message Date
MetalMusings
9cc9a41ea2 Moved SetupTime and pulseLength to sdos. 2025-10-22 17:18:02 +02:00
Hakan Bastedt
a6b70bf6c6 Added syncToRefClock option 2025-10-21 21:54:32 +02:00
Hakan Bastedt
cf4bece469 Indentation 2025-10-21 21:53:51 +02:00
Hakan Bastedt
cd78577e4d Updated to read voltage from ground clamp
instead of ground in the plasma, which obviously
isn't the´real thing.
2025-10-21 21:51:53 +02:00
Hakan Bastedt
2a92e97aaa Apply voltage on work piece, not torch cable
Also read voltage on work piece
2025-10-19 09:54:27 +02:00
Hakan Bastedt
a19a3b5b4e Got hypersensing to work pretty reliably now.
Unfortunately indentation changes.
2025-10-18 21:36:26 +02:00
Hakan Bastedt
924ab972cb Removed states after probe started. Once probig, continue probe 2025-10-14 13:00:52 +02:00
Hakan Bastedt
08915ef4bb Cleaning of code. 2025-10-13 23:34:14 +02:00
Hakan Bastedt
f253ce8482 Only free run, no DC or SM2 sync 2025-10-13 22:07:05 +02:00
Hakan Bastedt
93c48940b8 Improved sensing algo, to only generate one 100 ms pulse every sense.
Also some more conditions to make probing more reliable.
2025-10-13 18:15:04 +02:00
Hakan Bastedt
b3bb88cf08 New option: voltagedrop for sensing ohmic sensing 2025-10-08 13:29:54 +02:00
Hakan Bastedt
b867d58b15 Added criteria voltage of 2 V means ohmic sense hit
Added criteria voltage drop of 2V over the 3 last cycles also means sense hit.
2025-10-07 22:46:47 +02:00
Hakan Bastedt
2770c70d90 Updated short-circuit resistor to 4k7 for more stable voltage. 2025-10-07 22:45:26 +02:00
Hakan Bastedt
719f1755fe Implemented setup time for sensing.
That is the time to wait from sensing signal received until measuring to allow
relay to activate, debounce and all that.

And changed to indentation style so the whole file looks edited buts it's only partially.
2025-10-07 11:18:56 +02:00
Hakan Bastedt
c31249b603 Larger MaxAcceleration values in eeprom. New axis_mm.ini file for testing 2025-08-20 11:09:33 +02:00
Hakan Bastedt
dcce7b5375 After testing, seems to work. Not tested: encoder,frequency,dac 2025-08-17 21:24:47 +02:00
Hakan Bastedt
430eedd77d Merged fix for too many PDOs\? and a new example 2025-08-17 20:41:59 +02:00
Hakan Bastedt
dac61fbba5 Moved PDOs to SDOs, made an example config 2025-08-17 20:01:12 +02:00
Hakan Bastedt
15d25ab06d Remove frequency counter on encoder pins (THCAD test) 2025-08-06 21:20:56 +02:00
Hakan Bastedt
44a15a21f8 Updated encoder 2025-08-06 21:02:22 +02:00
Hakan Bastedt
90a2d4dd32 Wip 2025-08-06 18:28:59 +02:00
Hakan Bastedt
4b3567aa45 Updated for THCLIP 2025-06-09 10:19:00 +02:00
Hakan Bastedt
28a3edc8b8 Updated for THCLIP 2025-06-09 10:14:12 +02:00
Hakan Bastedt
6dc4d9fa03 Updated for THCLIP 2025-06-09 10:12:49 +02:00
Hakan Bastedt
dfabecc28e updated process description more 2025-06-07 19:38:02 +02:00
Hakan Bastedt
f34c5ebe9b updated process description 2025-06-07 19:33:55 +02:00
MetalMusings
7ffe9158df Reference to a pointer also for MCP3221 2025-06-07 17:29:44 +02:00
MetalMusings
c6d88beb56 Ohmic sensing works 2025-06-07 17:04:30 +02:00
MetalMusings
d7a2110a67 Two voltage readers and ohmic sensing unitas 2025-06-07 14:43:35 +02:00
Hakan Bastedt
3c61897b8e Reshuffle and add second reader. 2025-06-07 09:53:48 +02:00
Hakan Bastedt
81b930b290 Cleaned schematics 2025-06-03 17:19:16 +02:00
Håkan Båstedt
6d7d20774d Update README.md 2025-06-02 14:49:23 +02:00
Håkan Båstedt
a0a4d5d9f3 Update README.md 2025-06-02 14:48:49 +02:00
Hakan Bastedt
bd5d77395f THCLIP released 2025-06-02 14:45:18 +02:00
Hakan Bastedt
e4c3f14809 THCLIP released 2025-06-02 14:45:01 +02:00
Hakan Bastedt
eb1d76ad3f Base period setting 2025-05-15 11:49:24 +02:00
Hakan Bastedt
f46140484b Added selection criteria for relay in Schematics 2025-04-28 10:21:38 +02:00
Hakan Bastedt
418aac0a35 Sent for fabrication. 2025-04-28 10:10:36 +02:00
Hakan Bastedt
73a34a2559 Renamed to THCLIP. Version 1. 2025-04-27 20:54:17 +02:00
Hakan Bastedt
20f1acdbeb THTIC3 - copy of THTIC 2025-04-26 11:22:28 +02:00
Hakan Bastedt
fe24b8f4a3 Lowpass filter of voltage now in client 2025-03-13 23:40:22 +01:00
Hakan Bastedt
ca4248ce2d New pictures 2025-03-10 15:47:47 +01:00
Hakan Bastedt
a73339d6ff Upload changes 2025-03-10 15:37:17 +01:00
Hakan Bastedt
9956a50722 Updated ethercat-conf.xml 2025-03-10 11:33:44 +01:00
Hakan Bastedt
5b61d87f68 ethercat-conf.xml for EaserCAT 7000 2025-03-10 11:14:10 +01:00
Hakan Bastedt
766985d11a ethercat-conf.xml for EaserCAT 7000 2025-03-10 11:13:22 +01:00
Hakan Bastedt
7f5e392a3e Added missing Viso connection to IS1540 2025-03-09 11:31:11 +01:00
Hakan Bastedt
97fefb19af Back to production mode from THTIC2 commisioning mode 2025-03-08 23:42:47 +01:00
Hakan Bastedt
a283091a3f Admin. nothing significant 2025-03-08 23:41:00 +01:00
Hakan Bastedt
3df3d63fff Shifted pin 0 and pin 1 for positive voltage value. 2025-03-08 23:22:42 +01:00
Hakan Bastedt
f79ad7035e Updated eeprom 2025-03-02 08:18:51 +01:00
Hakan Bastedt
8130f407b9 Gerbers done again. 2025-02-25 22:45:12 +01:00
Hakan Bastedt
a0ea80e368 Gerbers done. 2025-02-25 22:41:48 +01:00
Hakan Bastedt
47d05ff020 Gerbers generated. 2025-02-25 22:18:05 +01:00
Hakan Bastedt
bc08682f31 Now measuring 0 - -200 Volts. 2025-02-25 22:15:29 +01:00
Hakan Bastedt
b75cde78c1 now saved 2025-02-25 21:23:39 +01:00
Hakan Bastedt
9ba809d4cd Now measuring 0 - -200 Volts. 2025-02-25 21:21:56 +01:00
Hakan Bastedt
eced221b35 Added SDO for basePeriod, PDOs for scale, enable, maxAccel. All got default values in ESI 2025-02-23 20:40:11 +01:00
Hakan Bastedt
8726aff1f8 Updated 2025-02-21 19:06:36 +01:00
Hakan Bastedt
6de2a44814 Final version of THTIC2 2025-02-21 19:06:19 +01:00
Hakan Bastedt
27c644cd68 Pending upload for EaserCAT-7000 2025-02-20 22:29:40 +01:00
Hakan Bastedt
08f2544560 Pending upload for EaserCAT-7000 2025-02-20 22:23:12 +01:00
Hakan Bastedt
a0e74cf2dd Pending upload for EaserCAT-7000 2025-02-20 22:22:54 +01:00
Hakan Bastedt
9411889f54 Tested in cutter. Works just fine. Awesome. 2025-02-20 17:00:56 +01:00
Hakan Bastedt
206c033fc6 SDO config of I2C tested and works 2025-02-20 15:26:04 +01:00
Hakan Bastedt
47d8bdb89d SCL instead of SDL 2025-02-20 15:25:34 +01:00
Hakan Bastedt
fbc031a61e I2C setting (type and address) through SDO now 2025-02-20 14:45:18 +01:00
Hakan Bastedt
c160901131 Merge branch 'EaserCAT-7000' 2025-02-20 14:07:52 +01:00
Hakan Bastedt
e9d046bbb7 Access now working in ESI file. 2025-02-20 11:13:11 +01:00
Hakan Bastedt
71158e3e47 Now recognozing the chosen access method in the gui
Also RW in objectlist.c but not in esi file and unknown in eeprom
2025-02-20 11:12:47 +01:00
Hakan Bastedt
72ec3e38a0 Seems RW access now works in esi file (but not in eeprom, does not genrate that info) = tested 2025-02-20 11:09:42 +01:00
Hakan Bastedt
13463f269f Access now working in ESI file. 2025-02-20 10:33:38 +01:00
Hakan Bastedt
bec102b7f6 Now recognozing the chosen access method in the gui
Also RW in objectlist.c but not in esi file and unknown in eeprom
2025-02-20 09:57:54 +01:00
Hakan Bastedt
b136a93e28 ADS1014 working, in continuous mode. 0.15 ms to get value 2025-02-19 11:48:16 +01:00
Hakan Bastedt
72e861b174 Name change of E7000 2025-02-19 09:30:31 +01:00
Hakan Bastedt
7e0225711b Fixed status reporting 2025-02-17 09:22:07 +01:00
Hakan Bastedt
8e127929c4 Saved the pcb. 2025-02-16 17:25:57 +01:00
Hakan Bastedt
d357bfd43c Bummer, switched SDA and SCL position on THTIC vs E7000 I2C connector. Beware. 2025-02-16 16:40:06 +01:00
Hakan Bastedt
d52ec4672f Ordered the real version 2025-02-16 16:39:10 +01:00
Hakan Bastedt
aaebedc398 Commissioning tests added. E7000 tested all inputs, all outputs, I2C works. OK. 2025-02-16 08:58:08 +01:00
Hakan Bastedt
22531366af Fixed R17 C28 label position bug 2025-02-16 08:28:26 +01:00
Hakan Bastedt
0a66626fe4 I2C THTIC is working on a patched EaserCAT-4000., EaserCAT-7000 tested, STM32 and LAN9252 works. 2025-02-15 22:29:54 +01:00
Hakan Bastedt
f070ea592c R19 C27 Bug. Fixed. 2025-02-15 21:03:01 +01:00
Hakan Bastedt
e40d81e71c Works in TwinCAT. Prepare for test in machine. 2025-02-14 20:06:27 +01:00
Hakan Bastedt
310a08cc67 MCP3221 Found on I2C bus 2025-02-13 20:22:13 +01:00
Hakan Bastedt
d115eca125 ADS1115 wórking in prototype mode 2025-02-13 20:13:38 +01:00
Hakan Bastedt
e7872db6aa Branch mess fix 2025-02-13 14:25:46 +01:00
Hakan Bastedt
378a9eec89 Branch mess fix 2025-02-13 14:22:59 +01:00
Hakan Bastedt
2682eea508 Branch mess fix 2025-02-13 14:19:02 +01:00
Hakan Bastedt
191e652bb3 Branch mess fix 2025-02-13 14:07:40 +01:00
Hakan Bastedt
2fad0732f2 Branch mess fix 2025-02-13 14:06:57 +01:00
Hakan Bastedt
d2f17c5f7e EaserCAT-7000 project with two voltage sensor prototypes 2025-02-12 16:43:16 +01:00
Hakan Bastedt
3e8a4a7ec3 changes 2025-02-12 16:34:25 +01:00
Hakan Bastedt
8d31928d7a changes 2025-02-12 16:29:28 +01:00
Hakan Bastedt
a2787e04c2 update 2025-02-12 16:14:23 +01:00
Hakan Bastedt
edaf00681f Build.md initial 2025-02-12 15:31:59 +01:00
Hakan Bastedt
c62b865f03 Restored to cover also SM2/DC sync situation 2025-02-08 21:50:03 +01:00
Hakan Bastedt
ada1b8aa05 Works, sends Voltage during free-run to Twincat. 2025-02-08 21:48:26 +01:00
Hakan Bastedt
dda9d3bf20 EaserCAT-7000 initial 2025-02-08 11:41:29 +01:00
Hakan Bastedt
c410207d52 Merge branch 'main' of https://github.com/MetalMusings/MyOwnEtherCATDevice 2025-02-02 11:40:06 +01:00
Hakan Bastedt
1528d45ec6 EaserCAT 6000 release 2025-02-02 11:32:16 +01:00
Hakan Bastedt
0c5551663d Cleanup pending release 2025-02-02 09:43:58 +01:00
Hakan Bastedt
040ea4ab61 Closer to final version 2025-01-14 10:41:19 +01:00
Hakan Bastedt
3e76263177 Fixed placement of Out1-Out4 diodes' marking 2025-01-12 10:59:04 +01:00
Hakan Bastedt
28f05090f1 Added upload_port, to avoid program the wrong. 2025-01-11 20:07:19 +01:00
Hakan Bastedt
8568bf99b3 Modified, switch marker postions for C28 and R17 2025-01-11 20:05:59 +01:00
Hakan Bastedt
5f8c3ba5fc Firmware for EaserCAT-6000 brought in 2024-12-14 19:32:27 +01:00
Hakan Bastedt
909685cf0e Submitting design for fabrication 2024-12-14 11:47:00 +01:00
Håkan Båstedt
9cd264fa52 Update README.md 2024-12-13 11:06:58 +01:00
Hakan Bastedt
7ebc28a5ca Updated README after EaserCAT-5000 linuxcnc failure 2024-12-13 11:05:13 +01:00
Hakan Bastedt
77cc13f175 Updated EaserCAT 5000 description somewhat 2024-12-11 12:48:03 +01:00
Hakan Bastedt
2871fd7905 New place for eeprom programming program 2024-12-10 20:57:16 +01:00
Hakan Bastedt
44d2324a03 Updates to hw straps after startup of card. 2024-12-10 20:44:29 +01:00
Hakan Bastedt
1df85b5646 faulty .gitignore 2024-12-06 07:49:54 +01:00
Hakan Bastedt
a653a3d94a Removed Gerbers. Generate them as needed instead 2024-11-25 22:32:34 +01:00
Hakan Bastedt
e26d411d61 Updated reset circuit to PB12 2024-11-25 22:30:41 +01:00
Hakan Bastedt
e285923d2e Updated 24V field voltage routing. Files sent for fab 2024-11-25 20:15:11 +01:00
Hakan Bastedt
0aba15aaab make xml files available 2024-11-25 12:37:30 +01:00
Hakan Bastedt
29fb2bfe6c make xml files available 2024-11-25 12:36:07 +01:00
Hakan Bastedt
76335711e6 Conf, untested 2024-11-25 12:32:10 +01:00
Hakan Bastedt
4e32128a0f Fixes to e3000 2024-11-21 21:28:56 +01:00
Hakan Bastedt
cdce935560 Final update of README.md for this time 2024-11-21 11:49:29 +01:00
Hakan Bastedt
6e0496805a Updated README.md 2024-11-21 11:40:25 +01:00
Hakan Bastedt
3bd59f4c3e Updated README.md 2024-11-21 11:39:24 +01:00
Hakan Bastedt
92244e3c9c Updated README.md 2024-11-21 11:17:29 +01:00
Hakan Bastedt
b722cc6b25 Moving all to Kicad8. Housekeeping symbols,libraries,3d-models 2024-11-21 11:10:24 +01:00
Hakan Bastedt
0795eea21e Updated README.md 2024-11-20 16:48:25 +01:00
Hakan Bastedt
d38497ed85 Updated README.md 2024-11-20 16:45:50 +01:00
Hakan Bastedt
1918604586 Ny structure. Start of the "main" branch 2024-11-20 11:18:13 +01:00
Hakan Bastedt
31b896871d Actually fix the hex wrongful alignment 2024-11-18 12:36:50 +01:00
Hakan Bastedt
3a44cded1f Added study of OS version, NICs, computers to see what cycle times are reliable 2024-04-14 20:40:11 +02:00
Hakan Bastedt
c710f3e57e Added valid xml and bin esi for AX58100, from evaluation board, converted with siitool 2024-04-14 20:38:58 +02:00
Hakan Bastedt
855553bed7 Test version, test OS and nic. Added counters to detect work/no work 2024-04-14 13:07:43 +02:00
Hakan Bastedt
a4ca1f641a Tried to extrapolate when missing position data. Didn't work as expected but I'll keep it. 2024-04-12 17:56:26 +02:00
572 changed files with 1309225 additions and 131921 deletions

10
.gitignore vendored
View File

@@ -4,3 +4,13 @@
.vscode/launch.json
.vscode/ipch
Octave
.pioenvs
.piolibdeps
.clang_complete
.gcc-flags.json
.pio
logs
*.bak
*~

70
Build.md Normal file
View File

@@ -0,0 +1,70 @@
# Building an EaserCAT board
## Parts
Most parts are generic and can be found in many places. SMD resistors and capacitors are standard, nothing special.
Crystals are standard type hc49/s.
In case of smd crystal then it's a "passive smd crystal 3225"
For ferrite beads marked BLM18EG221SN1D - you can use any generic "ferrite bead 220 Ohm 0603 1ln". Not sure if 1ln is important nor what it means. In the schematics some are called BLM18EG221SN1D, others are called BLM18EG221S. It is the same, just a mistake in the naming.
RJ45 connectors must include "magnetics" and be configured in this way\
![RJ45 Symbol](Utils/Pictures/RJ45-magnetics.png)\
I have used PulseJack JN0011D01BNL (and most likely a chinese knockoff) and it works fine, but any jack that meets the diagram above will work.
The EtherCAT ICs are from aliexpress. There are quite a few sellers that has the LAN9252i/PT and the Ax58100 (LAN9252/PT and LAN9252V/PT are also possible, temperature range differs). Afaik, there is only one variant of the Ax58100 - AX58100LT. The LAN9252 is generally available, the Ax58100 is more of a challenge but check aliexpress.
The pcb needs to be ordered. Consider using a solder stencil - but hey it's up to you. I have bought pcbs from some chinese factories and from Aisler, Germany. The Aisler pcb is the nicest and came with excellent solder stencil. At a bit higher cost, nothing dramatic though. If you are hunting pennies then go to one of the chinese ones, maybe check prices at https://pcbshopper.com.
## EEPROM
You need to fill the EEPROM with valid contents before putting it on the pcb. It is actually mandatory, the EtherCAT IC will not start with an empty EEPROM, or with a non-valid content. It doesn't have to be for a real EtherCAT slave, because the first thing you will do when the card works is to upload the correct contents using TwinCAT. Any valid EEPROM content.
There is a small Arduino program [Link here](Utils/EEPROM_store_valid/) that helps to fill the empty EEPROM. Follow the link.
## Populating the pcb
Enjoy!
## Soldering
I have put the pcb in the soldering oven. Hand soldering should work, although the pin spacing is only 0.4 m on the Ax58100 IC and can be a challenge. I usually get some solder bridges on the EtherCAT IC or the STM32 chip. A magnifyng device definitely helps.
## Powering up
Need:\
STLINK/V2\
Serial port - USB
Connect the STLINK/V2 unit and the serial port. The serial port will provide 5V, you don't need to see the serial output (there isn't any).
Ax58100\
Red led status - Blinking pattern means succesful read of eeprom
Gree led status - Blinking pattern indicates EtherCAT state (init, op, etc.)
LAN9252\
There is no indication.
## Hookup to TwinCAT
Install TwinCAT/XAE\
Ethernet cable\
Network interface assignment\
scan\
free-run\
download EEPROM contents
## Build and download firmware
vscode\
platformio\
open folder\
Build and upload\
## Twincat verification
## Linuxcnc
## Modifying the firmware

30
Cards/.gitignore vendored Normal file
View File

@@ -0,0 +1,30 @@
TEST*
Gerbers*
*.zip
For PCBs designed using KiCad: https://www.kicad.org/
# Format documentation: https://kicad.org/help/file-formats/
# Temporary files
*.000
*.bak
*.bck
*.kicad_pcb-bak
*.kicad_sch-bak
*-backups
*.kicad_prl
*.sch-bak
*~
_autosave-*
*.tmp
*-save.pro
*-save.kicad_pcb
fp-info-cache
~*.lck
\#auto_saved_files#
# Netlist files (exported from Eeschema)
*.net
# Autorouter files (exported from Pcbnew)
*.dsn
*.ses

View File

@@ -92,7 +92,7 @@ public:
volatile uint64_t cnt = 0; // Debug counter
#undef double
StepGen3(void);
void updateStepGen(double pos_cmd1, double pos_cmd2);
void updateStepGen(double pos_cmd1, double pos_cmd2, uint32_t servoPeriod);
void makeAllPulses(void);
int rtapi_app_main();
int export_stepgen(int num, stepgen_t *addr, int step_type, int pos_mode);
@@ -147,7 +147,7 @@ private:
// For the example
#define BASE_PERIOD 20000
#define SERVO_PERIOD 2000000
//#define SERVO_PERIOD 2000000
#define JOINT_X_STEPGEN_MAXACCEL 0.0
#define JOINT_Z_STEPGEN_MAXACCEL 0.0
#define JOINT_X_SCALE -200

View File

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 48 KiB

View File

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 58 KiB

View File

@@ -15,7 +15,7 @@ board = genericSTM32F407VGT6
upload_protocol = stlink
debug_tool = stlink
debug_build_flags = -O0 -g -ggdb
monitor_port = COM7
monitor_port = COM10
monitor_filters = send_on_enter, time, colorize, log2file
monitor_speed = 115200
build_flags = -Wl,--no-warn-rwx-segment

View File

@@ -1102,7 +1102,7 @@ StepGen3::StepGen3(void)
stepgen_array[0].enable = stepgen_array[1].enable = 1;
}
void StepGen3::updateStepGen(double pos_cmd1, double pos_cmd2)
void StepGen3::updateStepGen(double pos_cmd1, double pos_cmd2, uint32_t servoPeriod)
{
stepgen_array[0].pos_cmd = pos_cmd1;
stepgen_array[1].pos_cmd = pos_cmd2;
@@ -1110,8 +1110,8 @@ void StepGen3::updateStepGen(double pos_cmd1, double pos_cmd2)
{
stepgen_t *step;
step = &(stepgen_array[i]);
update_pos(step, SERVO_PERIOD);
update_freq(step, SERVO_PERIOD);
update_pos(step, servoPeriod); // servoPeriod is in nanosecs
update_freq(step, servoPeriod);
}
}

View File

@@ -12,7 +12,7 @@ HardwareSerial Serial1(PA10, PA9);
volatile uint16_t ALEventIRQ; // ALEvent that caused the interrupt
HardwareTimer *baseTimer; // The base period timer
HardwareTimer *syncTimer; // The timer that syncs "with linuxcnc cycle"
uint16_t sync0CycleTime; // usecs
uint32_t sync0CycleTime; // nanosecs, often 1000000 ( 1 ms )
#include "MyEncoder.h"
volatile uint16_t encCnt = 0;
@@ -47,18 +47,21 @@ volatile uint16_t basePeriodCnt;
volatile uint64_t makePulsesCnt = 0, prevMakePulsesCnt = 0;
volatile uint16_t deltaMakePulsesCnt;
volatile double pos_cmd1, pos_cmd2;
volatile double posCmd1, posCmd2;
double oldPosCmd1, oldPosCmd2;
double deltaPosCmd1, deltaPosCmd2;
void syncWithLCNC()
{
syncTimer->pause();
baseTimer->pause();
deltaMakePulsesCnt = makePulsesCnt - prevMakePulsesCnt;
prevMakePulsesCnt = makePulsesCnt;
Step->updateStepGen(pos_cmd1, pos_cmd2); // Update positions
Step->makeAllPulses(); // Make first step right here
basePeriodCnt = SERVO_PERIOD / BASE_PERIOD; //
baseTimer->refresh(); //
baseTimer->resume(); // Make the other steps in ISR
Step->updateStepGen(posCmd1, posCmd2, sync0CycleTime); // Update positions
Step->makeAllPulses(); // Make first step right here
basePeriodCnt = sync0CycleTime / BASE_PERIOD; //
baseTimer->refresh(); //
baseTimer->resume(); // Make the other steps in ISR
}
void basePeriodCB(void)
@@ -74,13 +77,17 @@ uint16_t thisCycleTime; // In usecs
int16_t maxIrqServeTime = 0;
uint64_t oldIrqTime = 0;
uint16_t nLoops;
uint16_t failedSM2s = 0;
uint16_t totalFailedSM2s = 0;
uint16_t nLoopsAboveNorm = 0;
void handleStepper(void)
{
if (oldIrqTime != 0) // See if there is a delay in data, normally it *should* be nLoops=1, but sometimes it is more
{
thisCycleTime = irqTime - oldIrqTime;
nLoops = round(float(thisCycleTime) / float(sync0CycleTime));
nLoops = round(float(thisCycleTime) / float(sync0CycleTime / 1000));
nLoopsAboveNorm += nLoops - 1;
}
oldIrqTime = irqTime;
@@ -100,18 +107,34 @@ void handleStepper(void)
if (maxIrqServeTime < maxInBuffer)
maxIrqServeTime = maxInBuffer;
}
if (ALEventIRQ & ESCREG_ALEVENT_SM2)
{ // The normal case, position update every cycle
posCmd1 = Obj.CommandedPosition1; // The position update
posCmd2 = Obj.CommandedPosition2;
deltaPosCmd1 = posCmd1 - oldPosCmd1; // Needed for extrapolation in the other case
deltaPosCmd2 = posCmd2 - oldPosCmd2;
failedSM2s = 0;
}
else
{ // Not normal, we didn't get a position update. Extrapolate from previous updates
if (failedSM2s++ < 100) // Do max 10 such extrapolations, should be plenty
{ //
posCmd1 += deltaPosCmd1; // Continue with the same speed
posCmd2 += deltaPosCmd2;
}
totalFailedSM2s++;
}
oldPosCmd1 = posCmd1;
oldPosCmd2 = posCmd2;
pos_cmd1 = Obj.CommandedPosition1;
pos_cmd2 = Obj.CommandedPosition2;
Obj.ActualPosition1 = Obj.CommandedPosition1;
Obj.ActualPosition2 = Obj.CommandedPosition2;
// Obj.ActualPosition1 = Obj.CommandedPosition1;
// Obj.ActualPosition2 = Obj.CommandedPosition2;
Step->stepgen_array[0].pos_scale = -Obj.StepsPerMM1;
Step->stepgen_array[1].pos_scale = -Obj.StepsPerMM2;
// Obj.ActualPosition1 = Step->stepgen_array[0].pos_fb;
// Obj.ActualPosition2 = Step->stepgen_array[1].pos_fb;
Obj.ActualPosition1 = Step->stepgen_array[0].pos_fb;
Obj.ActualPosition2 = Step->stepgen_array[1].pos_fb;
delayT = maxIrqServeTime - diffT; // Add 10 as some safety margin
if (delayT > 0 && delayT < 900)
@@ -135,10 +158,10 @@ void cb_get_inputs(void) // Set Master inputs, slave outputs, last operation
Obj.IndexByte = Encoder1.getIndexState();
Obj.DiffT = nLoops;
Obj.D1 = 1000 * Obj.CommandedPosition2; // abs(1000 * (ap2 - Obj.CommandedPosition2)); // Step2.actPos();
Obj.D2 = 1000 * Obj.ActualPosition2; // Step->stepgen_array[1].pos_fb; // Step->stepgen_array[1].rawcount % INT16_MAX; // Step->stepgen_array[1].freq;
Obj.D3 = encCnt % 256; // Step->stepgen_array[1].freq;
Obj.D4 = 1000 * (Obj.CommandedPosition2 - oldCommandedPosition); // deltaMakePulsesCnt; // Step->stepgen_array[1].rawcount % UINT16_MAX;
Obj.D1 = 1000 * deltaPosCmd2; // abs(1000 * (ap2 - Obj.CommandedPosition2)); // Step2.actPos();
Obj.D2 = totalFailedSM2s; // Step->stepgen_array[1].pos_fb; // Step->stepgen_array[1].rawcount % INT16_MAX; // Step->stepgen_array[1].freq;
Obj.D3 = 1000 * Obj.CommandedPosition2; // Step->stepgen_array[1].freq;
Obj.D4 = 1000 * posCmd2; // Step->stepgen_array[1].rawcount % UINT16_MAX;
oldCommandedPosition = Obj.CommandedPosition2;
}
@@ -270,7 +293,7 @@ uint16_t dc_checker(void)
{
// Indicate we run DC
ESCvar.dcsync = 1;
sync0CycleTime = ESC_SYNC0cycletime() / 1000; // usecs
sync0CycleTime = ESC_SYNC0cycletime(); // nanosecs
return 0;
}

47
Cards/EaserCAT-2000/Kicad/.gitignore vendored Normal file
View File

@@ -0,0 +1,47 @@
fp-info-cache
Ethercat-stm32-backup*
*.lck
# For PCBs designed using KiCad: https://www.kicad.org/
# Format documentation: https://kicad.org/help/file-formats/
# Temporary files
*.000
*.bak
*.bck
*.kicad_pcb-bak
*.kicad_sch-bak
*-backups
*.kicad_prl
*.sch-bak
*~
_autosave-*
*.tmp
*-save.pro
*-save.kicad_pcb
fp-info-cache
~*.lck
\#auto_saved_files#
# Netlist files (exported from Eeschema)
*.net
# Autorouter files (exported from Pcbnew)
*.dsn
*.ses
# Exported BOM files
*.xml
*.csv
# Gerber outputs
Gerbers\*
*.zip
# Exported BOM files
*.xml
*.csv
*.step
*.stp
*.stl
.~lock.*

File diff suppressed because it is too large Load Diff

View File

@@ -169,6 +169,13 @@
"via_dimensions": [],
"zones_allow_external_fillets": false
},
"ipc2581": {
"dist": "",
"distpn": "",
"internal_id": "",
"mfg": "",
"mpn": ""
},
"layer_presets": [],
"viewports": []
},
@@ -427,14 +434,76 @@
"gencad": "",
"idf": "",
"netlist": "C:/Program Files/KiCad/7.0/",
"plot": "",
"pos_files": "",
"specctra_dsn": "Ethercat-stm32.dsn",
"step": "",
"svg": "",
"vrml": ""
},
"page_layout_descr_file": ""
},
"schematic": {
"annotate_start_num": 0,
"bom_export_filename": "",
"bom_fmt_presets": [],
"bom_fmt_settings": {
"field_delimiter": ",",
"keep_line_breaks": false,
"keep_tabs": false,
"name": "CSV",
"ref_delimiter": ",",
"ref_range_delimiter": "",
"string_delimiter": "\""
},
"bom_presets": [],
"bom_settings": {
"exclude_dnp": false,
"fields_ordered": [
{
"group_by": false,
"label": "Reference",
"name": "Reference",
"show": true
},
{
"group_by": true,
"label": "Value",
"name": "Value",
"show": true
},
{
"group_by": false,
"label": "Datasheet",
"name": "Datasheet",
"show": true
},
{
"group_by": false,
"label": "Footprint",
"name": "Footprint",
"show": true
},
{
"group_by": false,
"label": "Qty",
"name": "${QUANTITY}",
"show": true
},
{
"group_by": true,
"label": "DNP",
"name": "${DNP}",
"show": true
}
],
"filter_string": "",
"group_symbols": true,
"name": "Grouped By Value",
"sort_asc": true,
"sort_field": "Reference"
},
"connection_grid_size": 50.0,
"drawing": {
"dashed_lines_dash_length_ratio": 12.0,
"dashed_lines_gap_length_ratio": 3.0,
@@ -448,6 +517,11 @@
"intersheets_ref_suffix": "",
"junction_size_choice": 3,
"label_size_ratio": 0.375,
"operating_point_overlay_i_precision": 3,
"operating_point_overlay_i_range": "~A",
"operating_point_overlay_v_precision": 3,
"operating_point_overlay_v_range": "~V",
"overbar_offset_ratio": 1.23,
"pin_symbol_size": 25.0,
"text_offset_ratio": 0.15
},
@@ -463,6 +537,7 @@
"spice_external_command": "spice \"%I\"",
"spice_model_current_sheet_as_root": true,
"spice_save_all_currents": false,
"spice_save_all_dissipations": false,
"spice_save_all_voltages": false,
"subpart_first_id": 65,
"subpart_id_separator": 0
@@ -470,7 +545,7 @@
"sheets": [
[
"5597aedc-b607-407f-bbfd-31b3b298ecb1",
""
"Root"
],
[
"a120273a-c1ae-42b3-935d-01f789f654a3",

View File

@@ -0,0 +1,176 @@
(kicad_sch
(version 20231120)
(generator "eeschema")
(generator_version "8.0")
(uuid "5597aedc-b607-407f-bbfd-31b3b298ecb1")
(paper "A3")
(lib_symbols)
(text "Huvudsida"
(exclude_from_sim no)
(at 162.56 85.09 0)
(effects
(font
(size 1.27 1.27)
)
(justify left bottom)
)
(uuid "adf2be63-7ec7-44be-837f-901ddbc80717")
)
(sheet
(at 144.78 224.79)
(size 71.12 16.51)
(fields_autoplaced yes)
(stroke
(width 0.1524)
(type solid)
)
(fill
(color 0 0 0 0.0000)
)
(uuid "0a376a6c-0f15-42f8-81f6-3a55619be267")
(property "Sheetname" "Peripherals"
(at 144.78 224.0784 0)
(effects
(font
(size 1.27 1.27)
)
(justify left bottom)
)
)
(property "Sheetfile" "peripherals.kicad_sch"
(at 144.78 241.8846 0)
(effects
(font
(size 1.27 1.27)
)
(justify left top)
)
)
(instances
(project "Ethercat-stm32"
(path "/5597aedc-b607-407f-bbfd-31b3b298ecb1"
(page "5")
)
)
)
)
(sheet
(at 46.99 224.79)
(size 82.55 17.78)
(fields_autoplaced yes)
(stroke
(width 0.1524)
(type solid)
)
(fill
(color 0 0 0 0.0000)
)
(uuid "650f1ee4-2ce7-4e9d-a70d-f9d8defa5d03")
(property "Sheetname" "LAN9252_diverse"
(at 46.99 224.0784 0)
(effects
(font
(size 1.27 1.27)
)
(justify left bottom)
)
)
(property "Sheetfile" "LAN9252_diverse.kicad_sch"
(at 46.99 243.1546 0)
(effects
(font
(size 1.27 1.27)
)
(justify left top)
)
)
(instances
(project "Ethercat-stm32"
(path "/5597aedc-b607-407f-bbfd-31b3b298ecb1"
(page "3")
)
)
)
)
(sheet
(at 46.99 200.66)
(size 82.55 17.78)
(fields_autoplaced yes)
(stroke
(width 0.1524)
(type solid)
)
(fill
(color 0 0 0 0.0000)
)
(uuid "a120273a-c1ae-42b3-935d-01f789f654a3")
(property "Sheetname" "LAN9252"
(at 46.99 199.9484 0)
(effects
(font
(size 1.27 1.27)
)
(justify left bottom)
)
)
(property "Sheetfile" "LAN9252.kicad_sch"
(at 46.99 219.0246 0)
(effects
(font
(size 1.27 1.27)
)
(justify left top)
)
)
(instances
(project "Ethercat-stm32"
(path "/5597aedc-b607-407f-bbfd-31b3b298ecb1"
(page "2")
)
)
)
)
(sheet
(at 142.24 200.66)
(size 74.93 17.78)
(fields_autoplaced yes)
(stroke
(width 0.1524)
(type solid)
)
(fill
(color 0 0 0 0.0000)
)
(uuid "d564400f-40ba-4aca-9c2a-14ec52a8353b")
(property "Sheetname" "STM32F4"
(at 142.24 199.9484 0)
(effects
(font
(size 1.27 1.27)
)
(justify left bottom)
)
)
(property "Sheetfile" "STM32F4.kicad_sch"
(at 142.24 219.0246 0)
(effects
(font
(size 1.27 1.27)
)
(justify left top)
)
)
(instances
(project "Ethercat-stm32"
(path "/5597aedc-b607-407f-bbfd-31b3b298ecb1"
(page "4")
)
)
)
)
(sheet_instances
(path "/"
(page "1")
)
)
)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

Before

Width:  |  Height:  |  Size: 4.8 MiB

After

Width:  |  Height:  |  Size: 4.8 MiB

Some files were not shown because too many files have changed in this diff Show More