Compare commits
265 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9cc9a41ea2 | ||
|
|
a6b70bf6c6 | ||
|
|
cf4bece469 | ||
|
|
cd78577e4d | ||
|
|
2a92e97aaa | ||
|
|
a19a3b5b4e | ||
|
|
924ab972cb | ||
|
|
08915ef4bb | ||
|
|
f253ce8482 | ||
|
|
93c48940b8 | ||
|
|
b3bb88cf08 | ||
|
|
b867d58b15 | ||
|
|
2770c70d90 | ||
|
|
719f1755fe | ||
|
|
c31249b603 | ||
|
|
dcce7b5375 | ||
|
|
430eedd77d | ||
|
|
dac61fbba5 | ||
|
|
15d25ab06d | ||
|
|
44a15a21f8 | ||
|
|
90a2d4dd32 | ||
|
|
4b3567aa45 | ||
|
|
28a3edc8b8 | ||
|
|
6dc4d9fa03 | ||
|
|
dfabecc28e | ||
|
|
f34c5ebe9b | ||
|
|
7ffe9158df | ||
|
|
c6d88beb56 | ||
|
|
d7a2110a67 | ||
|
|
3c61897b8e | ||
|
|
81b930b290 | ||
|
|
6d7d20774d | ||
|
|
a0a4d5d9f3 | ||
|
|
bd5d77395f | ||
|
|
e4c3f14809 | ||
|
|
eb1d76ad3f | ||
|
|
f46140484b | ||
|
|
418aac0a35 | ||
|
|
73a34a2559 | ||
|
|
20f1acdbeb | ||
|
|
fe24b8f4a3 | ||
|
|
ca4248ce2d | ||
|
|
a73339d6ff | ||
|
|
9956a50722 | ||
|
|
5b61d87f68 | ||
|
|
766985d11a | ||
|
|
7f5e392a3e | ||
|
|
97fefb19af | ||
|
|
a283091a3f | ||
|
|
3df3d63fff | ||
|
|
f79ad7035e | ||
|
|
8130f407b9 | ||
|
|
a0ea80e368 | ||
|
|
47d05ff020 | ||
|
|
bc08682f31 | ||
|
|
b75cde78c1 | ||
|
|
9ba809d4cd | ||
|
|
eced221b35 | ||
|
|
8726aff1f8 | ||
|
|
6de2a44814 | ||
|
|
27c644cd68 | ||
|
|
08f2544560 | ||
|
|
a0e74cf2dd | ||
|
|
9411889f54 | ||
|
|
206c033fc6 | ||
|
|
47d8bdb89d | ||
|
|
fbc031a61e | ||
|
|
c160901131 | ||
|
|
e9d046bbb7 | ||
|
|
71158e3e47 | ||
|
|
72ec3e38a0 | ||
|
|
13463f269f | ||
|
|
bec102b7f6 | ||
|
|
b136a93e28 | ||
|
|
72e861b174 | ||
|
|
7e0225711b | ||
|
|
8e127929c4 | ||
|
|
d357bfd43c | ||
|
|
d52ec4672f | ||
|
|
aaebedc398 | ||
|
|
22531366af | ||
|
|
0a66626fe4 | ||
|
|
f070ea592c | ||
|
|
e40d81e71c | ||
|
|
310a08cc67 | ||
|
|
d115eca125 | ||
|
|
e7872db6aa | ||
|
|
378a9eec89 | ||
|
|
2682eea508 | ||
|
|
191e652bb3 | ||
|
|
2fad0732f2 | ||
|
|
d2f17c5f7e | ||
|
|
3e8a4a7ec3 | ||
|
|
8d31928d7a | ||
|
|
a2787e04c2 | ||
|
|
edaf00681f | ||
|
|
c62b865f03 | ||
|
|
ada1b8aa05 | ||
|
|
dda9d3bf20 | ||
|
|
c410207d52 | ||
|
|
1528d45ec6 | ||
|
|
0c5551663d | ||
|
|
040ea4ab61 | ||
|
|
3e76263177 | ||
|
|
28f05090f1 | ||
|
|
8568bf99b3 | ||
|
|
5f8c3ba5fc | ||
|
|
909685cf0e | ||
|
|
9cd264fa52 | ||
|
|
7ebc28a5ca | ||
|
|
77cc13f175 | ||
|
|
2871fd7905 | ||
|
|
44d2324a03 | ||
|
|
1df85b5646 | ||
|
|
a653a3d94a | ||
|
|
e26d411d61 | ||
|
|
e285923d2e | ||
|
|
0aba15aaab | ||
|
|
29fb2bfe6c | ||
|
|
76335711e6 | ||
|
|
4e32128a0f | ||
|
|
cdce935560 | ||
|
|
6e0496805a | ||
|
|
3bd59f4c3e | ||
|
|
92244e3c9c | ||
|
|
b722cc6b25 | ||
|
|
0795eea21e | ||
|
|
d38497ed85 | ||
|
|
1918604586 | ||
|
|
31b896871d | ||
|
|
3a44cded1f | ||
|
|
c710f3e57e | ||
|
|
855553bed7 | ||
|
|
a4ca1f641a | ||
|
|
b1cc8f1717 | ||
|
|
55f7e19e88 | ||
|
|
220daa4408 | ||
|
|
37c14850bf | ||
|
|
ed9af2ec50 | ||
|
|
939470a0c6 | ||
|
|
ec1c8fc70f | ||
|
|
5eda2b451e | ||
|
|
226cbc5035 | ||
|
|
39e2ab31f1 | ||
|
|
b164040829 | ||
|
|
084e6891b6 | ||
|
|
ed8e4d8d39 | ||
|
|
a829b0c6e2 | ||
|
|
ab1a306d86 | ||
|
|
544dd5ed85 | ||
|
|
511e6442e9 | ||
|
|
63fafb4936 | ||
|
|
efa03e3095 | ||
|
|
dcf6c2d18a | ||
|
|
34e60e43d8 | ||
|
|
294831465b | ||
|
|
5c128f49b5 | ||
|
|
9e00caf7c5 | ||
|
|
1d14e1f295 | ||
|
|
5d90765920 | ||
|
|
e6ae2ad3c7 | ||
|
|
ea5a39d300 | ||
|
|
88bd1ead78 | ||
|
|
dccbd97a04 | ||
|
|
1b8721930e | ||
|
|
8710a547fe | ||
|
|
369a795ce5 | ||
|
|
2df0a0980c | ||
|
|
6383d6de89 | ||
|
|
7bff3f3789 | ||
|
|
23fe81afbe | ||
|
|
fa34d81e41 | ||
|
|
30a9f10c7b | ||
|
|
8f26a10224 | ||
|
|
d4fed6cfe8 | ||
|
|
27475eaecd | ||
|
|
71ae242fc4 | ||
|
|
f341eb5074 | ||
|
|
fef934b103 | ||
|
|
31be067dea | ||
|
|
94d68adbb1 | ||
|
|
e8ef618fcc | ||
|
|
a99d0f0eda | ||
|
|
c21d42cf0b | ||
|
|
cbc45bc80b | ||
|
|
7ffd757fb5 | ||
|
|
30dc44d5e6 | ||
|
|
2b2be4f63d | ||
|
|
cbae816bd9 | ||
|
|
c0d2bfcf62 | ||
|
|
f4a15afa8a | ||
|
|
c04ac0e74b | ||
|
|
6d18c2cb3f | ||
|
|
d0433b29cf | ||
|
|
fe3de876fa | ||
|
|
2fb5252d37 | ||
|
|
43854ca4d0 | ||
|
|
dbb4d0f34e | ||
|
|
f9b37cfa6c | ||
|
|
2b2704bb17 | ||
|
|
0384646972 | ||
|
|
133df5662d | ||
|
|
d1eb1d9a40 | ||
|
|
934f3cb028 | ||
|
|
d60822388e | ||
|
|
31d24e2676 | ||
|
|
c444f9a496 | ||
|
|
e234ea7a97 | ||
|
|
eb63adbdc2 | ||
|
|
70014d3b1d | ||
|
|
990801f2d0 | ||
|
|
329474309d | ||
|
|
da2b1f6376 | ||
|
|
a88090a853 | ||
|
|
aa955aec67 | ||
|
|
e641fd04b7 | ||
|
|
ac711cd168 | ||
|
|
ee56f85c53 | ||
|
|
69357d35a4 | ||
|
|
84d790c687 | ||
|
|
e7fc20fec5 | ||
|
|
f8cec1ac69 | ||
|
|
ddffbe5f8b | ||
|
|
e95a098367 | ||
|
|
1d36ffbf69 | ||
|
|
c97e1fa96a | ||
|
|
ef84d552e4 | ||
|
|
d93adac4a2 | ||
|
|
ca3ceac5c6 | ||
|
|
b534e3d4da | ||
|
|
6ac0949f26 | ||
|
|
1f97534133 | ||
|
|
e6bfe4f880 | ||
|
|
8f05f33e58 | ||
|
|
9e311038c1 | ||
|
|
9ab4afabe4 | ||
|
|
38825bbaf3 | ||
|
|
0a04124b35 | ||
|
|
760944afe5 | ||
|
|
044e8fd2c5 | ||
|
|
697ea19dae | ||
|
|
20ca9d4974 | ||
|
|
c6857d0be2 | ||
|
|
f14b0160f6 | ||
|
|
deadd488dd | ||
|
|
25c2aa7b3c | ||
|
|
7a63d27303 | ||
|
|
6176166b3a | ||
|
|
5df911296c | ||
|
|
a4488da9fa | ||
|
|
cd8388ea58 | ||
|
|
6f29a0d492 | ||
|
|
3bbf089d01 | ||
|
|
2e4e768d5e | ||
|
|
6c168d96d9 | ||
|
|
f8fc5fccd6 | ||
|
|
f6abd73c58 | ||
|
|
c5a95074dc | ||
|
|
8614d1dfd3 | ||
|
|
251fd29d23 | ||
|
|
5ad02fae03 | ||
|
|
9adae08b98 | ||
|
|
0b9ce37200 | ||
|
|
120b423f59 | ||
|
|
222e5857dc |
11
.gitignore
vendored
11
.gitignore
vendored
@@ -3,3 +3,14 @@
|
||||
.vscode/c_cpp_properties.json
|
||||
.vscode/launch.json
|
||||
.vscode/ipch
|
||||
Octave
|
||||
|
||||
.pioenvs
|
||||
.piolibdeps
|
||||
.clang_complete
|
||||
.gcc-flags.json
|
||||
.pio
|
||||
|
||||
logs
|
||||
*.bak
|
||||
*~
|
||||
|
||||
70
Build.md
Normal file
70
Build.md
Normal 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\
|
||||
\
|
||||
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
30
Cards/.gitignore
vendored
Normal 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
|
||||
6
Cards/EaserCAT-2000/Firmware/.gitignore
vendored
Executable file
6
Cards/EaserCAT-2000/Firmware/.gitignore
vendored
Executable file
@@ -0,0 +1,6 @@
|
||||
.pio
|
||||
.vscode/.browse.c_cpp.db*
|
||||
.vscode/c_cpp_properties.json
|
||||
.vscode/launch.json
|
||||
.vscode/ipch
|
||||
.vscode/settings.json
|
||||
1
Cards/EaserCAT-2000/Firmware/doc/.gitignore
vendored
Normal file
1
Cards/EaserCAT-2000/Firmware/doc/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
.~lock.*
|
||||
BIN
Cards/EaserCAT-2000/Firmware/doc/Stepgen.odp
Executable file
BIN
Cards/EaserCAT-2000/Firmware/doc/Stepgen.odp
Executable file
Binary file not shown.
38
Cards/EaserCAT-2000/Firmware/include/MyEncoder.h
Executable file
38
Cards/EaserCAT-2000/Firmware/include/MyEncoder.h
Executable file
@@ -0,0 +1,38 @@
|
||||
#ifndef MYENCODER
|
||||
#define MYENCODER
|
||||
#include "Stm32F4_Encoder.h"
|
||||
#include <CircularBuffer.hpp>
|
||||
#define RINGBUFFERLEN 11
|
||||
|
||||
class MyEncoder
|
||||
{
|
||||
public:
|
||||
MyEncoder(TIM_TypeDef *_tim_base, uint8_t _indexPin, void irq(void));
|
||||
int64_t unwrapEncoder(uint16_t in);
|
||||
void indexPulse(void);
|
||||
uint8_t indexHappened();
|
||||
double currentPos();
|
||||
double frequency(uint64_t time);
|
||||
uint8_t getIndexState();
|
||||
void setScale(double scale);
|
||||
void setLatch(uint8_t latchEnable);
|
||||
|
||||
private:
|
||||
int64_t previousEncoderCounterValue = 0;
|
||||
double PosScaleRes = 1.0;
|
||||
uint32_t CurPosScale = 1;
|
||||
uint8_t oldLatchCEnable = 0;
|
||||
volatile uint8_t indexPulseFired = 0;
|
||||
volatile uint8_t pleaseZeroTheCounter = 0;
|
||||
Encoder EncoderInit;
|
||||
uint8_t indexPin;
|
||||
|
||||
CircularBuffer<double_t, RINGBUFFERLEN> Pos;
|
||||
CircularBuffer<uint32_t, RINGBUFFERLEN> TDelta;
|
||||
double curPos;
|
||||
double oldFrequency;
|
||||
|
||||
TIM_TypeDef *tim_base;
|
||||
};
|
||||
|
||||
#endif
|
||||
43
Cards/EaserCAT-2000/Firmware/include/StepGen.h
Executable file
43
Cards/EaserCAT-2000/Firmware/include/StepGen.h
Executable file
@@ -0,0 +1,43 @@
|
||||
|
||||
#ifndef STEPGEN
|
||||
#define STEPGEN
|
||||
#include <HardwareTimer.h>
|
||||
|
||||
class StepGen
|
||||
{
|
||||
private:
|
||||
volatile uint8_t timerIsRunning;
|
||||
volatile int32_t timerStepPosition;
|
||||
volatile int32_t timerStepDirection;
|
||||
volatile int32_t timerStepPositionAtEnd;
|
||||
volatile int32_t timerNewEndStepPosition;
|
||||
volatile uint32_t timerNewCycleTime;
|
||||
volatile double_t actualPosition;
|
||||
volatile double_t requestedPosition;
|
||||
volatile uint8_t enabled;
|
||||
HardwareTimer *MyTim;
|
||||
HardwareTimer *MyTim2;
|
||||
uint16_t stepsPerMM;
|
||||
uint8_t dirPin;
|
||||
PinName stepPin;
|
||||
uint32_t timerChan;
|
||||
const uint32_t maxFreq = 100000;
|
||||
volatile uint32_t prevFreq1 = 0;
|
||||
volatile uint32_t prevFreq2 = 0;
|
||||
|
||||
public:
|
||||
static uint32_t sync0CycleTime;
|
||||
volatile uint32_t pwmCycleTime;
|
||||
|
||||
StepGen(TIM_TypeDef *Timer, uint32_t timerChannel, PinName stepPin, uint8_t dirPin, void irq(void));
|
||||
void reqPos(double_t pos);
|
||||
double reqPos();
|
||||
void actPos(double_t pos);
|
||||
double actPos();
|
||||
void handleStepper(void);
|
||||
void timerCB();
|
||||
void setScale(int16_t spm);
|
||||
void enable(uint8_t yes);
|
||||
};
|
||||
|
||||
#endif
|
||||
53
Cards/EaserCAT-2000/Firmware/include/StepGen2.h
Executable file
53
Cards/EaserCAT-2000/Firmware/include/StepGen2.h
Executable file
@@ -0,0 +1,53 @@
|
||||
|
||||
#ifndef STEPGEN
|
||||
#define STEPGEN
|
||||
#include <HardwareTimer.h>
|
||||
|
||||
class StepGen2
|
||||
{
|
||||
public:
|
||||
volatile double_t actualPosition;
|
||||
volatile int32_t nSteps;
|
||||
volatile uint32_t timerFrequency;
|
||||
volatile int32_t timerPosition = 0;
|
||||
volatile int32_t timerEndPosition = 0;
|
||||
|
||||
public:
|
||||
volatile float Tstartf; // Starting delay in secs
|
||||
volatile uint32_t Tstartu; // Starting delay in usecs
|
||||
volatile float Tpulses; // Time it takes to do pulses. Debug
|
||||
|
||||
HardwareTimer *pulseTimer;
|
||||
uint32_t pulseTimerChan;
|
||||
HardwareTimer *startTimer; // Use timers 10,11,13,14
|
||||
uint8_t dirPin;
|
||||
PinName dirPinName;
|
||||
PinName stepPin;
|
||||
uint32_t Tjitter = 400; // Longest time from IRQ to handling in handleStepper, unit is microseconds
|
||||
uint64_t dbg;
|
||||
const uint16_t t2 = 5; // DIR is ahead of PUL with at least 5 usecs
|
||||
const uint16_t t3 = 5; // Pulse width at least 2.5 usecs
|
||||
const uint16_t t4 = 5; // Low level width not less than 2.5 usecs
|
||||
const float maxAllowedFrequency = 1000000 / float(t3 + t4) * 0.9; // 150 kHz for now
|
||||
|
||||
public:
|
||||
volatile double_t commandedPosition; // End position when this cycle is completed
|
||||
volatile int32_t commandedStepPosition; // End step position when this cycle is completed
|
||||
volatile double_t initialPosition; // From previous cycle
|
||||
volatile int32_t initialStepPosition; // From previous cycle
|
||||
int16_t stepsPerMM; // This many steps per mm
|
||||
volatile uint8_t enabled; // Enabled step generator
|
||||
volatile float frequency;
|
||||
|
||||
static uint32_t sync0CycleTime; // Nominal EtherCAT cycle time nanoseconds
|
||||
volatile float lcncCycleTime; // Linuxcnc nominal cycle time in sec (1 ms often)
|
||||
|
||||
StepGen2(TIM_TypeDef *Timer, uint32_t _timerChannel, PinName _stepPin, uint8_t _dirPin, void irq(void), TIM_TypeDef *Timer2, void irq2(void));
|
||||
|
||||
uint32_t handleStepper(uint64_t irqTime /* time when irq happened nanosecs */, uint16_t nLoops);
|
||||
void startTimerCB();
|
||||
void pulseTimerCB();
|
||||
uint32_t updatePos(uint32_t i);
|
||||
};
|
||||
|
||||
#endif
|
||||
156
Cards/EaserCAT-2000/Firmware/include/StepGen3.h
Executable file
156
Cards/EaserCAT-2000/Firmware/include/StepGen3.h
Executable file
@@ -0,0 +1,156 @@
|
||||
|
||||
#ifndef STEPGEN3
|
||||
#define STEPGEN3
|
||||
#include <HardwareTimer.h>
|
||||
|
||||
#define MAX_CHAN 16
|
||||
#define MAX_CYCLE 18
|
||||
#define USER_STEP_TYPE 13
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/* stuff that is both read and written by makepulses */
|
||||
volatile unsigned int timer1; /* times out when step pulse should end */
|
||||
volatile unsigned int timer2; /* times out when safe to change dir */
|
||||
volatile unsigned int timer3; /* times out when safe to step in new dir */
|
||||
volatile int hold_dds; /* prevents accumulator from updating */
|
||||
volatile long addval; /* actual frequency generator add value */
|
||||
volatile long long accum; /* frequency generator accumulator */
|
||||
volatile int rawcount; /* param: position feedback in counts */
|
||||
volatile int curr_dir; /* current direction */
|
||||
volatile int state; /* current position in state table */
|
||||
/* stuff that is read but not written by makepulses */
|
||||
volatile int enable; /* pin for enable stepgen */
|
||||
volatile int target_addval; /* desired freq generator add value */
|
||||
volatile long deltalim; /* max allowed change per period */
|
||||
volatile int step_len; /* parameter: step pulse length */
|
||||
volatile unsigned int dir_hold_dly; /* param: direction hold time or delay */
|
||||
volatile unsigned int dir_setup; /* param: direction setup time */
|
||||
volatile int step_type; /* stepping type - see list above */
|
||||
volatile int cycle_max; /* cycle length for step types 2 and up */
|
||||
volatile int num_phases; /* number of phases for types 2 and up */
|
||||
volatile int phase[5]; /* pins for output signals */
|
||||
volatile const unsigned char *lut; /* pointer to state lookup table */
|
||||
/* stuff that is not accessed by makepulses */
|
||||
int pos_mode; /* 1 = position mode, 0 = velocity mode */
|
||||
unsigned int step_space; /* parameter: min step pulse spacing */
|
||||
double old_pos_cmd; /* previous position command (counts) */
|
||||
int count; /* pin: captured feedback in counts */
|
||||
#define double float
|
||||
double pos_scale; /* param: steps per position unit */
|
||||
double old_scale; /* stored scale value */
|
||||
double scale_recip; /* reciprocal value used for scaling */
|
||||
double vel_cmd; /* pin: velocity command (pos units/sec) */
|
||||
double pos_cmd; /* pin: position command (position units) */
|
||||
double pos_fb; /* pin: position feedback (position units) */
|
||||
double freq; /* param: frequency command */
|
||||
double maxvel; /* param: max velocity, (pos units/sec) */
|
||||
double maxaccel; /* param: max accel (pos units/sec^2) */
|
||||
unsigned int old_step_len; /* used to detect parameter changes */
|
||||
unsigned int old_step_space;
|
||||
unsigned int old_dir_hold_dly;
|
||||
unsigned int old_dir_setup;
|
||||
int printed_error; /* flag to avoid repeated printing */
|
||||
} stepgen_t;
|
||||
|
||||
#define MAX_STEP_TYPE 15
|
||||
|
||||
#define STEP_PIN 0 /* output phase used for STEP signal */
|
||||
#define DIR_PIN 1 /* output phase used for DIR signal */
|
||||
#define UP_PIN 0 /* output phase used for UP signal */
|
||||
#define DOWN_PIN 1 /* output phase used for DOWN signal */
|
||||
|
||||
#define PICKOFF 28 /* bit location in DDS accum */
|
||||
|
||||
typedef enum CONTROL
|
||||
{
|
||||
POSITION,
|
||||
VELOCITY,
|
||||
INVALID
|
||||
} CONTROL;
|
||||
|
||||
class StepGen3
|
||||
{
|
||||
public:
|
||||
int step_type[MAX_CHAN] = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}; // stepping types for up to 16 channels
|
||||
char *ctrl_type[MAX_CHAN] = {0}; // control type ("p"pos or "v"vel) for up to 16 channels
|
||||
int user_step_type[MAX_CYCLE] = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}; // lookup table for user-defined step type
|
||||
uint32_t stepPin[MAX_CHAN] = {0};
|
||||
uint32_t dirPin[MAX_CHAN] = {0};
|
||||
|
||||
stepgen_t *stepgen_array = 0;
|
||||
|
||||
int num_chan = 0; // number of step generators configured */
|
||||
long periodns; // makepulses function period in nanosec */
|
||||
long old_periodns; // used to detect changes in periodns */
|
||||
double periodfp; // makepulses function period in seconds */
|
||||
double freqscale; // conv. factor from Hz to addval counts */
|
||||
double accelscale; // conv. Hz/sec to addval cnts/period */
|
||||
long old_dtns; // update_freq funct period in nsec */
|
||||
double dt; // update_freq period in seconds */
|
||||
double recip_dt; // recprocal of period, avoids divides */
|
||||
volatile uint64_t cnt = 0; // Debug counter
|
||||
#undef double
|
||||
StepGen3(void);
|
||||
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);
|
||||
void make_pulses(void *arg, long period);
|
||||
void update_freq(void *arg, long period);
|
||||
void update_pos(void *arg, long period);
|
||||
int setup_user_step_type(void);
|
||||
CONTROL parse_ctrl_type(const char *ctrl);
|
||||
unsigned long ulceil(unsigned long value, unsigned long increment);
|
||||
|
||||
private:
|
||||
/* lookup tables for stepping types 2 and higher - phase A is the LSB */
|
||||
|
||||
unsigned char master_lut[MAX_STEP_TYPE][MAX_CYCLE] = {
|
||||
{1, 3, 2, 0, 0, 0, 0, 0, 0, 0}, /* type 2: Quadrature */
|
||||
{1, 2, 4, 0, 0, 0, 0, 0, 0, 0}, /* type 3: Three Wire */
|
||||
{1, 3, 2, 6, 4, 5, 0, 0, 0, 0}, /* type 4: Three Wire Half Step */
|
||||
{1, 2, 4, 8, 0, 0, 0, 0, 0, 0}, /* 5: Unipolar Full Step 1 */
|
||||
{3, 6, 12, 9, 0, 0, 0, 0, 0, 0}, /* 6: Unipoler Full Step 2 */
|
||||
{1, 7, 14, 8, 0, 0, 0, 0, 0, 0}, /* 7: Bipolar Full Step 1 */
|
||||
{5, 6, 10, 9, 0, 0, 0, 0, 0, 0}, /* 8: Bipoler Full Step 2 */
|
||||
{1, 3, 2, 6, 4, 12, 8, 9, 0, 0}, /* 9: Unipolar Half Step */
|
||||
{1, 5, 7, 6, 14, 10, 8, 9, 0, 0}, /* 10: Bipolar Half Step */
|
||||
{1, 2, 4, 8, 16, 0, 0, 0, 0, 0}, /* 11: Five Wire Unipolar */
|
||||
{3, 6, 12, 24, 17, 0, 0, 0, 0, 0}, /* 12: Five Wire Wave */
|
||||
{1, 3, 2, 6, 4, 12, 8, 24, 16, 17}, /* 13: Five Wire Uni Half */
|
||||
{3, 7, 6, 14, 12, 28, 24, 25, 17, 19}, /* 14: Five Wire Wave Half */
|
||||
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0} /* 15: User-defined */
|
||||
};
|
||||
|
||||
unsigned char cycle_len_lut[14] =
|
||||
{4, 3, 6, 4, 4, 4, 4, 8, 8, 5, 5, 10, 10, 0};
|
||||
|
||||
unsigned char num_phases_lut[14] =
|
||||
{
|
||||
2,
|
||||
3,
|
||||
3,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
5,
|
||||
5,
|
||||
5,
|
||||
5,
|
||||
0,
|
||||
};
|
||||
};
|
||||
|
||||
// For the example
|
||||
#define BASE_PERIOD 20000
|
||||
//#define SERVO_PERIOD 2000000
|
||||
#define JOINT_X_STEPGEN_MAXACCEL 0.0
|
||||
#define JOINT_Z_STEPGEN_MAXACCEL 0.0
|
||||
#define JOINT_X_SCALE -200
|
||||
#define JOINT_Z_SCALE -80
|
||||
|
||||
#endif
|
||||
652
Cards/EaserCAT-2000/Firmware/include/Stm32F4_Encoder.h
Executable file
652
Cards/EaserCAT-2000/Firmware/include/Stm32F4_Encoder.h
Executable file
@@ -0,0 +1,652 @@
|
||||
|
||||
#ifndef __Stm32F4_Encoder_H__
|
||||
#define __Stm32F4_Encoder_H__
|
||||
#include <Arduino.h>
|
||||
|
||||
#define GPIO_Speed_50MHz 0x02 /*!< Fast speed */
|
||||
|
||||
// #define GPIO_MODER_MODER0 ((uint32_t)0x00000003)
|
||||
#define GPIO_Mode_OUT 0x01
|
||||
// #define GPIO_OSPEEDER_OSPEEDR0 ((uint32_t)0x00000003)
|
||||
// #define GPIO_OTYPER_OT_0 ((uint32_t)0x00000001)
|
||||
// #define GPIO_PUPDR_PUPDR0 ((uint32_t)0x00000003)
|
||||
|
||||
#define GPIO_PuPd_NOPULL 0x00
|
||||
#define GPIO_Mode_AF 0x02
|
||||
#define GPIO_OType_PP 0x00
|
||||
#define GPIO_PuPd_NOPULL 0x00
|
||||
#define GPIO_Pin_0 ((uint16_t)0x0001) /* Pin 0 selected */
|
||||
#define GPIO_Pin_1 ((uint16_t)0x0002) /* Pin 1 selected */
|
||||
#define GPIO_Pin_2 ((uint16_t)0x0004) /* Pin 2 selected */
|
||||
#define GPIO_Pin_3 ((uint16_t)0x0008) /* Pin 3 selected */
|
||||
#define GPIO_Pin_4 ((uint16_t)0x0010) /* Pin 4 selected */
|
||||
#define GPIO_Pin_5 ((uint16_t)0x0020) /* Pin 5 selected */
|
||||
#define GPIO_Pin_6 ((uint16_t)0x0040) /* Pin 6 selected */
|
||||
#define GPIO_Pin_7 ((uint16_t)0x0080) /* Pin 7 selected */
|
||||
#define GPIO_Pin_8 ((uint16_t)0x0100) /* Pin 8 selected */
|
||||
#define GPIO_Pin_9 ((uint16_t)0x0200) /* Pin 9 selected */
|
||||
#define GPIO_Pin_10 ((uint16_t)0x0400) /* Pin 10 selected */
|
||||
#define GPIO_Pin_11 ((uint16_t)0x0800) /* Pin 11 selected */
|
||||
#define GPIO_Pin_12 ((uint16_t)0x1000) /* Pin 12 selected */
|
||||
#define GPIO_Pin_13 ((uint16_t)0x2000) /* Pin 13 selected */
|
||||
#define GPIO_Pin_14 ((uint16_t)0x4000) /* Pin 14 selected */
|
||||
#define GPIO_Pin_15 ((uint16_t)0x8000) /* Pin 15 selected */
|
||||
#define GPIO_Pin_All ((uint16_t)0xFFFF) /* All pins selected */
|
||||
|
||||
typedef struct TIM_TimeBaseInitTypeDef
|
||||
{
|
||||
uint16_t TIM_Prescaler; /*!< Specifies the prescaler value used to divide the TIM clock.
|
||||
This parameter can be a number between 0x0000 and 0xFFFF */
|
||||
|
||||
uint16_t TIM_CounterMode; /*!< Specifies the counter mode.
|
||||
This parameter can be a value of @ref TIM_Counter_Mode */
|
||||
|
||||
uint32_t TIM_Period; /*!< Specifies the period value to be loaded into the active
|
||||
Auto-Reload Register at the next update event.
|
||||
This parameter must be a number between 0x0000 and 0xFFFF. */
|
||||
|
||||
uint16_t TIM_ClockDivision; /*!< Specifies the clock division.
|
||||
This parameter can be a value of @ref TIM_Clock_Division_CKD */
|
||||
|
||||
uint8_t TIM_RepetitionCounter; /*!< Specifies the repetition counter value. Each time the RCR downcounter
|
||||
reaches zero, an update event is generated and counting restarts
|
||||
from the RCR value (N).
|
||||
This means in PWM mode that (N+1) corresponds to:
|
||||
- the number of PWM periods in edge-aligned mode
|
||||
- the number of half PWM period in center-aligned mode
|
||||
This parameter must be a number between 0x00 and 0xFF.
|
||||
@note This parameter is valid only for TIM1 and TIM8. */
|
||||
} TIM_TimeBaseInitTypeDef;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint16_t setcount;
|
||||
|
||||
} encoder;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint16_t TIM_OCMode; /*!< Specifies the TIM mode.
|
||||
This parameter can be a value of @ref TIM_Output_Compare_and_PWM_modes */
|
||||
|
||||
uint16_t TIM_OutputState; /*!< Specifies the TIM Output Compare state.
|
||||
This parameter can be a value of @ref TIM_Output_Compare_State */
|
||||
|
||||
uint16_t TIM_OutputNState; /*!< Specifies the TIM complementary Output Compare state.
|
||||
This parameter can be a value of @ref TIM_Output_Compare_N_State
|
||||
@note This parameter is valid only for TIM1 and TIM8. */
|
||||
|
||||
uint32_t TIM_Pulse; /*!< Specifies the pulse value to be loaded into the Capture Compare Register.
|
||||
This parameter can be a number between 0x0000 and 0xFFFF */
|
||||
|
||||
uint16_t TIM_OCPolarity; /*!< Specifies the output polarity.
|
||||
This parameter can be a value of @ref TIM_Output_Compare_Polarity */
|
||||
|
||||
uint16_t TIM_OCNPolarity; /*!< Specifies the complementary output polarity.
|
||||
This parameter can be a value of @ref TIM_Output_Compare_N_Polarity
|
||||
@note This parameter is valid only for TIM1 and TIM8. */
|
||||
|
||||
uint16_t TIM_OCIdleState; /*!< Specifies the TIM Output Compare pin state during Idle state.
|
||||
This parameter can be a value of @ref TIM_Output_Compare_Idle_State
|
||||
@note This parameter is valid only for TIM1 and TIM8. */
|
||||
|
||||
uint16_t TIM_OCNIdleState; /*!< Specifies the TIM Output Compare pin state during Idle state.
|
||||
This parameter can be a value of @ref TIM_Output_Compare_N_Idle_State
|
||||
@note This parameter is valid only for TIM1 and TIM8. */
|
||||
} TIM_OCInitTypeDef;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
||||
uint16_t TIM_Channel; /*!< Specifies the TIM channel.
|
||||
This parameter can be a value of @ref TIM_Channel */
|
||||
|
||||
uint16_t TIM_ICPolarity; /*!< Specifies the active edge of the input signal.
|
||||
This parameter can be a value of @ref TIM_Input_Capture_Polarity */
|
||||
|
||||
uint16_t TIM_ICSelection; /*!< Specifies the input.
|
||||
This parameter can be a value of @ref TIM_Input_Capture_Selection */
|
||||
|
||||
uint16_t TIM_ICPrescaler; /*!< Specifies the Input Capture Prescaler.
|
||||
This parameter can be a value of @ref TIM_Input_Capture_Prescaler */
|
||||
|
||||
uint16_t TIM_ICFilter; /*!< Specifies the input capture filter.
|
||||
This parameter can be a number between 0x0 and 0xF */
|
||||
} TIM_ICInitTypeDef;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
||||
uint16_t TIM_OSSRState; /*!< Specifies the Off-State selection used in Run mode.
|
||||
This parameter can be a value of @ref TIM_OSSR_Off_State_Selection_for_Run_mode_state */
|
||||
|
||||
uint16_t TIM_OSSIState; /*!< Specifies the Off-State used in Idle state.
|
||||
This parameter can be a value of @ref TIM_OSSI_Off_State_Selection_for_Idle_mode_state */
|
||||
|
||||
uint16_t TIM_LOCKLevel; /*!< Specifies the LOCK level parameters.
|
||||
This parameter can be a value of @ref TIM_Lock_level */
|
||||
|
||||
uint16_t TIM_DeadTime; /*!< Specifies the delay time between the switching-off and the
|
||||
switching-on of the outputs.
|
||||
This parameter can be a number between 0x00 and 0xFF */
|
||||
|
||||
uint16_t TIM_Break; /*!< Specifies whether the TIM Break input is enabled or not.
|
||||
This parameter can be a value of @ref TIM_Break_Input_enable_disable */
|
||||
|
||||
uint16_t TIM_BreakPolarity; /*!< Specifies the TIM Break Input pin polarity.
|
||||
This parameter can be a value of @ref TIM_Break_Polarity */
|
||||
|
||||
uint16_t TIM_AutomaticOutput; /*!< Specifies whether the TIM Automatic Output feature is enabled or not.
|
||||
This parameter can be a value of @ref TIM_AOE_Bit_Set_Reset */
|
||||
} TIM_BDTRInitTypeDef;
|
||||
|
||||
#define GPIO_PinSource0 ((uint8_t)0x00)
|
||||
#define GPIO_PinSource1 ((uint8_t)0x01)
|
||||
#define GPIO_PinSource2 ((uint8_t)0x02)
|
||||
#define GPIO_PinSource3 ((uint8_t)0x03)
|
||||
#define GPIO_PinSource4 ((uint8_t)0x04)
|
||||
#define GPIO_PinSource5 ((uint8_t)0x05)
|
||||
#define GPIO_PinSource6 ((uint8_t)0x06)
|
||||
#define GPIO_PinSource7 ((uint8_t)0x07)
|
||||
#define GPIO_PinSource8 ((uint8_t)0x08)
|
||||
#define GPIO_PinSource9 ((uint8_t)0x09)
|
||||
#define GPIO_PinSource10 ((uint8_t)0x0A)
|
||||
#define GPIO_PinSource11 ((uint8_t)0x0B)
|
||||
#define GPIO_PinSource12 ((uint8_t)0x0C)
|
||||
#define GPIO_PinSource13 ((uint8_t)0x0D)
|
||||
#define GPIO_PinSource14 ((uint8_t)0x0E)
|
||||
#define GPIO_PinSource15 ((uint8_t)0x0F)
|
||||
#define GPIO_AF_TIM8 ((uint8_t)0x03) /* TIM8 Alternate Function mapping */
|
||||
#define GPIO_AF_TIM3 ((uint8_t)0x02) /* TIM3 Alternate Function mapping */
|
||||
#define GPIO_AF_TIM4 ((uint8_t)0x02) /* TIM4 Alternate Function mapping */
|
||||
#define GPIO_AF_TIM5 ((uint8_t)0x02) /* TIM5 Alternate Function mapping */
|
||||
#define GPIO_AF_TIM1 ((uint8_t)0x01) /* TIM1 Alternate Function mapping */
|
||||
#define GPIO_AF_TIM2 ((uint8_t)0x01) /* TIM2 Alternate Function mapping */
|
||||
|
||||
// #define TIM4 ((TIM_TypeDef *)TIM4_BASE)
|
||||
// #define TIM8 ((TIM_TypeDef *)TIM8_BASE)
|
||||
#define TIM_EncoderMode_TI12 ((uint16_t)0x0003)
|
||||
#define TIM_ICPolarity_Rising ((uint16_t)0x0000)
|
||||
#define TIM_ICPolarity_Falling ((uint16_t)0x0002)
|
||||
// #define TIM_CR1_CEN ((uint16_t)0x0001) /*!<Counter enable */
|
||||
// #define TIM_CR1_CEN ((uint16_t)0x0001) /*!<Counter enable */
|
||||
|
||||
#define IS_TIM_ALL_PERIPH(PERIPH) (((PERIPH) == TIM1) || \
|
||||
((PERIPH) == TIM2) || \
|
||||
((PERIPH) == TIM3) || \
|
||||
((PERIPH) == TIM4) || \
|
||||
((PERIPH) == TIM5) || \
|
||||
((PERIPH) == TIM6) || \
|
||||
((PERIPH) == TIM7) || \
|
||||
((PERIPH) == TIM8) || \
|
||||
((PERIPH) == TIM9) || \
|
||||
((PERIPH) == TIM10) || \
|
||||
((PERIPH) == TIM11) || \
|
||||
((PERIPH) == TIM12) || \
|
||||
(((PERIPH) == TIM13) || \
|
||||
((PERIPH) == TIM14)))
|
||||
|
||||
#define IS_TIM_LIST1_PERIPH(PERIPH) (((PERIPH) == TIM1) || \
|
||||
((PERIPH) == TIM2) || \
|
||||
((PERIPH) == TIM3) || \
|
||||
((PERIPH) == TIM4) || \
|
||||
((PERIPH) == TIM5) || \
|
||||
((PERIPH) == TIM8) || \
|
||||
((PERIPH) == TIM9) || \
|
||||
((PERIPH) == TIM10) || \
|
||||
((PERIPH) == TIM11) || \
|
||||
((PERIPH) == TIM12) || \
|
||||
((PERIPH) == TIM13) || \
|
||||
((PERIPH) == TIM14))
|
||||
|
||||
#define IS_TIM_LIST2_PERIPH(PERIPH) (((PERIPH) == TIM1) || \
|
||||
((PERIPH) == TIM2) || \
|
||||
((PERIPH) == TIM3) || \
|
||||
((PERIPH) == TIM4) || \
|
||||
((PERIPH) == TIM5) || \
|
||||
((PERIPH) == TIM8) || \
|
||||
((PERIPH) == TIM9) || \
|
||||
((PERIPH) == TIM12))
|
||||
|
||||
#define IS_TIM_LIST3_PERIPH(PERIPH) (((PERIPH) == TIM1) || \
|
||||
((PERIPH) == TIM2) || \
|
||||
((PERIPH) == TIM3) || \
|
||||
((PERIPH) == TIM4) || \
|
||||
((PERIPH) == TIM5) || \
|
||||
((PERIPH) == TIM8))
|
||||
|
||||
#define IS_TIM_LIST4_PERIPH(PERIPH) (((PERIPH) == TIM1) || \
|
||||
((PERIPH) == TIM8))
|
||||
|
||||
#define IS_TIM_LIST5_PERIPH(PERIPH) (((PERIPH) == TIM1) || \
|
||||
((PERIPH) == TIM2) || \
|
||||
((PERIPH) == TIM3) || \
|
||||
((PERIPH) == TIM4) || \
|
||||
((PERIPH) == TIM5) || \
|
||||
((PERIPH) == TIM6) || \
|
||||
((PERIPH) == TIM7) || \
|
||||
((PERIPH) == TIM8))
|
||||
|
||||
#define IS_TIM_LIST6_PERIPH(TIMx) (((TIMx) == TIM2) || \
|
||||
((TIMx) == TIM5) || \
|
||||
((TIMx) == TIM11))
|
||||
|
||||
#define TIM_OCMode_Timing ((uint16_t)0x0000)
|
||||
#define TIM_OCMode_Active ((uint16_t)0x0010)
|
||||
#define TIM_OCMode_Inactive ((uint16_t)0x0020)
|
||||
#define TIM_OCMode_Toggle ((uint16_t)0x0030)
|
||||
#define TIM_OCMode_PWM1 ((uint16_t)0x0060)
|
||||
#define TIM_OCMode_PWM2 ((uint16_t)0x0070)
|
||||
//#define IS_TIM_OC_MODE(MODE) (((MODE) == TIM_OCMode_Timing) || \
|
||||
// ((MODE) == TIM_OCMode_Active) || \
|
||||
// ((MODE) == TIM_OCMode_Inactive) || \
|
||||
// ((MODE) == TIM_OCMode_Toggle)|| \
|
||||
// ((MODE) == TIM_OCMode_PWM1) || \
|
||||
// ((MODE) == TIM_OCMode_PWM2))
|
||||
#define IS_TIM_OCM(MODE) (((MODE) == TIM_OCMode_Timing) || \
|
||||
((MODE) == TIM_OCMode_Active) || \
|
||||
((MODE) == TIM_OCMode_Inactive) || \
|
||||
((MODE) == TIM_OCMode_Toggle) || \
|
||||
((MODE) == TIM_OCMode_PWM1) || \
|
||||
((MODE) == TIM_OCMode_PWM2) || \
|
||||
((MODE) == TIM_ForcedAction_Active) || \
|
||||
((MODE) == TIM_ForcedAction_InActive))
|
||||
|
||||
#define TIM_OPMode_Single ((uint16_t)0x0008)
|
||||
#define TIM_OPMode_Repetitive ((uint16_t)0x0000)
|
||||
//#define IS_TIM_OPM_MODE(MODE) (((MODE) == TIM_OPMode_Single) || \
|
||||
// ((MODE) == TIM_OPMode_Repetitive))
|
||||
|
||||
#define TIM_Channel_1 ((uint16_t)0x0000)
|
||||
#define TIM_Channel_2 ((uint16_t)0x0004)
|
||||
#define TIM_Channel_3 ((uint16_t)0x0008)
|
||||
#define TIM_Channel_4 ((uint16_t)0x000C)
|
||||
|
||||
#define IS_TIM_CHANNEL(CHANNEL) (((CHANNEL) == TIM_Channel_1) || \
|
||||
((CHANNEL) == TIM_Channel_2) || \
|
||||
((CHANNEL) == TIM_Channel_3) || \
|
||||
((CHANNEL) == TIM_Channel_4))
|
||||
|
||||
#define IS_TIM_PWMI_CHANNEL(CHANNEL) (((CHANNEL) == TIM_Channel_1) || \
|
||||
((CHANNEL) == TIM_Channel_2))
|
||||
#define IS_TIM_COMPLEMENTARY_CHANNEL(CHANNEL) (((CHANNEL) == TIM_Channel_1) || \
|
||||
((CHANNEL) == TIM_Channel_2) || \
|
||||
((CHANNEL) == TIM_Channel_3))
|
||||
|
||||
#define TIM_CKD_DIV1 ((uint16_t)0x0000)
|
||||
#define TIM_CKD_DIV2 ((uint16_t)0x0100)
|
||||
#define TIM_CKD_DIV4 ((uint16_t)0x0200)
|
||||
#define IS_TIM_CKD_DIV(DIV) (((DIV) == TIM_CKD_DIV1) || \
|
||||
((DIV) == TIM_CKD_DIV2) || \
|
||||
((DIV) == TIM_CKD_DIV4))
|
||||
|
||||
#define TIM_CounterMode_Up ((uint16_t)0x0000)
|
||||
#define TIM_CounterMode_Down ((uint16_t)0x0010)
|
||||
#define TIM_CounterMode_CenterAligned1 ((uint16_t)0x0020)
|
||||
#define TIM_CounterMode_CenterAligned2 ((uint16_t)0x0040)
|
||||
#define TIM_CounterMode_CenterAligned3 ((uint16_t)0x0060)
|
||||
//#define IS_TIM_COUNTER_MODE(MODE) (((MODE) == TIM_CounterMode_Up) || \
|
||||
// ((MODE) == TIM_CounterMode_Down) || \
|
||||
// ((MODE) == TIM_CounterMode_CenterAligned1) || \
|
||||
// ((MODE) == TIM_CounterMode_CenterAligned2) || \
|
||||
// ((MODE) == TIM_CounterMode_CenterAligned3))
|
||||
|
||||
#define TIM_OCPolarity_High ((uint16_t)0x0000)
|
||||
#define TIM_OCPolarity_Low ((uint16_t)0x0002)
|
||||
//#define IS_TIM_OC_POLARITY(POLARITY) (((POLARITY) == TIM_OCPolarity_High) || \
|
||||
// ((POLARITY) == TIM_OCPolarity_Low))
|
||||
|
||||
#define TIM_OCNPolarity_High ((uint16_t)0x0000)
|
||||
#define TIM_OCNPolarity_Low ((uint16_t)0x0008)
|
||||
//#define IS_TIM_OCN_POLARITY(POLARITY) (((POLARITY) == TIM_OCNPolarity_High) || \
|
||||
// ((POLARITY) == TIM_OCNPolarity_Low))
|
||||
|
||||
#define TIM_OutputState_Disable ((uint16_t)0x0000)
|
||||
#define TIM_OutputState_Enable ((uint16_t)0x0001)
|
||||
#define IS_TIM_OUTPUT_STATE(STATE) (((STATE) == TIM_OutputState_Disable) || \
|
||||
((STATE) == TIM_OutputState_Enable))
|
||||
|
||||
#define TIM_OutputNState_Disable ((uint16_t)0x0000)
|
||||
#define TIM_OutputNState_Enable ((uint16_t)0x0004)
|
||||
#define IS_TIM_OUTPUTN_STATE(STATE) (((STATE) == TIM_OutputNState_Disable) || \
|
||||
((STATE) == TIM_OutputNState_Enable))
|
||||
|
||||
#define TIM_CCx_Enable ((uint16_t)0x0001)
|
||||
#define TIM_CCx_Disable ((uint16_t)0x0000)
|
||||
#define IS_TIM_CCX(CCX) (((CCX) == TIM_CCx_Enable) || \
|
||||
((CCX) == TIM_CCx_Disable))
|
||||
|
||||
#define TIM_CCxN_Enable ((uint16_t)0x0004)
|
||||
#define TIM_CCxN_Disable ((uint16_t)0x0000)
|
||||
#define IS_TIM_CCXN(CCXN) (((CCXN) == TIM_CCxN_Enable) || \
|
||||
((CCXN) == TIM_CCxN_Disable))
|
||||
|
||||
#define TIM_Break_Enable ((uint16_t)0x1000)
|
||||
#define TIM_Break_Disable ((uint16_t)0x0000)
|
||||
//#define IS_TIM_BREAK_STATE(STATE) (((STATE) == TIM_Break_Enable) || \
|
||||
// ((STATE) == TIM_Break_Disable))
|
||||
|
||||
#define TIM_BreakPolarity_Low ((uint16_t)0x0000)
|
||||
#define TIM_BreakPolarity_High ((uint16_t)0x2000)
|
||||
//#define IS_TIM_BREAK_POLARITY(POLARITY) (((POLARITY) == TIM_BreakPolarity_Low) || \
|
||||
// ((POLARITY) == TIM_BreakPolarity_High))
|
||||
|
||||
#define TIM_AutomaticOutput_Enable ((uint16_t)0x4000)
|
||||
#define TIM_AutomaticOutput_Disable ((uint16_t)0x0000)
|
||||
//#define IS_TIM_AUTOMATIC_OUTPUT_STATE(STATE) (((STATE) == TIM_AutomaticOutput_Enable) || \
|
||||
// ((STATE) == TIM_AutomaticOutput_Disable))
|
||||
|
||||
#define TIM_LOCKLevel_OFF ((uint16_t)0x0000)
|
||||
#define TIM_LOCKLevel_1 ((uint16_t)0x0100)
|
||||
#define TIM_LOCKLevel_2 ((uint16_t)0x0200)
|
||||
#define TIM_LOCKLevel_3 ((uint16_t)0x0300)
|
||||
//#define IS_TIM_LOCK_LEVEL(LEVEL) (((LEVEL) == TIM_LOCKLevel_OFF) || \
|
||||
// ((LEVEL) == TIM_LOCKLevel_1) || \
|
||||
// ((LEVEL) == TIM_LOCKLevel_2) || \
|
||||
// ((LEVEL) == TIM_LOCKLevel_3))
|
||||
|
||||
#define TIM_OSSIState_Enable ((uint16_t)0x0400)
|
||||
#define TIM_OSSIState_Disable ((uint16_t)0x0000)
|
||||
//#define IS_TIM_OSSI_STATE(STATE) (((STATE) == TIM_OSSIState_Enable) || \
|
||||
// ((STATE) == TIM_OSSIState_Disable))
|
||||
|
||||
#define TIM_OSSRState_Enable ((uint16_t)0x0800)
|
||||
#define TIM_OSSRState_Disable ((uint16_t)0x0000)
|
||||
//#define IS_TIM_OSSR_STATE(STATE) (((STATE) == TIM_OSSRState_Enable) || \
|
||||
// ((STATE) == TIM_OSSRState_Disable))
|
||||
|
||||
#define TIM_OCIdleState_Set ((uint16_t)0x0100)
|
||||
#define TIM_OCIdleState_Reset ((uint16_t)0x0000)
|
||||
//#define IS_TIM_OCIDLE_STATE(STATE) (((STATE) == TIM_OCIdleState_Set) || \
|
||||
// ((STATE) == TIM_OCIdleState_Reset))
|
||||
//
|
||||
|
||||
#define TIM_OCNIdleState_Set ((uint16_t)0x0200)
|
||||
#define TIM_OCNIdleState_Reset ((uint16_t)0x0000)
|
||||
//#define IS_TIM_OCNIDLE_STATE(STATE) (((STATE) == TIM_OCNIdleState_Set) || \
|
||||
// ((STATE) == TIM_OCNIdleState_Reset))
|
||||
|
||||
#define TIM_ICPolarity_Rising ((uint16_t)0x0000)
|
||||
#define TIM_ICPolarity_Falling ((uint16_t)0x0002)
|
||||
#define TIM_ICPolarity_BothEdge ((uint16_t)0x000A)
|
||||
//#define IS_TIM_IC_POLARITY(POLARITY) (((POLARITY) == TIM_ICPolarity_Rising) || \
|
||||
// ((POLARITY) == TIM_ICPolarity_Falling)|| \
|
||||
// ((POLARITY) == TIM_ICPolarity_BothEdge))
|
||||
|
||||
#define TIM_ICSelection_DirectTI ((uint16_t)0x0001) /*!< TIM Input 1, 2, 3 or 4 is selected to be \
|
||||
connected to IC1, IC2, IC3 or IC4, respectively */
|
||||
#define TIM_ICSelection_IndirectTI ((uint16_t)0x0002) /*!< TIM Input 1, 2, 3 or 4 is selected to be \
|
||||
connected to IC2, IC1, IC4 or IC3, respectively. */
|
||||
#define TIM_ICSelection_TRC ((uint16_t)0x0003) /*!< TIM Input 1, 2, 3 or 4 is selected to be connected to TRC. */
|
||||
//#define IS_TIM_IC_SELECTION(SELECTION) (((SELECTION) == TIM_ICSelection_DirectTI) || \
|
||||
// ((SELECTION) == TIM_ICSelection_IndirectTI) || \
|
||||
// ((SELECTION) == TIM_ICSelection_TRC))
|
||||
|
||||
// #define TIM_ICPSC_DIV1 ((uint16_t)0x0000) /*!< Capture performed each time an edge is detected on the capture input. */
|
||||
// #define TIM_ICPSC_DIV2 ((uint16_t)0x0004) /*!< Capture performed once every 2 events. */
|
||||
// #define TIM_ICPSC_DIV4 ((uint16_t)0x0008) /*!< Capture performed once every 4 events. */
|
||||
// #define TIM_ICPSC_DIV8 ((uint16_t)0x000C) /*!< Capture performed once every 8 events. */
|
||||
// #define IS_TIM_IC_PRESCALER(PRESCALER) ( ((PRESCALER) == TIM_ICPSC_DIV1) || \
|
||||
// ((PRESCALER) == TIM_ICPSC_DIV2) || \
|
||||
// ((PRESCALER) == TIM_ICPSC_DIV4) || \
|
||||
// ((PRESCALER) == TIM_ICPSC_DIV8))
|
||||
|
||||
#define TIM_IT_Update ((uint16_t)0x0001)
|
||||
// #define TIM_IT_CC1 ((uint16_t)0x0002)
|
||||
// #define TIM_IT_CC2 ((uint16_t)0x0004)
|
||||
// #define TIM_IT_CC3 ((uint16_t)0x0008)
|
||||
// #define TIM_IT_CC4 ((uint16_t)0x0010)
|
||||
// #define TIM_IT_COM ((uint16_t)0x0020)
|
||||
#define TIM_IT_Trigger ((uint16_t)0x0040)
|
||||
#define TIM_IT_Break ((uint16_t)0x0080)
|
||||
#define IS_TIM_IT(IT) ((((IT) & (uint16_t)0xFF00) == 0x0000) && ((IT) != 0x0000))
|
||||
|
||||
#define IS_TIM_GET_IT(IT) (((IT) == TIM_IT_Update) || \
|
||||
((IT) == TIM_IT_CC1) || \
|
||||
((IT) == TIM_IT_CC2) || \
|
||||
((IT) == TIM_IT_CC3) || \
|
||||
((IT) == TIM_IT_CC4) || \
|
||||
((IT) == TIM_IT_COM) || \
|
||||
((IT) == TIM_IT_Trigger) || \
|
||||
((IT) == TIM_IT_Break))
|
||||
|
||||
// #define TIM_DMABase_CR1 ((uint16_t)0x0000)
|
||||
// #define TIM_DMABase_CR2 ((uint16_t)0x0001)
|
||||
// #define TIM_DMABase_SMCR ((uint16_t)0x0002)
|
||||
// #define TIM_DMABase_DIER ((uint16_t)0x0003)
|
||||
// #define TIM_DMABase_SR ((uint16_t)0x0004)
|
||||
// #define TIM_DMABase_EGR ((uint16_t)0x0005)
|
||||
// #define TIM_DMABase_CCMR1 ((uint16_t)0x0006)
|
||||
// #define TIM_DMABase_CCMR2 ((uint16_t)0x0007)
|
||||
// #define TIM_DMABase_CCER ((uint16_t)0x0008)
|
||||
// #define TIM_DMABase_CNT ((uint16_t)0x0009)
|
||||
// #define TIM_DMABase_PSC ((uint16_t)0x000A)
|
||||
// #define TIM_DMABase_ARR ((uint16_t)0x000B)
|
||||
// #define TIM_DMABase_RCR ((uint16_t)0x000C)
|
||||
// #define TIM_DMABase_CCR1 ((uint16_t)0x000D)
|
||||
// #define TIM_DMABase_CCR2 ((uint16_t)0x000E)
|
||||
// #define TIM_DMABase_CCR3 ((uint16_t)0x000F)
|
||||
// #define TIM_DMABase_CCR4 ((uint16_t)0x0010)
|
||||
// #define TIM_DMABase_BDTR ((uint16_t)0x0011)
|
||||
// #define TIM_DMABase_DCR ((uint16_t)0x0012)
|
||||
// #define TIM_DMABase_OR ((uint16_t)0x0013)
|
||||
// #define IS_TIM_DMA_BASE(BASE) ( ((BASE) == TIM_DMABase_CR1) || \
|
||||
// ((BASE) == TIM_DMABase_CR2) || \
|
||||
// ((BASE) == TIM_DMABase_SMCR) || \
|
||||
// ((BASE) == TIM_DMABase_DIER) || \
|
||||
// ((BASE) == TIM_DMABase_SR) || \
|
||||
// ((BASE) == TIM_DMABase_EGR) || \
|
||||
// ((BASE) == TIM_DMABase_CCMR1) || \
|
||||
// ((BASE) == TIM_DMABase_CCMR2) || \
|
||||
// ((BASE) == TIM_DMABase_CCER) || \
|
||||
// ((BASE) == TIM_DMABase_CNT) || \
|
||||
// ((BASE) == TIM_DMABase_PSC) || \
|
||||
// ((BASE) == TIM_DMABase_ARR) || \
|
||||
// ((BASE) == TIM_DMABase_RCR) || \
|
||||
// ((BASE) == TIM_DMABase_CCR1) || \
|
||||
// ((BASE) == TIM_DMABase_CCR2) || \
|
||||
// ((BASE) == TIM_DMABase_CCR3) || \
|
||||
// ((BASE) == TIM_DMABase_CCR4) || \
|
||||
// ((BASE) == TIM_DMABase_BDTR) || \
|
||||
// ((BASE) == TIM_DMABase_DCR) || \
|
||||
// ((BASE) == TIM_DMABase_OR))
|
||||
|
||||
// #define TIM_DMABurstLength_1Transfer ((uint16_t)0x0000)
|
||||
// #define TIM_DMABurstLength_2Transfers ((uint16_t)0x0100)
|
||||
// #define TIM_DMABurstLength_3Transfers ((uint16_t)0x0200)
|
||||
// #define TIM_DMABurstLength_4Transfers ((uint16_t)0x0300)
|
||||
// #define TIM_DMABurstLength_5Transfers ((uint16_t)0x0400)
|
||||
// #define TIM_DMABurstLength_6Transfers ((uint16_t)0x0500)
|
||||
// #define TIM_DMABurstLength_7Transfers ((uint16_t)0x0600)
|
||||
// #define TIM_DMABurstLength_8Transfers ((uint16_t)0x0700)
|
||||
// #define TIM_DMABurstLength_9Transfers ((uint16_t)0x0800)
|
||||
// #define TIM_DMABurstLength_10Transfers ((uint16_t)0x0900)
|
||||
// #define TIM_DMABurstLength_11Transfers ((uint16_t)0x0A00)
|
||||
// #define TIM_DMABurstLength_12Transfers ((uint16_t)0x0B00)
|
||||
// #define TIM_DMABurstLength_13Transfers ((uint16_t)0x0C00)
|
||||
// #define TIM_DMABurstLength_14Transfers ((uint16_t)0x0D00)
|
||||
// #define TIM_DMABurstLength_15Transfers ((uint16_t)0x0E00)
|
||||
// #define TIM_DMABurstLength_16Transfers ((uint16_t)0x0F00)
|
||||
// #define TIM_DMABurstLength_17Transfers ((uint16_t)0x1000)
|
||||
// #define TIM_DMABurstLength_18Transfers ((uint16_t)0x1100)
|
||||
// #define IS_TIM_DMA_LENGTH(LENGTH) ( ((LENGTH) == TIM_DMABurstLength_1Transfer) || \
|
||||
// ((LENGTH) == TIM_DMABurstLength_2Transfers) || \
|
||||
// ((LENGTH) == TIM_DMABurstLength_3Transfers) || \
|
||||
// ((LENGTH) == TIM_DMABurstLength_4Transfers) || \
|
||||
// ((LENGTH) == TIM_DMABurstLength_5Transfers) || \
|
||||
// ((LENGTH) == TIM_DMABurstLength_6Transfers) || \
|
||||
// ((LENGTH) == TIM_DMABurstLength_7Transfers) || \
|
||||
// ((LENGTH) == TIM_DMABurstLength_8Transfers) || \
|
||||
// ((LENGTH) == TIM_DMABurstLength_9Transfers) || \
|
||||
// ((LENGTH) == TIM_DMABurstLength_10Transfers) || \
|
||||
// ((LENGTH) == TIM_DMABurstLength_11Transfers) || \
|
||||
// ((LENGTH) == TIM_DMABurstLength_12Transfers) || \
|
||||
// ((LENGTH) == TIM_DMABurstLength_13Transfers) || \
|
||||
// ((LENGTH) == TIM_DMABurstLength_14Transfers) || \
|
||||
// ((LENGTH) == TIM_DMABurstLength_15Transfers) || \
|
||||
// ((LENGTH) == TIM_DMABurstLength_16Transfers) || \
|
||||
// ((LENGTH) == TIM_DMABurstLength_17Transfers) || \
|
||||
// ((LENGTH) == TIM_DMABurstLength_18Transfers))
|
||||
|
||||
// #define TIM_DMA_Update ((uint16_t)0x0100)
|
||||
// #define TIM_DMA_CC1 ((uint16_t)0x0200)
|
||||
// #define TIM_DMA_CC2 ((uint16_t)0x0400)
|
||||
// #define TIM_DMA_CC3 ((uint16_t)0x0800)
|
||||
// #define TIM_DMA_CC4 ((uint16_t)0x1000)
|
||||
// #define TIM_DMA_COM ((uint16_t)0x2000)
|
||||
// #define TIM_DMA_Trigger ((uint16_t)0x4000)
|
||||
// #define IS_TIM_DMA_SOURCE(SOURCE) ((((SOURCE) & (uint16_t)0x80FF) == 0x0000) && ((SOURCE) != 0x0000))
|
||||
|
||||
#define TIM_ExtTRGPSC_OFF ((uint16_t)0x0000)
|
||||
#define TIM_ExtTRGPSC_DIV2 ((uint16_t)0x1000)
|
||||
#define TIM_ExtTRGPSC_DIV4 ((uint16_t)0x2000)
|
||||
#define TIM_ExtTRGPSC_DIV8 ((uint16_t)0x3000)
|
||||
#define IS_TIM_EXT_PRESCALER(PRESCALER) (((PRESCALER) == TIM_ExtTRGPSC_OFF) || \
|
||||
((PRESCALER) == TIM_ExtTRGPSC_DIV2) || \
|
||||
((PRESCALER) == TIM_ExtTRGPSC_DIV4) || \
|
||||
((PRESCALER) == TIM_ExtTRGPSC_DIV8))
|
||||
|
||||
// #define TIM_TS_ITR0 ((uint16_t)0x0000)
|
||||
// #define TIM_TS_ITR1 ((uint16_t)0x0010)
|
||||
// #define TIM_TS_ITR2 ((uint16_t)0x0020)
|
||||
// #define TIM_TS_ITR3 ((uint16_t)0x0030)
|
||||
// #define TIM_TS_TI1F_ED ((uint16_t)0x0040)
|
||||
// #define TIM_TS_TI1FP1 ((uint16_t)0x0050)
|
||||
// #define TIM_TS_TI2FP2 ((uint16_t)0x0060)
|
||||
// #define TIM_TS_ETRF ((uint16_t)0x0070)
|
||||
// #def ine IS_TIM_TRIGGER_SELECTION(SELECTION) (((SELECTION) == TIM_TS_ITR0) || \
|
||||
// ((SELECTION) == TIM_TS_ITR1) || \
|
||||
// ((SELECTION) == TIM_TS_ITR2) || \
|
||||
// ((SELECTION) == TIM_TS_ITR3) || \
|
||||
// ((SELECTION) == TIM_TS_TI1F_ED) || \
|
||||
// ((SELECTION) == TIM_TS_TI1FP1) || \
|
||||
// ((SELECTION) == TIM_TS_TI2FP2) || \
|
||||
// ((SELECTION) == TIM_TS_ETRF))
|
||||
#define IS_TIM_INTERNAL_TRIGGER_SELECTION(SELECTION) (((SELECTION) == TIM_TS_ITR0) || \
|
||||
((SELECTION) == TIM_TS_ITR1) || \
|
||||
((SELECTION) == TIM_TS_ITR2) || \
|
||||
((SELECTION) == TIM_TS_ITR3))
|
||||
|
||||
#define TIM_TIxExternalCLK1Source_TI1 ((uint16_t)0x0050)
|
||||
#define TIM_TIxExternalCLK1Source_TI2 ((uint16_t)0x0060)
|
||||
#define TIM_TIxExternalCLK1Source_TI1ED ((uint16_t)0x0040)
|
||||
|
||||
#define TIM_ExtTRGPolarity_Inverted ((uint16_t)0x8000)
|
||||
#define TIM_ExtTRGPolarity_NonInverted ((uint16_t)0x0000)
|
||||
#define IS_TIM_EXT_POLARITY(POLARITY) (((POLARITY) == TIM_ExtTRGPolarity_Inverted) || \
|
||||
((POLARITY) == TIM_ExtTRGPolarity_NonInverted))
|
||||
|
||||
#define TIM_PSCReloadMode_Update ((uint16_t)0x0000)
|
||||
#define TIM_PSCReloadMode_Immediate ((uint16_t)0x0001)
|
||||
#define IS_TIM_PRESCALER_RELOAD(RELOAD) (((RELOAD) == TIM_PSCReloadMode_Update) || \
|
||||
((RELOAD) == TIM_PSCReloadMode_Immediate))
|
||||
|
||||
#define TIM_ForcedAction_Active ((uint16_t)0x0050)
|
||||
#define TIM_ForcedAction_InActive ((uint16_t)0x0040)
|
||||
#define IS_TIM_FORCED_ACTION(ACTION) (((ACTION) == TIM_ForcedAction_Active) || \
|
||||
((ACTION) == TIM_ForcedAction_InActive))
|
||||
|
||||
#define TIM_EncoderMode_TI1 ((uint16_t)0x0001)
|
||||
#define TIM_EncoderMode_TI2 ((uint16_t)0x0002)
|
||||
#define TIM_EncoderMode_TI12 ((uint16_t)0x0003)
|
||||
//#define IS_TIM_ENCODER_MODE(MODE) (((MODE) == TIM_EncoderMode_TI1) || \
|
||||
// ((MODE) == TIM_EncoderMode_TI2) || \
|
||||
// ((MODE) == TIM_EncoderMode_TI12))
|
||||
|
||||
// #define TIM_EventSource_Update ((uint16_t)0x0001)
|
||||
// #define TIM_EventSource_CC1 ((uint16_t)0x0002)
|
||||
// #define TIM_EventSource_CC2 ((uint16_t)0x0004)
|
||||
// #define TIM_EventSource_CC3 ((uint16_t)0x0008)
|
||||
// #define TIM_EventSource_CC4 ((uint16_t)0x0010)
|
||||
// #define TIM_EventSource_COM ((uint16_t)0x0020)
|
||||
// #define TIM_EventSource_Trigger ((uint16_t)0x0040)
|
||||
// #define TIM_EventSource_Break ((uint16_t)0x0080)
|
||||
// #define IS_TIM_EVENT_SOURCE(SOURCE) ((((SOURCE) & (uint16_t)0xFF00) == 0x0000) && ((SOURCE) != 0x0000))
|
||||
|
||||
#define TIM_UpdateSource_Global ((uint16_t)0x0000) /*!< Source of update is the counter overflow/underflow \
|
||||
or the setting of UG bit, or an update generation \
|
||||
through the slave mode controller. */
|
||||
#define TIM_UpdateSource_Regular ((uint16_t)0x0001) /*!< Source of update is counter overflow/underflow. */
|
||||
#define IS_TIM_UPDATE_SOURCE(SOURCE) (((SOURCE) == TIM_UpdateSource_Global) || \
|
||||
((SOURCE) == TIM_UpdateSource_Regular))
|
||||
|
||||
#define TIM_OCPreload_Enable ((uint16_t)0x0008)
|
||||
#define TIM_OCPreload_Disable ((uint16_t)0x0000)
|
||||
#define IS_TIM_OCPRELOAD_STATE(STATE) (((STATE) == TIM_OCPreload_Enable) || \
|
||||
((STATE) == TIM_OCPreload_Disable))
|
||||
|
||||
#define TIM_OCFast_Enable ((uint16_t)0x0004)
|
||||
#define TIM_OCFast_Disable ((uint16_t)0x0000)
|
||||
#define IS_TIM_OCFAST_STATE(STATE) (((STATE) == TIM_OCFast_Enable) || \
|
||||
((STATE) == TIM_OCFast_Disable))
|
||||
|
||||
#define TIM_OCClear_Enable ((uint16_t)0x0080)
|
||||
#define TIM_OCClear_Disable ((uint16_t)0x0000)
|
||||
#define IS_TIM_OCCLEAR_STATE(STATE) (((STATE) == TIM_OCClear_Enable) || \
|
||||
((STATE) == TIM_OCClear_Disable))
|
||||
|
||||
#define TIM_TRGOSource_Reset ((uint16_t)0x0000)
|
||||
#define TIM_TRGOSource_Enable ((uint16_t)0x0010)
|
||||
#define TIM_TRGOSource_Update ((uint16_t)0x0020)
|
||||
#define TIM_TRGOSource_OC1 ((uint16_t)0x0030)
|
||||
#define TIM_TRGOSource_OC1Ref ((uint16_t)0x0040)
|
||||
#define TIM_TRGOSource_OC2Ref ((uint16_t)0x0050)
|
||||
#define TIM_TRGOSource_OC3Ref ((uint16_t)0x0060)
|
||||
#define TIM_TRGOSource_OC4Ref ((uint16_t)0x0070)
|
||||
//#define IS_TIM_TRGO_SOURCE(SOURCE) (((SOURCE) == TIM_TRGOSource_Reset) || \
|
||||
// ((SOURCE) == TIM_TRGOSource_Enable) || \
|
||||
// ((SOURCE) == TIM_TRGOSource_Update) || \
|
||||
// ((SOURCE) == TIM_TRGOSource_OC1) || \
|
||||
// ((SOURCE) == TIM_TRGOSource_OC1Ref) || \
|
||||
// ((SOURCE) == TIM_TRGOSource_OC2Ref) || \
|
||||
// ((SOURCE) == TIM_TRGOSource_OC3Ref) || \
|
||||
// ((SOURCE) == TIM_TRGOSource_OC4Ref))
|
||||
|
||||
#define TIM_SlaveMode_Reset ((uint16_t)0x0004)
|
||||
#define TIM_SlaveMode_Gated ((uint16_t)0x0005)
|
||||
#define TIM_SlaveMode_Trigger ((uint16_t)0x0006)
|
||||
#define TIM_SlaveMode_External1 ((uint16_t)0x0007)
|
||||
//#define IS_TIM_SLAVE_MODE(MODE) (((MODE) == TIM_SlaveMode_Reset) || \
|
||||
// ((MODE) == TIM_SlaveMode_Gated) || \
|
||||
// ((MODE) == TIM_SlaveMode_Trigger) || \
|
||||
// ((MODE) == TIM_SlaveMode_External1))
|
||||
|
||||
#define TIM_MasterSlaveMode_Enable ((uint16_t)0x0080)
|
||||
#define TIM_MasterSlaveMode_Disable ((uint16_t)0x0000)
|
||||
//#define IS_TIM_MSM_STATE(STATE) (((STATE) == TIM_MasterSlaveMode_Enable) || \
|
||||
// ((STATE) == TIM_MasterSlaveMode_Disable))
|
||||
|
||||
#define TIM2_TIM8_TRGO ((uint16_t)0x0000)
|
||||
#define TIM2_ETH_PTP ((uint16_t)0x0400)
|
||||
#define TIM2_USBFS_SOF ((uint16_t)0x0800)
|
||||
#define TIM2_USBHS_SOF ((uint16_t)0x0C00)
|
||||
|
||||
#define TIM5_GPIO ((uint16_t)0x0000)
|
||||
#define TIM5_LSI ((uint16_t)0x0040)
|
||||
#define TIM5_LSE ((uint16_t)0x0080)
|
||||
#define TIM5_RTC ((uint16_t)0x00C0)
|
||||
|
||||
#define TIM11_GPIO ((uint16_t)0x0000)
|
||||
#define TIM11_HSE ((uint16_t)0x0002)
|
||||
|
||||
class Encoder
|
||||
{
|
||||
private:
|
||||
int _pin;
|
||||
|
||||
public:
|
||||
TIM_TypeDef *tim_base;
|
||||
Encoder();
|
||||
void SetCount(int64_t Counter);
|
||||
uint16_t GetCount();
|
||||
};
|
||||
|
||||
void encoder_config();
|
||||
void encoder2_config(); // Experimental
|
||||
void GpioConfigPortA(GPIO_TypeDef *GPIOx);
|
||||
void GpioConfigPortC(GPIO_TypeDef *GPIOx);
|
||||
void GpioConfigPortD(GPIO_TypeDef *GPIOx);
|
||||
void TIM_EncoderInterConfig(TIM_TypeDef *TIMx, uint16_t TIM_EncoderMode, uint16_t TIM_IC1Polarity, uint16_t TIM_IC2Polarity);
|
||||
void TIM_TimeBaseStructInit(TIM_TimeBaseInitTypeDef *TIM_TimeBaseInitStruct);
|
||||
void TIM_TimeBaseInit(TIM_TypeDef *TIMx, TIM_TimeBaseInitTypeDef *TIM_TimeBaseInitStruct);
|
||||
#endif
|
||||
14
Cards/EaserCAT-2000/Firmware/include/extend32to64.h
Executable file
14
Cards/EaserCAT-2000/Firmware/include/extend32to64.h
Executable file
@@ -0,0 +1,14 @@
|
||||
#ifndef EXTEND32TO64
|
||||
#define EXTEND32TO54
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
class extend32to64
|
||||
{
|
||||
public:
|
||||
int64_t previousTimeValue = 0;
|
||||
const uint64_t ONE_PERIOD = 4294967296; // almost UINT32_MAX;
|
||||
const uint64_t HALF_PERIOD = 2147483648; // Half of that
|
||||
int64_t extendTime(uint32_t in);
|
||||
};
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
|
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 48 KiB |
|
Before Width: | Height: | Size: 58 KiB After Width: | Height: | Size: 58 KiB |
42
Cards/EaserCAT-2000/Firmware/lib/soes/ecat_options.h
Executable file
42
Cards/EaserCAT-2000/Firmware/lib/soes/ecat_options.h
Executable file
@@ -0,0 +1,42 @@
|
||||
#ifndef __ECAT_OPTIONS_H__
|
||||
#define __ECAT_OPTIONS_H__
|
||||
|
||||
#define USE_FOE 0
|
||||
#define USE_EOE 0
|
||||
|
||||
#define MBXSIZE 512
|
||||
#define MBXSIZEBOOT 512
|
||||
#define MBXBUFFERS 3
|
||||
|
||||
#define MBX0_sma 0x1000
|
||||
#define MBX0_sml MBXSIZE
|
||||
#define MBX0_sme MBX0_sma+MBX0_sml-1
|
||||
#define MBX0_smc 0x26
|
||||
#define MBX1_sma MBX0_sma+MBX0_sml
|
||||
#define MBX1_sml MBXSIZE
|
||||
#define MBX1_sme MBX1_sma+MBX1_sml-1
|
||||
#define MBX1_smc 0x22
|
||||
|
||||
#define MBX0_sma_b 0x1000
|
||||
#define MBX0_sml_b MBXSIZEBOOT
|
||||
#define MBX0_sme_b MBX0_sma_b+MBX0_sml_b-1
|
||||
#define MBX0_smc_b 0x26
|
||||
#define MBX1_sma_b MBX0_sma_b+MBX0_sml_b
|
||||
#define MBX1_sml_b MBXSIZEBOOT
|
||||
#define MBX1_sme_b MBX1_sma_b+MBX1_sml_b-1
|
||||
#define MBX1_smc_b 0x22
|
||||
|
||||
#define SM2_sma 0x1600
|
||||
#define SM2_smc 0x24
|
||||
#define SM2_act 1
|
||||
#define SM3_sma 0x1A00
|
||||
#define SM3_smc 0x20
|
||||
#define SM3_act 1
|
||||
|
||||
#define MAX_MAPPINGS_SM2 5
|
||||
#define MAX_MAPPINGS_SM3 11
|
||||
|
||||
#define MAX_RXPDO_SIZE 512
|
||||
#define MAX_TXPDO_SIZE 512
|
||||
|
||||
#endif /* __ECAT_OPTIONS_H__ */
|
||||
386
Cards/EaserCAT-2000/Firmware/lib/soes/ecat_slv.c
Executable file
386
Cards/EaserCAT-2000/Firmware/lib/soes/ecat_slv.c
Executable file
@@ -0,0 +1,386 @@
|
||||
/*
|
||||
* Licensed under the GNU General Public License version 2 with exceptions. See
|
||||
* LICENSE file in the project root for full license information
|
||||
*/
|
||||
#include <stddef.h>
|
||||
#include "esc.h"
|
||||
#include "esc_coe.h"
|
||||
#include "esc_foe.h"
|
||||
#include "esc_eoe.h"
|
||||
#include "ecat_slv.h"
|
||||
|
||||
#define IS_RXPDO(index) ((index) >= 0x1600 && (index) < 0x1800)
|
||||
#define IS_TXPDO(index) ((index) >= 0x1A00 && (index) < 0x1C00)
|
||||
|
||||
/* Global variables used by the stack */
|
||||
uint8_t MBX[MBXBUFFERS * MAX(MBXSIZE, MBXSIZEBOOT)];
|
||||
_MBXcontrol MBXcontrol[MBXBUFFERS];
|
||||
_SMmap SMmap2[MAX_MAPPINGS_SM2];
|
||||
_SMmap SMmap3[MAX_MAPPINGS_SM3];
|
||||
_ESCvar ESCvar;
|
||||
|
||||
/* Private variables */
|
||||
static volatile int watchdog;
|
||||
|
||||
#if MAX_MAPPINGS_SM2 > 0
|
||||
static uint8_t rxpdo[MAX_RXPDO_SIZE] __attribute__((aligned(8)));
|
||||
#else
|
||||
extern uint8_t *rxpdo;
|
||||
#endif
|
||||
|
||||
#if MAX_MAPPINGS_SM3 > 0
|
||||
static uint8_t txpdo[MAX_TXPDO_SIZE] __attribute__((aligned(8)));
|
||||
#else
|
||||
extern uint8_t *txpdo;
|
||||
#endif
|
||||
|
||||
/** Function to pre-qualify the incoming SDO download.
|
||||
*
|
||||
* @param[in] index = index of SDO download request to check
|
||||
* @param[in] sub-index = sub-index of SDO download request to check
|
||||
* @return SDO abort code, or 0 on success
|
||||
*/
|
||||
uint32_t ESC_download_pre_objecthandler(uint16_t index,
|
||||
uint8_t subindex,
|
||||
void *data,
|
||||
size_t size,
|
||||
uint16_t flags)
|
||||
{
|
||||
if (IS_RXPDO(index) ||
|
||||
IS_TXPDO(index) ||
|
||||
index == RX_PDO_OBJIDX ||
|
||||
index == TX_PDO_OBJIDX)
|
||||
{
|
||||
uint8_t minSub = ((flags & COMPLETE_ACCESS_FLAG) == 0) ? 0 : 1;
|
||||
if (subindex > minSub && COE_maxSub(index) != 0)
|
||||
{
|
||||
return ABORT_SUBINDEX0_NOT_ZERO;
|
||||
}
|
||||
}
|
||||
|
||||
if (ESCvar.pre_object_download_hook)
|
||||
{
|
||||
return (ESCvar.pre_object_download_hook)(index,
|
||||
subindex,
|
||||
data,
|
||||
size,
|
||||
flags);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Hook called from the slave stack SDO Download handler to act on
|
||||
* user specified Index and Sub-index.
|
||||
*
|
||||
* @param[in] index = index of SDO download request to handle
|
||||
* @param[in] sub-index = sub-index of SDO download request to handle
|
||||
* @return SDO abort code, or 0 on success
|
||||
*/
|
||||
uint32_t ESC_download_post_objecthandler(uint16_t index, uint8_t subindex, uint16_t flags)
|
||||
{
|
||||
if (ESCvar.post_object_download_hook != NULL)
|
||||
{
|
||||
return (ESCvar.post_object_download_hook)(index, subindex, flags);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Function to pre-qualify the incoming SDO upload.
|
||||
*
|
||||
* @param[in] index = index of SDO upload request to handle
|
||||
* @param[in] sub-index = sub-index of SDO upload request to handle
|
||||
* @return SDO abort code, or 0 on success
|
||||
*/
|
||||
uint32_t ESC_upload_pre_objecthandler(uint16_t index,
|
||||
uint8_t subindex,
|
||||
void *data,
|
||||
size_t size,
|
||||
uint16_t flags)
|
||||
{
|
||||
if (ESCvar.pre_object_upload_hook != NULL)
|
||||
{
|
||||
return (ESCvar.pre_object_upload_hook)(index,
|
||||
subindex,
|
||||
data,
|
||||
size,
|
||||
flags);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Hook called from the slave stack SDO Upload handler to act on
|
||||
* user specified Index and Sub-index.
|
||||
*
|
||||
* @param[in] index = index of SDO upload request to handle
|
||||
* @param[in] sub-index = sub-index of SDO upload request to handle
|
||||
* @return SDO abort code, or 0 on success
|
||||
*/
|
||||
uint32_t ESC_upload_post_objecthandler(uint16_t index, uint8_t subindex, uint16_t flags)
|
||||
{
|
||||
if (ESCvar.post_object_upload_hook != NULL)
|
||||
{
|
||||
return (ESCvar.post_object_upload_hook)(index, subindex, flags);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Hook called from the slave stack ESC_stopoutputs to act on state changes
|
||||
* forcing us to stop outputs. Here we can set them to a safe state.
|
||||
*/
|
||||
void APP_safeoutput(void)
|
||||
{
|
||||
DPRINT("APP_safeoutput\n");
|
||||
|
||||
if (ESCvar.safeoutput_override != NULL)
|
||||
{
|
||||
(ESCvar.safeoutput_override)();
|
||||
}
|
||||
}
|
||||
|
||||
/** Write local process data to Sync Manager 3, Master Inputs.
|
||||
*/
|
||||
void TXPDO_update(void)
|
||||
{
|
||||
if (ESCvar.txpdo_override != NULL)
|
||||
{
|
||||
(ESCvar.txpdo_override)();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (MAX_MAPPINGS_SM3 > 0)
|
||||
{
|
||||
COE_pdoPack(txpdo, ESCvar.sm3mappings, SMmap3);
|
||||
}
|
||||
ESC_write(ESC_SM3_sma, txpdo, ESCvar.ESC_SM3_sml);
|
||||
}
|
||||
}
|
||||
|
||||
/** Read Sync Manager 2 to local process data, Master Outputs.
|
||||
*/
|
||||
void RXPDO_update(void)
|
||||
{
|
||||
if (ESCvar.rxpdo_override != NULL)
|
||||
{
|
||||
(ESCvar.rxpdo_override)();
|
||||
}
|
||||
else
|
||||
{
|
||||
ESC_read(ESC_SM2_sma, rxpdo, ESCvar.ESC_SM2_sml);
|
||||
if (MAX_MAPPINGS_SM2 > 0)
|
||||
{
|
||||
COE_pdoUnpack(rxpdo, ESCvar.sm2mappings, SMmap2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Set the watchdog count value, don't have any affect when using
|
||||
* HW watchdog 0x4xx
|
||||
*
|
||||
* @param[in] watchdogcnt = new watchdog count value
|
||||
*/
|
||||
void APP_setwatchdog(int watchdogcnt)
|
||||
{
|
||||
CC_ATOMIC_SET(ESCvar.watchdogcnt, watchdogcnt);
|
||||
}
|
||||
|
||||
/* Function to update local I/O, call read ethercat outputs, call
|
||||
* write ethercat inputs. Implement watch-dog counter to count-out if we have
|
||||
* made state change affecting the App.state.
|
||||
*/
|
||||
|
||||
void DIG_process(uint16_t ALEvent, uint8_t flags)
|
||||
{
|
||||
/* Handle watchdog */
|
||||
if ((flags & DIG_PROCESS_WD_FLAG) > 0)
|
||||
{
|
||||
if (CC_ATOMIC_GET(watchdog) > 0)
|
||||
{
|
||||
CC_ATOMIC_SUB(watchdog, 1);
|
||||
}
|
||||
|
||||
if ((CC_ATOMIC_GET(watchdog) <= 0) &&
|
||||
((CC_ATOMIC_GET(ESCvar.App.state) & APPSTATE_OUTPUT) > 0))
|
||||
{
|
||||
DPRINT("DIG_process watchdog expired\n");
|
||||
ESC_ALstatusgotoerror((ESCsafeop | ESCerror), ALERR_WATCHDOG);
|
||||
}
|
||||
else if (((CC_ATOMIC_GET(ESCvar.App.state) & APPSTATE_OUTPUT) == 0))
|
||||
{
|
||||
CC_ATOMIC_SET(watchdog, ESCvar.watchdogcnt);
|
||||
}
|
||||
}
|
||||
|
||||
/* Handle Outputs */
|
||||
if ((flags & DIG_PROCESS_OUTPUTS_FLAG) > 0)
|
||||
{
|
||||
if (((CC_ATOMIC_GET(ESCvar.App.state) & APPSTATE_OUTPUT) > 0) &&
|
||||
(ALEvent & ESCREG_ALEVENT_SM2))
|
||||
{
|
||||
RXPDO_update();
|
||||
CC_ATOMIC_SET(watchdog, ESCvar.watchdogcnt);
|
||||
/* Set outputs */
|
||||
cb_set_outputs();
|
||||
}
|
||||
else if (ALEvent & ESCREG_ALEVENT_SM2)
|
||||
{
|
||||
RXPDO_update();
|
||||
}
|
||||
}
|
||||
|
||||
/* Call application */
|
||||
if ((flags & DIG_PROCESS_APP_HOOK_FLAG) > 0)
|
||||
{
|
||||
/* Call application callback if set */
|
||||
if (ESCvar.application_hook != NULL)
|
||||
{
|
||||
(ESCvar.application_hook)();
|
||||
}
|
||||
}
|
||||
|
||||
/* Handle Inputs */
|
||||
if ((flags & DIG_PROCESS_INPUTS_FLAG) > 0)
|
||||
{
|
||||
if (CC_ATOMIC_GET(ESCvar.App.state) > 0)
|
||||
{
|
||||
/* Update inputs */
|
||||
cb_get_inputs();
|
||||
TXPDO_update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Handler for SM change, SM0/1, AL CONTROL and EEPROM events, the application
|
||||
* control what interrupts that should be served and re-activated with
|
||||
* event mask argument
|
||||
*/
|
||||
void ecat_slv_worker(uint32_t event_mask)
|
||||
{
|
||||
do
|
||||
{
|
||||
/* Check the state machine */
|
||||
ESC_state();
|
||||
/* Check the SM activation event */
|
||||
ESC_sm_act_event();
|
||||
|
||||
/* Check mailboxes */
|
||||
while ((ESC_mbxprocess() > 0) || (ESCvar.txcue > 0))
|
||||
{
|
||||
ESC_coeprocess();
|
||||
#if USE_FOE
|
||||
ESC_foeprocess();
|
||||
#endif
|
||||
#if USE_EOE
|
||||
ESC_eoeprocess();
|
||||
#endif
|
||||
ESC_xoeprocess();
|
||||
}
|
||||
#if USE_EOE
|
||||
ESC_eoeprocess_tx();
|
||||
#endif
|
||||
/* Call emulated eeprom handler if set */
|
||||
if (ESCvar.esc_hw_eep_handler != NULL)
|
||||
{
|
||||
(ESCvar.esc_hw_eep_handler)();
|
||||
}
|
||||
|
||||
CC_ATOMIC_SET(ESCvar.ALevent, ESC_ALeventread());
|
||||
|
||||
} while (ESCvar.ALevent & event_mask);
|
||||
|
||||
ESC_ALeventmaskwrite(ESC_ALeventmaskread() | event_mask);
|
||||
}
|
||||
|
||||
/*
|
||||
* Polling function. It should be called periodically for an application
|
||||
* when only SM2/DC interrupt is active.
|
||||
* Read and handle events for the EtherCAT state, status, mailbox and eeprom.
|
||||
*/
|
||||
void ecat_slv_poll(void)
|
||||
{
|
||||
/* Read local time from ESC*/
|
||||
ESC_read(ESCREG_LOCALTIME, (void *)&ESCvar.Time, sizeof(ESCvar.Time));
|
||||
ESCvar.Time = etohl(ESCvar.Time);
|
||||
|
||||
/* Check the state machine */
|
||||
ESC_state();
|
||||
/* Check the SM activation event */
|
||||
ESC_sm_act_event();
|
||||
|
||||
/* Check mailboxes */
|
||||
if (ESC_mbxprocess())
|
||||
{
|
||||
ESC_coeprocess();
|
||||
#if USE_FOE
|
||||
ESC_foeprocess();
|
||||
#endif
|
||||
#if USE_EOE
|
||||
ESC_eoeprocess();
|
||||
#endif
|
||||
ESC_xoeprocess();
|
||||
}
|
||||
#if USE_EOE
|
||||
ESC_eoeprocess_tx();
|
||||
#endif
|
||||
|
||||
/* Call emulated eeprom handler if set */
|
||||
if (ESCvar.esc_hw_eep_handler != NULL)
|
||||
{
|
||||
(ESCvar.esc_hw_eep_handler)();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Poll all events in a free-run application
|
||||
*/
|
||||
void ecat_slv(void)
|
||||
{
|
||||
ecat_slv_poll();
|
||||
DIG_process(ESC_ALeventread(), DIG_PROCESS_WD_FLAG | DIG_PROCESS_OUTPUTS_FLAG |
|
||||
DIG_PROCESS_APP_HOOK_FLAG | DIG_PROCESS_INPUTS_FLAG);
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize the slave stack.
|
||||
*/
|
||||
void ecat_slv_init(esc_cfg_t *config)
|
||||
{
|
||||
/* Init watchdog */
|
||||
watchdog = config->watchdog_cnt;
|
||||
|
||||
/* Call stack configuration */
|
||||
ESC_config(config);
|
||||
/* Call HW init */
|
||||
ESC_init(config);
|
||||
|
||||
/* wait until ESC is started up */
|
||||
while ((ESCvar.DLstatus & 0x0001) == 0)
|
||||
{
|
||||
ESC_read(ESCREG_DLSTATUS, (void *)&ESCvar.DLstatus,
|
||||
sizeof(ESCvar.DLstatus));
|
||||
ESCvar.DLstatus = etohs(ESCvar.DLstatus);
|
||||
}
|
||||
|
||||
#if USE_FOE
|
||||
/* Init FoE */
|
||||
FOE_init();
|
||||
#endif
|
||||
|
||||
#if USE_EOE
|
||||
/* Init EoE */
|
||||
EOE_init();
|
||||
#endif
|
||||
|
||||
/* reset ESC to init state */
|
||||
ESC_ALstatus(ESCinit);
|
||||
ESC_ALerror(ALERR_NONE);
|
||||
ESC_stopmbx();
|
||||
ESC_stopinput();
|
||||
ESC_stopoutput();
|
||||
/* Init Object Dictionary default values */
|
||||
COE_initDefaultValues();
|
||||
}
|
||||
69
Cards/EaserCAT-2000/Firmware/lib/soes/ecat_slv.h
Executable file
69
Cards/EaserCAT-2000/Firmware/lib/soes/ecat_slv.h
Executable file
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Licensed under the GNU General Public License version 2 with exceptions. See
|
||||
* LICENSE file in the project root for full license information
|
||||
*/
|
||||
|
||||
#ifndef __ECAT_SLV_H__
|
||||
#define __ECAT_SLV_H__
|
||||
|
||||
#include "ecat_options.h"
|
||||
#include "esc.h"
|
||||
|
||||
/**
|
||||
* This function is called when to get input values
|
||||
*/
|
||||
void cb_get_inputs();
|
||||
|
||||
/**
|
||||
* This function is called when to set outputs values
|
||||
*/
|
||||
void cb_set_outputs();
|
||||
|
||||
/** Set the watchdog count value
|
||||
*
|
||||
* @param[in] watchdogcnt = new watchdog count value
|
||||
*/
|
||||
void APP_setwatchdog(int watchdogcnt);
|
||||
|
||||
#define DIG_PROCESS_INPUTS_FLAG 0x01
|
||||
#define DIG_PROCESS_OUTPUTS_FLAG 0x02
|
||||
#define DIG_PROCESS_WD_FLAG 0x04
|
||||
#define DIG_PROCESS_APP_HOOK_FLAG 0x08
|
||||
/** Implements the watch-dog counter to count if we should make a state change
|
||||
* due to missing incoming SM2 events. Updates local I/O and run the application
|
||||
* in the following order, call read EtherCAT outputs, execute user provided
|
||||
* application hook and call write EtherCAT inputs.
|
||||
*
|
||||
* @param[in] flags = User input what to execute
|
||||
*/
|
||||
void DIG_process(uint16_t ALEvent, uint8_t flags);
|
||||
|
||||
/**
|
||||
* Handler for SM change, SM0/1, AL CONTROL and EEPROM events, the application
|
||||
* control what interrupts that should be served and re-activated with
|
||||
* event mask argument
|
||||
*
|
||||
* @param[in] event_mask = Event mask for interrupts to serve and re-activate
|
||||
* after served
|
||||
*/
|
||||
void ecat_slv_worker(uint32_t event_mask);
|
||||
|
||||
/**
|
||||
* Poll SM0/1, EEPROM and AL CONTROL events in a SM/DC synchronization
|
||||
* application
|
||||
*/
|
||||
void ecat_slv_poll(void);
|
||||
|
||||
/**
|
||||
* Poll all events in a free-run application
|
||||
*/
|
||||
void ecat_slv(void);
|
||||
|
||||
/**
|
||||
* Initialize the slave stack
|
||||
*
|
||||
* @param[in] config = User input how to configure the stack
|
||||
*/
|
||||
void ecat_slv_init(esc_cfg_t *config);
|
||||
|
||||
#endif /* __ECAT_SLV_H__ */
|
||||
@@ -57,7 +57,7 @@
|
||||
"pdo_mappings": [
|
||||
"txpdo"
|
||||
],
|
||||
"dtype": "REAL64",
|
||||
"dtype": "REAL32",
|
||||
"value": "0",
|
||||
"data": "&Obj.EncPos"
|
||||
},
|
||||
@@ -68,7 +68,7 @@
|
||||
"pdo_mappings": [
|
||||
"txpdo"
|
||||
],
|
||||
"dtype": "REAL64",
|
||||
"dtype": "REAL32",
|
||||
"value": "0",
|
||||
"data": "&Obj.EncFrequency"
|
||||
},
|
||||
@@ -79,7 +79,7 @@
|
||||
"pdo_mappings": [
|
||||
"txpdo"
|
||||
],
|
||||
"dtype": "UNSIGNED32",
|
||||
"dtype": "UNSIGNED16",
|
||||
"value": "0",
|
||||
"data": "&Obj.DiffT"
|
||||
},
|
||||
@@ -106,39 +106,74 @@
|
||||
"data": "&Obj.IndexStatus"
|
||||
},
|
||||
"6005": {
|
||||
"otype": "RECORD",
|
||||
"name": "StepGenOut1",
|
||||
"otype": "VAR",
|
||||
"name": "ActualPosition1",
|
||||
"access": "RO",
|
||||
"items": [
|
||||
{
|
||||
"name": "Max SubIndex"
|
||||
},
|
||||
{
|
||||
"name": "ActualPosition",
|
||||
"dtype": "REAL64",
|
||||
"data": "&Obj.StepGenOut1.ActualPosition",
|
||||
"value": "0",
|
||||
"access": "RO"
|
||||
}
|
||||
],
|
||||
"pdo_mappings": [
|
||||
"txpdo"
|
||||
]
|
||||
],
|
||||
"dtype": "REAL32",
|
||||
"value": "0",
|
||||
"data": "&Obj.ActualPosition1"
|
||||
},
|
||||
"6006": {
|
||||
"otype": "VAR",
|
||||
"name": "ActualPosition2",
|
||||
"access": "RO",
|
||||
"pdo_mappings": [
|
||||
"txpdo"
|
||||
],
|
||||
"dtype": "REAL32",
|
||||
"value": "0",
|
||||
"data": "&Obj.ActualPosition2"
|
||||
},
|
||||
"6007": {
|
||||
"otype": "VAR",
|
||||
"name": "D1",
|
||||
"access": "RO",
|
||||
"pdo_mappings": [
|
||||
"txpdo"
|
||||
],
|
||||
"dtype": "INTEGER16",
|
||||
"value": "0",
|
||||
"data": "&Obj.D1"
|
||||
},
|
||||
"6008": {
|
||||
"otype": "VAR",
|
||||
"name": "D2",
|
||||
"access": "RO",
|
||||
"pdo_mappings": [
|
||||
"txpdo"
|
||||
],
|
||||
"dtype": "INTEGER16",
|
||||
"value": "0",
|
||||
"data": "&Obj.D2"
|
||||
},
|
||||
"6009": {
|
||||
"otype": "VAR",
|
||||
"name": "D3",
|
||||
"access": "RO",
|
||||
"pdo_mappings": [
|
||||
"txpdo"
|
||||
],
|
||||
"dtype": "INTEGER16",
|
||||
"value": "0",
|
||||
"data": "&Obj.D3"
|
||||
},
|
||||
"600A": {
|
||||
"otype": "VAR",
|
||||
"name": "D4",
|
||||
"access": "RO",
|
||||
"pdo_mappings": [
|
||||
"txpdo"
|
||||
],
|
||||
"dtype": "INTEGER16",
|
||||
"value": "0",
|
||||
"data": "&Obj.D4"
|
||||
}
|
||||
},
|
||||
"rxpdo": {
|
||||
"7000": {
|
||||
"otype": "VAR",
|
||||
"name": "EncPosScale",
|
||||
"access": "RO",
|
||||
"pdo_mappings": [
|
||||
"rxpdo"
|
||||
],
|
||||
"dtype": "INTEGER32",
|
||||
"value": "0",
|
||||
"data": "&Obj.EncPosScale"
|
||||
},
|
||||
"7001": {
|
||||
"otype": "VAR",
|
||||
"name": "IndexLatchEnable",
|
||||
"access": "RO",
|
||||
@@ -149,32 +184,49 @@
|
||||
"value": "0",
|
||||
"data": "&Obj.IndexLatchEnable"
|
||||
},
|
||||
"7002": {
|
||||
"otype": "RECORD",
|
||||
"name": "StepGenIn1",
|
||||
"7001": {
|
||||
"otype": "VAR",
|
||||
"name": "CommandedPosition1",
|
||||
"access": "RO",
|
||||
"items": [
|
||||
{
|
||||
"name": "Max SubIndex"
|
||||
},
|
||||
{
|
||||
"name": "CommandedPosition",
|
||||
"dtype": "REAL64",
|
||||
"data": "&Obj.StepGenIn1.CommandedPosition",
|
||||
"value": "0",
|
||||
"access": "RO"
|
||||
},
|
||||
{
|
||||
"name": "CommandedVelocity",
|
||||
"dtype": "REAL64",
|
||||
"value": "0",
|
||||
"access": "RO",
|
||||
"data": "&Obj.StepGenIn1.CommandedVelocity"
|
||||
}
|
||||
],
|
||||
"pdo_mappings": [
|
||||
"rxpdo"
|
||||
]
|
||||
],
|
||||
"dtype": "REAL32",
|
||||
"value": "0",
|
||||
"data": "&Obj.CommandedPosition1"
|
||||
},
|
||||
"7002": {
|
||||
"otype": "VAR",
|
||||
"name": "CommandedPosition2",
|
||||
"access": "RO",
|
||||
"pdo_mappings": [
|
||||
"rxpdo"
|
||||
],
|
||||
"dtype": "REAL32",
|
||||
"value": "0",
|
||||
"data": "&Obj.CommandedPosition2"
|
||||
},
|
||||
"7003": {
|
||||
"otype": "VAR",
|
||||
"name": "StepsPerMM1",
|
||||
"access": "RO",
|
||||
"pdo_mappings": [
|
||||
"rxpdo"
|
||||
],
|
||||
"dtype": "INTEGER16",
|
||||
"value": "0",
|
||||
"data": "&Obj.StepsPerMM1"
|
||||
},
|
||||
"7004": {
|
||||
"otype": "VAR",
|
||||
"name": "StepsPerMM2",
|
||||
"access": "RO",
|
||||
"pdo_mappings": [
|
||||
"rxpdo"
|
||||
],
|
||||
"dtype": "INTEGER16",
|
||||
"value": "0",
|
||||
"data": "&Obj.StepsPerMM2"
|
||||
},
|
||||
"60664": {
|
||||
"otype": "VAR",
|
||||
351
Cards/EaserCAT-2000/Firmware/lib/soes/objectlist.c
Executable file
351
Cards/EaserCAT-2000/Firmware/lib/soes/objectlist.c
Executable file
@@ -0,0 +1,351 @@
|
||||
#include "esc_coe.h"
|
||||
#include "utypes.h"
|
||||
#include <stddef.h>
|
||||
|
||||
|
||||
static const char acName1000[] = "Device Type";
|
||||
static const char acName1008[] = "Device Name";
|
||||
static const char acName1009[] = "Hardware Version";
|
||||
static const char acName100A[] = "Software Version";
|
||||
static const char acName1018[] = "Identity Object";
|
||||
static const char acName1018_00[] = "Max SubIndex";
|
||||
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[] = "IndexLatchEnable";
|
||||
static const char acName1600_00[] = "Max SubIndex";
|
||||
static const char acName1600_01[] = "IndexLatchEnable";
|
||||
static const char acName1601[] = "CommandedPosition1";
|
||||
static const char acName1601_00[] = "Max SubIndex";
|
||||
static const char acName1601_01[] = "CommandedPosition1";
|
||||
static const char acName1602[] = "CommandedPosition2";
|
||||
static const char acName1602_00[] = "Max SubIndex";
|
||||
static const char acName1602_01[] = "CommandedPosition2";
|
||||
static const char acName1603[] = "StepsPerMM1";
|
||||
static const char acName1603_00[] = "Max SubIndex";
|
||||
static const char acName1603_01[] = "StepsPerMM1";
|
||||
static const char acName1604[] = "StepsPerMM2";
|
||||
static const char acName1604_00[] = "Max SubIndex";
|
||||
static const char acName1604_01[] = "StepsPerMM2";
|
||||
static const char acName1A00[] = "EncPos";
|
||||
static const char acName1A00_00[] = "Max SubIndex";
|
||||
static const char acName1A00_01[] = "EncPos";
|
||||
static const char acName1A01[] = "EncFrequency";
|
||||
static const char acName1A01_00[] = "Max SubIndex";
|
||||
static const char acName1A01_01[] = "EncFrequency";
|
||||
static const char acName1A02[] = "DiffT";
|
||||
static const char acName1A02_00[] = "Max SubIndex";
|
||||
static const char acName1A02_01[] = "DiffT";
|
||||
static const char acName1A03[] = "IndexByte";
|
||||
static const char acName1A03_00[] = "Max SubIndex";
|
||||
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[] = "ActualPosition1";
|
||||
static const char acName1A05_00[] = "Max SubIndex";
|
||||
static const char acName1A05_01[] = "ActualPosition1";
|
||||
static const char acName1A06[] = "ActualPosition2";
|
||||
static const char acName1A06_00[] = "Max SubIndex";
|
||||
static const char acName1A06_01[] = "ActualPosition2";
|
||||
static const char acName1A07[] = "D1";
|
||||
static const char acName1A07_00[] = "Max SubIndex";
|
||||
static const char acName1A07_01[] = "D1";
|
||||
static const char acName1A08[] = "D2";
|
||||
static const char acName1A08_00[] = "Max SubIndex";
|
||||
static const char acName1A08_01[] = "D2";
|
||||
static const char acName1A09[] = "D3";
|
||||
static const char acName1A09_00[] = "Max SubIndex";
|
||||
static const char acName1A09_01[] = "D3";
|
||||
static const char acName1A0A[] = "D4";
|
||||
static const char acName1A0A_00[] = "Max SubIndex";
|
||||
static const char acName1A0A_01[] = "D4";
|
||||
static const char acName1C00[] = "Sync Manager Communication Type";
|
||||
static const char acName1C00_00[] = "Max SubIndex";
|
||||
static const char acName1C00_01[] = "Communications Type SM0";
|
||||
static const char acName1C00_02[] = "Communications Type SM1";
|
||||
static const char acName1C00_03[] = "Communications Type SM2";
|
||||
static const char acName1C00_04[] = "Communications Type SM3";
|
||||
static const char acName1C12[] = "Sync Manager 2 PDO Assignment";
|
||||
static const char acName1C12_00[] = "Max SubIndex";
|
||||
static const char acName1C12_01[] = "PDO Mapping";
|
||||
static const char acName1C12_02[] = "PDO Mapping";
|
||||
static const char acName1C12_03[] = "PDO Mapping";
|
||||
static const char acName1C12_04[] = "PDO Mapping";
|
||||
static const char acName1C12_05[] = "PDO Mapping";
|
||||
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 acName1C13_04[] = "PDO Mapping";
|
||||
static const char acName1C13_05[] = "PDO Mapping";
|
||||
static const char acName1C13_06[] = "PDO Mapping";
|
||||
static const char acName1C13_07[] = "PDO Mapping";
|
||||
static const char acName1C13_08[] = "PDO Mapping";
|
||||
static const char acName1C13_09[] = "PDO Mapping";
|
||||
static const char acName1C13_10[] = "PDO Mapping";
|
||||
static const char acName1C13_11[] = "PDO Mapping";
|
||||
static const char acName6000[] = "EncPos";
|
||||
static const char acName6001[] = "EncFrequency";
|
||||
static const char acName6002[] = "DiffT";
|
||||
static const char acName6003[] = "IndexByte";
|
||||
static const char acName6004[] = "IndexStatus";
|
||||
static const char acName6005[] = "ActualPosition1";
|
||||
static const char acName6006[] = "ActualPosition2";
|
||||
static const char acName6007[] = "D1";
|
||||
static const char acName6008[] = "D2";
|
||||
static const char acName6009[] = "D3";
|
||||
static const char acName600A[] = "D4";
|
||||
static const char acName7000[] = "IndexLatchEnable";
|
||||
static const char acName7001[] = "CommandedPosition1";
|
||||
static const char acName7002[] = "CommandedPosition2";
|
||||
static const char acName7003[] = "StepsPerMM1";
|
||||
static const char acName7004[] = "StepsPerMM2";
|
||||
|
||||
const _objd SDO1000[] =
|
||||
{
|
||||
{0x0, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1000, 5001, NULL},
|
||||
};
|
||||
const _objd SDO1008[] =
|
||||
{
|
||||
{0x0, DTYPE_VISIBLE_STRING, 208, ATYPE_RO, acName1008, 0, "MetalMusings EaserCAT 2000"},
|
||||
};
|
||||
const _objd SDO1009[] =
|
||||
{
|
||||
{0x0, DTYPE_VISIBLE_STRING, 40, ATYPE_RO, acName1009, 0, "0.0.1"},
|
||||
};
|
||||
const _objd SDO100A[] =
|
||||
{
|
||||
{0x0, DTYPE_VISIBLE_STRING, 40, ATYPE_RO, acName100A, 0, "0.0.1"},
|
||||
};
|
||||
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},
|
||||
};
|
||||
const _objd SDO1600[] =
|
||||
{
|
||||
{0x00, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName1600_00, 1, NULL},
|
||||
{0x01, DTYPE_UNSIGNED32, 32, 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},
|
||||
};
|
||||
const _objd SDO1602[] =
|
||||
{
|
||||
{0x00, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName1602_00, 1, NULL},
|
||||
{0x01, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1602_01, 0x70020020, NULL},
|
||||
};
|
||||
const _objd SDO1603[] =
|
||||
{
|
||||
{0x00, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName1603_00, 1, NULL},
|
||||
{0x01, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1603_01, 0x70030010, NULL},
|
||||
};
|
||||
const _objd SDO1604[] =
|
||||
{
|
||||
{0x00, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName1604_00, 1, NULL},
|
||||
{0x01, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1604_01, 0x70040010, NULL},
|
||||
};
|
||||
const _objd SDO1A00[] =
|
||||
{
|
||||
{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, 0x60020010, NULL},
|
||||
};
|
||||
const _objd SDO1A03[] =
|
||||
{
|
||||
{0x00, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName1A03_00, 1, NULL},
|
||||
{0x01, DTYPE_UNSIGNED32, 32, 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},
|
||||
};
|
||||
const _objd SDO1A05[] =
|
||||
{
|
||||
{0x00, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName1A05_00, 1, NULL},
|
||||
{0x01, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1A05_01, 0x60050020, NULL},
|
||||
};
|
||||
const _objd SDO1A06[] =
|
||||
{
|
||||
{0x00, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName1A06_00, 1, NULL},
|
||||
{0x01, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1A06_01, 0x60060020, NULL},
|
||||
};
|
||||
const _objd SDO1A07[] =
|
||||
{
|
||||
{0x00, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName1A07_00, 1, NULL},
|
||||
{0x01, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1A07_01, 0x60070010, NULL},
|
||||
};
|
||||
const _objd SDO1A08[] =
|
||||
{
|
||||
{0x00, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName1A08_00, 1, NULL},
|
||||
{0x01, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1A08_01, 0x60080010, NULL},
|
||||
};
|
||||
const _objd SDO1A09[] =
|
||||
{
|
||||
{0x00, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName1A09_00, 1, NULL},
|
||||
{0x01, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1A09_01, 0x60090010, NULL},
|
||||
};
|
||||
const _objd SDO1A0A[] =
|
||||
{
|
||||
{0x00, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName1A0A_00, 1, NULL},
|
||||
{0x01, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1A0A_01, 0x600A0010, NULL},
|
||||
};
|
||||
const _objd SDO1C00[] =
|
||||
{
|
||||
{0x00, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName1C00_00, 4, NULL},
|
||||
{0x01, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName1C00_01, 1, NULL},
|
||||
{0x02, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName1C00_02, 2, NULL},
|
||||
{0x03, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName1C00_03, 3, NULL},
|
||||
{0x04, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName1C00_04, 4, NULL},
|
||||
};
|
||||
const _objd SDO1C12[] =
|
||||
{
|
||||
{0x00, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName1C12_00, 5, NULL},
|
||||
{0x01, DTYPE_UNSIGNED16, 16, ATYPE_RO, acName1C12_01, 0x1600, NULL},
|
||||
{0x02, DTYPE_UNSIGNED16, 16, ATYPE_RO, acName1C12_02, 0x1601, NULL},
|
||||
{0x03, DTYPE_UNSIGNED16, 16, ATYPE_RO, acName1C12_03, 0x1602, NULL},
|
||||
{0x04, DTYPE_UNSIGNED16, 16, ATYPE_RO, acName1C12_04, 0x1603, NULL},
|
||||
{0x05, DTYPE_UNSIGNED16, 16, ATYPE_RO, acName1C12_05, 0x1604, NULL},
|
||||
};
|
||||
const _objd SDO1C13[] =
|
||||
{
|
||||
{0x00, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName1C13_00, 11, 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},
|
||||
{0x04, DTYPE_UNSIGNED16, 16, ATYPE_RO, acName1C13_04, 0x1A03, NULL},
|
||||
{0x05, DTYPE_UNSIGNED16, 16, ATYPE_RO, acName1C13_05, 0x1A04, NULL},
|
||||
{0x06, DTYPE_UNSIGNED16, 16, ATYPE_RO, acName1C13_06, 0x1A05, NULL},
|
||||
{0x07, DTYPE_UNSIGNED16, 16, ATYPE_RO, acName1C13_07, 0x1A06, NULL},
|
||||
{0x08, DTYPE_UNSIGNED16, 16, ATYPE_RO, acName1C13_08, 0x1A07, NULL},
|
||||
{0x09, DTYPE_UNSIGNED16, 16, ATYPE_RO, acName1C13_09, 0x1A08, NULL},
|
||||
{0x0a, DTYPE_UNSIGNED16, 16, ATYPE_RO, acName1C13_10, 0x1A09, NULL},
|
||||
{0x0b, DTYPE_UNSIGNED16, 16, ATYPE_RO, acName1C13_11, 0x1A0A, NULL},
|
||||
};
|
||||
const _objd SDO6000[] =
|
||||
{
|
||||
{0x0, DTYPE_REAL32, 32, ATYPE_RO | ATYPE_TXPDO, acName6000, 0x00000000, &Obj.EncPos},
|
||||
};
|
||||
const _objd SDO6001[] =
|
||||
{
|
||||
{0x0, DTYPE_REAL32, 32, ATYPE_RO | ATYPE_TXPDO, acName6001, 0x00000000, &Obj.EncFrequency},
|
||||
};
|
||||
const _objd SDO6002[] =
|
||||
{
|
||||
{0x0, DTYPE_UNSIGNED16, 16, ATYPE_RO | ATYPE_TXPDO, acName6002, 0, &Obj.DiffT},
|
||||
};
|
||||
const _objd SDO6003[] =
|
||||
{
|
||||
{0x0, DTYPE_UNSIGNED32, 32, ATYPE_RO | ATYPE_TXPDO, acName6003, 0, &Obj.IndexByte},
|
||||
};
|
||||
const _objd SDO6004[] =
|
||||
{
|
||||
{0x0, DTYPE_UNSIGNED32, 32, ATYPE_RO | ATYPE_TXPDO, acName6004, 0, &Obj.IndexStatus},
|
||||
};
|
||||
const _objd SDO6005[] =
|
||||
{
|
||||
{0x0, DTYPE_REAL32, 32, ATYPE_RO | ATYPE_TXPDO, acName6005, 0x00000000, &Obj.ActualPosition1},
|
||||
};
|
||||
const _objd SDO6006[] =
|
||||
{
|
||||
{0x0, DTYPE_REAL32, 32, ATYPE_RO | ATYPE_TXPDO, acName6006, 0x00000000, &Obj.ActualPosition2},
|
||||
};
|
||||
const _objd SDO6007[] =
|
||||
{
|
||||
{0x0, DTYPE_INTEGER16, 16, ATYPE_RO | ATYPE_TXPDO, acName6007, 0, &Obj.D1},
|
||||
};
|
||||
const _objd SDO6008[] =
|
||||
{
|
||||
{0x0, DTYPE_INTEGER16, 16, ATYPE_RO | ATYPE_TXPDO, acName6008, 0, &Obj.D2},
|
||||
};
|
||||
const _objd SDO6009[] =
|
||||
{
|
||||
{0x0, DTYPE_INTEGER16, 16, ATYPE_RO | ATYPE_TXPDO, acName6009, 0, &Obj.D3},
|
||||
};
|
||||
const _objd SDO600A[] =
|
||||
{
|
||||
{0x0, DTYPE_INTEGER16, 16, ATYPE_RO | ATYPE_TXPDO, acName600A, 0, &Obj.D4},
|
||||
};
|
||||
const _objd SDO7000[] =
|
||||
{
|
||||
{0x0, DTYPE_UNSIGNED32, 32, ATYPE_RO | ATYPE_RXPDO, acName7000, 0, &Obj.IndexLatchEnable},
|
||||
};
|
||||
const _objd SDO7001[] =
|
||||
{
|
||||
{0x0, DTYPE_REAL32, 32, ATYPE_RO | ATYPE_RXPDO, acName7001, 0x00000000, &Obj.CommandedPosition1},
|
||||
};
|
||||
const _objd SDO7002[] =
|
||||
{
|
||||
{0x0, DTYPE_REAL32, 32, ATYPE_RO | ATYPE_RXPDO, acName7002, 0x00000000, &Obj.CommandedPosition2},
|
||||
};
|
||||
const _objd SDO7003[] =
|
||||
{
|
||||
{0x0, DTYPE_INTEGER16, 16, ATYPE_RO | ATYPE_RXPDO, acName7003, 0, &Obj.StepsPerMM1},
|
||||
};
|
||||
const _objd SDO7004[] =
|
||||
{
|
||||
{0x0, DTYPE_INTEGER16, 16, ATYPE_RO | ATYPE_RXPDO, acName7004, 0, &Obj.StepsPerMM2},
|
||||
};
|
||||
|
||||
const _objectlist SDOobjects[] =
|
||||
{
|
||||
{0x1000, OTYPE_VAR, 0, 0, acName1000, SDO1000},
|
||||
{0x1008, OTYPE_VAR, 0, 0, acName1008, SDO1008},
|
||||
{0x1009, OTYPE_VAR, 0, 0, acName1009, SDO1009},
|
||||
{0x100A, OTYPE_VAR, 0, 0, acName100A, SDO100A},
|
||||
{0x1018, OTYPE_RECORD, 4, 0, acName1018, SDO1018},
|
||||
{0x1600, OTYPE_RECORD, 1, 0, acName1600, SDO1600},
|
||||
{0x1601, OTYPE_RECORD, 1, 0, acName1601, SDO1601},
|
||||
{0x1602, OTYPE_RECORD, 1, 0, acName1602, SDO1602},
|
||||
{0x1603, OTYPE_RECORD, 1, 0, acName1603, SDO1603},
|
||||
{0x1604, OTYPE_RECORD, 1, 0, acName1604, SDO1604},
|
||||
{0x1A00, OTYPE_RECORD, 1, 0, acName1A00, SDO1A00},
|
||||
{0x1A01, OTYPE_RECORD, 1, 0, acName1A01, SDO1A01},
|
||||
{0x1A02, OTYPE_RECORD, 1, 0, acName1A02, SDO1A02},
|
||||
{0x1A03, OTYPE_RECORD, 1, 0, acName1A03, SDO1A03},
|
||||
{0x1A04, OTYPE_RECORD, 1, 0, acName1A04, SDO1A04},
|
||||
{0x1A05, OTYPE_RECORD, 1, 0, acName1A05, SDO1A05},
|
||||
{0x1A06, OTYPE_RECORD, 1, 0, acName1A06, SDO1A06},
|
||||
{0x1A07, OTYPE_RECORD, 1, 0, acName1A07, SDO1A07},
|
||||
{0x1A08, OTYPE_RECORD, 1, 0, acName1A08, SDO1A08},
|
||||
{0x1A09, OTYPE_RECORD, 1, 0, acName1A09, SDO1A09},
|
||||
{0x1A0A, OTYPE_RECORD, 1, 0, acName1A0A, SDO1A0A},
|
||||
{0x1C00, OTYPE_ARRAY, 4, 0, acName1C00, SDO1C00},
|
||||
{0x1C12, OTYPE_ARRAY, 5, 0, acName1C12, SDO1C12},
|
||||
{0x1C13, OTYPE_ARRAY, 11, 0, acName1C13, SDO1C13},
|
||||
{0x6000, OTYPE_VAR, 0, 0, acName6000, SDO6000},
|
||||
{0x6001, OTYPE_VAR, 0, 0, acName6001, SDO6001},
|
||||
{0x6002, OTYPE_VAR, 0, 0, acName6002, SDO6002},
|
||||
{0x6003, OTYPE_VAR, 0, 0, acName6003, SDO6003},
|
||||
{0x6004, OTYPE_VAR, 0, 0, acName6004, SDO6004},
|
||||
{0x6005, OTYPE_VAR, 0, 0, acName6005, SDO6005},
|
||||
{0x6006, OTYPE_VAR, 0, 0, acName6006, SDO6006},
|
||||
{0x6007, OTYPE_VAR, 0, 0, acName6007, SDO6007},
|
||||
{0x6008, OTYPE_VAR, 0, 0, acName6008, SDO6008},
|
||||
{0x6009, OTYPE_VAR, 0, 0, acName6009, SDO6009},
|
||||
{0x600A, OTYPE_VAR, 0, 0, acName600A, SDO600A},
|
||||
{0x7000, OTYPE_VAR, 0, 0, acName7000, SDO7000},
|
||||
{0x7001, OTYPE_VAR, 0, 0, acName7001, SDO7001},
|
||||
{0x7002, OTYPE_VAR, 0, 0, acName7002, SDO7002},
|
||||
{0x7003, OTYPE_VAR, 0, 0, acName7003, SDO7003},
|
||||
{0x7004, OTYPE_VAR, 0, 0, acName7004, SDO7004},
|
||||
{0xffff, 0xff, 0xff, 0xff, NULL, NULL}
|
||||
};
|
||||
@@ -13,25 +13,25 @@ typedef struct
|
||||
|
||||
/* Inputs */
|
||||
|
||||
double EncPos;
|
||||
double EncFrequency;
|
||||
uint32_t DiffT;
|
||||
float EncPos;
|
||||
float EncFrequency;
|
||||
uint16_t DiffT;
|
||||
uint32_t IndexByte;
|
||||
uint32_t IndexStatus;
|
||||
struct
|
||||
{
|
||||
double ActualPosition;
|
||||
} StepGenOut1;
|
||||
float ActualPosition1;
|
||||
float ActualPosition2;
|
||||
int16_t D1;
|
||||
int16_t D2;
|
||||
int16_t D3;
|
||||
int16_t D4;
|
||||
|
||||
/* Outputs */
|
||||
|
||||
int32_t EncPosScale;
|
||||
uint32_t IndexLatchEnable;
|
||||
struct
|
||||
{
|
||||
double CommandedPosition;
|
||||
double CommandedVelocity;
|
||||
} StepGenIn1;
|
||||
float CommandedPosition1;
|
||||
float CommandedPosition2;
|
||||
int16_t StepsPerMM1;
|
||||
int16_t StepsPerMM2;
|
||||
|
||||
} _Objects;
|
||||
|
||||
24
Cards/EaserCAT-2000/Firmware/platformio.ini
Executable file
24
Cards/EaserCAT-2000/Firmware/platformio.ini
Executable file
@@ -0,0 +1,24 @@
|
||||
; PlatformIO Project Configuration File
|
||||
;
|
||||
; Build options: build flags, source filter
|
||||
; Upload options: custom upload port, speed and extra flags
|
||||
; Library options: dependencies, extra library storages
|
||||
; Advanced options: extra scripting
|
||||
;
|
||||
; Please visit documentation for the other options and examples
|
||||
; https://docs.platformio.org/page/projectconf.html
|
||||
|
||||
[env:genericSTM32F407VGT6]
|
||||
framework = arduino
|
||||
platform = ststm32
|
||||
board = genericSTM32F407VGT6
|
||||
upload_protocol = stlink
|
||||
debug_tool = stlink
|
||||
debug_build_flags = -O0 -g -ggdb
|
||||
monitor_port = COM10
|
||||
monitor_filters = send_on_enter, time, colorize, log2file
|
||||
monitor_speed = 115200
|
||||
build_flags = -Wl,--no-warn-rwx-segment
|
||||
lib_deps =
|
||||
SPI
|
||||
rlogiacco/CircularBuffer
|
||||
99
Cards/EaserCAT-2000/Firmware/src/MyEncoder.cpp
Executable file
99
Cards/EaserCAT-2000/Firmware/src/MyEncoder.cpp
Executable file
@@ -0,0 +1,99 @@
|
||||
#include "MyENcoder.h"
|
||||
|
||||
MyEncoder::MyEncoder(TIM_TypeDef *_tim_base, uint8_t _indexPin, void irq(void))
|
||||
{
|
||||
tim_base = _tim_base;
|
||||
indexPin = _indexPin;
|
||||
attachInterrupt(digitalPinToInterrupt(indexPin), irq, RISING); // When Index triggered
|
||||
EncoderInit.SetCount(0);
|
||||
}
|
||||
|
||||
#define ONE_PERIOD 65536
|
||||
#define HALF_PERIOD 32768
|
||||
|
||||
int64_t MyEncoder::unwrapEncoder(uint16_t in)
|
||||
{
|
||||
int32_t c32 = (int32_t)in - HALF_PERIOD; // remove half period to determine (+/-) sign of the wrap
|
||||
int32_t dif = (c32 - previousEncoderCounterValue); // core concept: prev + (current - prev) = current
|
||||
|
||||
// wrap difference from -HALF_PERIOD to HALF_PERIOD. modulo prevents differences after the wrap from having an incorrect result
|
||||
int32_t mod_dif = ((dif + HALF_PERIOD) % ONE_PERIOD) - HALF_PERIOD;
|
||||
if (dif < -HALF_PERIOD)
|
||||
mod_dif += ONE_PERIOD; // account for mod of negative number behavior in C
|
||||
|
||||
int64_t unwrapped = previousEncoderCounterValue + mod_dif;
|
||||
previousEncoderCounterValue = unwrapped; // load previous value
|
||||
|
||||
return unwrapped + HALF_PERIOD; // remove the shift we applied at the beginning, and return
|
||||
}
|
||||
|
||||
void MyEncoder::indexPulse(void)
|
||||
{
|
||||
if (pleaseZeroTheCounter)
|
||||
{
|
||||
tim_base->CNT = 0;
|
||||
indexPulseFired = 1;
|
||||
Pos.clear();
|
||||
TDelta.clear();
|
||||
pleaseZeroTheCounter = 0;
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t MyEncoder::indexHappened()
|
||||
{
|
||||
if (indexPulseFired)
|
||||
{
|
||||
indexPulseFired = 0;
|
||||
previousEncoderCounterValue = 0;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
double MyEncoder::currentPos()
|
||||
{
|
||||
curPos = unwrapEncoder(tim_base->CNT) * PosScaleRes;
|
||||
return curPos;
|
||||
}
|
||||
|
||||
double MyEncoder::frequency(uint64_t time)
|
||||
{
|
||||
|
||||
double diffT = 0;
|
||||
double diffPos = 0;
|
||||
double frequency;
|
||||
TDelta.push(time); // Running average over the length of the circular buffer
|
||||
Pos.push(curPos);
|
||||
if (Pos.size() == RINGBUFFERLEN)
|
||||
{
|
||||
diffT = 1.0e-6 * (TDelta.last() - TDelta.first()); // Time is in microseconds
|
||||
diffPos = fabs(Pos.last() - Pos.first());
|
||||
frequency = diffPos / diffT;
|
||||
oldFrequency = frequency;
|
||||
return frequency; // Revolutions per second
|
||||
}
|
||||
else
|
||||
return oldFrequency;
|
||||
}
|
||||
uint8_t MyEncoder::getIndexState()
|
||||
{
|
||||
return digitalRead(indexPin);
|
||||
}
|
||||
|
||||
void MyEncoder::setScale(double scale)
|
||||
{
|
||||
if (CurPosScale != scale && scale != 0)
|
||||
{
|
||||
CurPosScale = scale;
|
||||
PosScaleRes = 1.0 / double(scale);
|
||||
}
|
||||
}
|
||||
|
||||
void MyEncoder::setLatch(uint8_t latchEnable)
|
||||
{
|
||||
if (latchEnable && !oldLatchCEnable) // Should only happen first time IndexCEnable is set
|
||||
{
|
||||
pleaseZeroTheCounter = 1;
|
||||
}
|
||||
oldLatchCEnable = latchEnable;
|
||||
}
|
||||
148
Cards/EaserCAT-2000/Firmware/src/StepGen.cpp
Executable file
148
Cards/EaserCAT-2000/Firmware/src/StepGen.cpp
Executable file
@@ -0,0 +1,148 @@
|
||||
#include <Arduino.h>
|
||||
#include <stdio.h>
|
||||
#include "StepGen.h"
|
||||
|
||||
StepGen::StepGen(TIM_TypeDef *Timer, uint32_t _timerChannel, PinName _stepPin, uint8_t _dirPin, void irq(void))
|
||||
{
|
||||
timerIsRunning = 0;
|
||||
timerStepPosition = 0;
|
||||
timerStepDirection = 0;
|
||||
timerStepPositionAtEnd = 0;
|
||||
timerNewEndStepPosition = 0;
|
||||
actualPosition = 0;
|
||||
requestedPosition = 0;
|
||||
stepsPerMM = 0;
|
||||
enabled = 0;
|
||||
|
||||
dirPin = _dirPin;
|
||||
stepPin = _stepPin;
|
||||
timerChan = _timerChannel;
|
||||
MyTim = new HardwareTimer(Timer);
|
||||
MyTim->attachInterrupt(irq);
|
||||
pinMode(dirPin, OUTPUT);
|
||||
}
|
||||
void StepGen::reqPos(double_t pos)
|
||||
{
|
||||
requestedPosition = pos;
|
||||
}
|
||||
double StepGen::reqPos()
|
||||
{
|
||||
return requestedPosition;
|
||||
}
|
||||
void StepGen::actPos(double pos)
|
||||
{
|
||||
actualPosition = pos;
|
||||
}
|
||||
double StepGen::actPos()
|
||||
{
|
||||
return actualPosition;
|
||||
}
|
||||
|
||||
void StepGen::enable(uint8_t yes)
|
||||
{
|
||||
enabled = yes;
|
||||
}
|
||||
|
||||
void StepGen::handleStepper(void)
|
||||
{
|
||||
if (!enabled)
|
||||
return;
|
||||
pwmCycleTime = StepGen::sync0CycleTime;
|
||||
|
||||
actPos(timerStepPosition / double(stepsPerMM));
|
||||
double diffPosition = reqPos() - actPos();
|
||||
#if 1
|
||||
// Wild "tone" kludge. map() function
|
||||
#define SPEED_MIN 0.00005
|
||||
#define SPEED_MAX 0.0005
|
||||
#define FACT_LOW 1.0
|
||||
#define FACT_HIGH 20.0
|
||||
if (abs(diffPosition) < SPEED_MIN) // 60 mm/min = 0.001 mm/ms
|
||||
{
|
||||
pwmCycleTime = FACT_LOW * StepGen::sync0CycleTime;
|
||||
}
|
||||
else if (abs(diffPosition) > SPEED_MAX) // 60 mm/min = 0.001 mm/ms
|
||||
{
|
||||
pwmCycleTime = FACT_HIGH * StepGen::sync0CycleTime;
|
||||
}
|
||||
else
|
||||
{
|
||||
pwmCycleTime = (FACT_LOW + (FACT_HIGH - FACT_LOW) * (abs(diffPosition) - SPEED_MIN) / (SPEED_MAX - SPEED_MIN)) * StepGen::sync0CycleTime;
|
||||
}
|
||||
#endif
|
||||
uint64_t fre = (abs(diffPosition) * stepsPerMM * 1000000) / pwmCycleTime; // Frequency needed
|
||||
if (fre > maxFreq) // Only do maxFre
|
||||
{
|
||||
double maxDist = (maxFreq * pwmCycleTime) / (stepsPerMM * 1000000.0) * (diffPosition > 0 ? 1 : -1);
|
||||
reqPos(actPos() + maxDist);
|
||||
}
|
||||
int32_t pulsesAtEndOfCycle = stepsPerMM * reqPos();
|
||||
|
||||
// Will be picked up by the timer_CB and the timer is reloaded, if it runs.
|
||||
timerNewEndStepPosition = pulsesAtEndOfCycle;
|
||||
|
||||
if (!timerIsRunning) // Timer isn't running. Start it here
|
||||
{
|
||||
int32_t steps = pulsesAtEndOfCycle - timerStepPosition; // Pulses to go + or -
|
||||
if (steps != 0)
|
||||
{
|
||||
if (steps > 0)
|
||||
{
|
||||
digitalWrite(dirPin, HIGH);
|
||||
timerStepDirection = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
digitalWrite(dirPin, LOW);
|
||||
timerStepDirection = -1;
|
||||
}
|
||||
timerStepPositionAtEnd = pulsesAtEndOfCycle; // Current Position
|
||||
float_t freqf = abs(steps) / (pwmCycleTime*1.0e-6);
|
||||
uint32_t freq = uint32_t(freqf);
|
||||
MyTim->setMode(timerChan, TIMER_OUTPUT_COMPARE_PWM2, stepPin);
|
||||
MyTim->setOverflow(freq, HERTZ_FORMAT);
|
||||
MyTim->setCaptureCompare(timerChan, 50, PERCENT_COMPARE_FORMAT); // 50 %
|
||||
timerIsRunning = 1;
|
||||
MyTim->resume();
|
||||
}
|
||||
}
|
||||
}
|
||||
void StepGen::timerCB()
|
||||
{
|
||||
timerStepPosition += timerStepDirection; // The step that was just completed
|
||||
if (timerNewEndStepPosition != 0) // Are we going to reload?
|
||||
{
|
||||
// Input for reload is timerNewEndStepPosition
|
||||
// The timer has current position and from this
|
||||
// can set new frequency and new endtarget for steps
|
||||
MyTim->pause(); // We are not at stop, let's stop it. Note stepPin is floating
|
||||
int32_t steps = timerNewEndStepPosition - timerStepPosition;
|
||||
if (steps != 0)
|
||||
{
|
||||
uint8_t sgn = steps > 0 ? HIGH : LOW;
|
||||
digitalWrite(dirPin, sgn);
|
||||
float_t freqf = abs(steps) / float(pwmCycleTime*1.0e-6);
|
||||
uint32_t freq = uint32_t(freqf);
|
||||
timerStepDirection = steps > 0 ? 1 : -1;
|
||||
timerStepPositionAtEnd = timerNewEndStepPosition;
|
||||
timerNewEndStepPosition = 0; // Set to zero to not reload next time
|
||||
MyTim->setMode(timerChan, TIMER_OUTPUT_COMPARE_PWM2, stepPin);
|
||||
MyTim->setOverflow(freq, HERTZ_FORMAT);
|
||||
MyTim->setCaptureCompare(timerChan, 50, PERCENT_COMPARE_FORMAT); // 50 %
|
||||
MyTim->resume();
|
||||
timerIsRunning = 1;
|
||||
}
|
||||
}
|
||||
if (timerStepPosition == timerStepPositionAtEnd) // Are we finished?
|
||||
{
|
||||
timerIsRunning = 0;
|
||||
MyTim->pause();
|
||||
}
|
||||
}
|
||||
|
||||
void StepGen::setScale(int16_t spm)
|
||||
{
|
||||
stepsPerMM = spm;
|
||||
}
|
||||
|
||||
uint32_t StepGen::sync0CycleTime = 0;
|
||||
124
Cards/EaserCAT-2000/Firmware/src/StepGen2.cpp
Executable file
124
Cards/EaserCAT-2000/Firmware/src/StepGen2.cpp
Executable file
@@ -0,0 +1,124 @@
|
||||
#include <Arduino.h>
|
||||
#include <stdio.h>
|
||||
#include "StepGen2.h"
|
||||
#include "extend32to64.h"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include "esc.h"
|
||||
}
|
||||
extern extend32to64 longTime;
|
||||
|
||||
StepGen2::StepGen2(TIM_TypeDef *Timer, uint32_t _timerChannel, PinName _stepPin, uint8_t _dirPin, void irq(void), TIM_TypeDef *Timer2, void irq2(void))
|
||||
{
|
||||
actualPosition = 0;
|
||||
commandedPosition = 0;
|
||||
commandedStepPosition = 0;
|
||||
initialPosition = 0;
|
||||
initialStepPosition = 0;
|
||||
stepsPerMM = 0;
|
||||
enabled = 0;
|
||||
|
||||
dirPin = _dirPin;
|
||||
dirPinName = digitalPinToPinName(dirPin);
|
||||
stepPin = _stepPin;
|
||||
pulseTimerChan = _timerChannel;
|
||||
pulseTimer = new HardwareTimer(Timer);
|
||||
pulseTimer->attachInterrupt(pulseTimerChan, irq); // Capture/compare innterrupt
|
||||
pinMode(dirPin, OUTPUT);
|
||||
startTimer = new HardwareTimer(Timer2);
|
||||
startTimer->attachInterrupt(irq2);
|
||||
}
|
||||
|
||||
uint32_t StepGen2::handleStepper(uint64_t irqTime, uint16_t nLoops)
|
||||
{
|
||||
frequency = 0;
|
||||
nSteps = 0;
|
||||
dbg = 0;
|
||||
if (!enabled) // Just .... don't
|
||||
return updatePos(0);
|
||||
|
||||
commandedStepPosition = floor(commandedPosition * stepsPerMM); // Scale position to steps
|
||||
nSteps = commandedStepPosition - initialStepPosition;
|
||||
if (nSteps == 0) // No movement
|
||||
{
|
||||
return updatePos(1);
|
||||
}
|
||||
lcncCycleTime = nLoops * StepGen2::sync0CycleTime * 1.0e-9; // nLoops is there in case we missed an ethercat cycle. secs
|
||||
|
||||
if (abs(nSteps) < 0) // Some small number
|
||||
{ //
|
||||
frequency = (abs(nSteps) + 1) / lcncCycleTime; // Distribute steps inside available time
|
||||
Tpulses = abs(nSteps) / frequency; //
|
||||
Tstartf = (lcncCycleTime - Tpulses) / 2.0; //
|
||||
} //
|
||||
else // Regular step train, up or down
|
||||
{ //
|
||||
float kTRAJ = (commandedPosition - initialPosition) / lcncCycleTime; // Straight line equation. position = kTRAJ x time + mTRAJ
|
||||
float mTRAJ = initialPosition; // Operating on incoming positions (not steps)
|
||||
if (kTRAJ > 0) //
|
||||
Tstartf = (float(initialStepPosition + 1) / float(stepsPerMM) - mTRAJ) / kTRAJ; // Crossing upwards
|
||||
else //
|
||||
Tstartf = (float(initialStepPosition) / float(stepsPerMM) - mTRAJ) / kTRAJ; // Crossing downwards
|
||||
frequency = fabs(kTRAJ * stepsPerMM); //
|
||||
Tpulses = abs(nSteps) / frequency;
|
||||
}
|
||||
updatePos(5);
|
||||
|
||||
uint32_t timeSinceISR = (longTime.extendTime(micros()) - irqTime); // Diff time from ISR (usecs)
|
||||
dbg = timeSinceISR; //
|
||||
Tstartu = Tjitter + uint32_t(Tstartf * 1e6) - timeSinceISR; // Have already wasted some time since the irq.
|
||||
|
||||
if (nSteps == 0) // Can do this much earlier, but want some calculated data for debugging
|
||||
return updatePos(1);
|
||||
|
||||
timerFrequency = uint32_t(ceil(frequency));
|
||||
startTimer->setOverflow(Tstartu, MICROSEC_FORMAT); // All handled by irqs
|
||||
startTimer->refresh();
|
||||
startTimer->resume();
|
||||
return 1;
|
||||
}
|
||||
|
||||
void StepGen2::startTimerCB()
|
||||
{
|
||||
startTimer->pause(); // Once is enough.
|
||||
digitalWriteFast(dirPinName, nSteps < 0 ? HIGH : LOW); // nSteps negative => decrease, HIGH
|
||||
// There will be a short break here for t2 usecs, in the future.
|
||||
|
||||
timerEndPosition += nSteps;
|
||||
pulseTimer->setMode(pulseTimerChan, TIMER_OUTPUT_COMPARE_PWM2, stepPin);
|
||||
pulseTimer->setOverflow(timerFrequency, HERTZ_FORMAT);
|
||||
// pulseTimer->setCaptureCompare(pulseTimerChan, 50, PERCENT_COMPARE_FORMAT);
|
||||
pulseTimer->setCaptureCompare(pulseTimerChan, t3, MICROSEC_COMPARE_FORMAT);
|
||||
pulseTimer->refresh();
|
||||
pulseTimer->resume();
|
||||
}
|
||||
|
||||
void StepGen2::pulseTimerCB()
|
||||
{
|
||||
int16_t dir = digitalReadFast(dirPinName); //
|
||||
if (dir == HIGH) // The step just taken
|
||||
timerPosition--;
|
||||
else
|
||||
timerPosition++;
|
||||
int32_t diffPosition = timerEndPosition - timerPosition; // Same "polarity" as nSteps
|
||||
if (diffPosition == 0)
|
||||
pulseTimer->pause();
|
||||
else
|
||||
{
|
||||
if (diffPosition < 0 && dir == LOW) // Change direction. Should not end up here, but alas
|
||||
digitalWriteFast(dirPinName, HIGH); // Normal is to be HIGH when decreasing
|
||||
if (diffPosition > 0 && dir == HIGH) // Change direction. Should not end up here, but alas
|
||||
digitalWriteFast(dirPinName, LOW); // Normal is to be LOW when increasing
|
||||
// Normally nothing is needed
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t StepGen2::updatePos(uint32_t i)
|
||||
{ //
|
||||
initialPosition = commandedPosition; // Save the numeric position for next step
|
||||
initialStepPosition = commandedStepPosition; // also the step we are at}
|
||||
return i;
|
||||
}
|
||||
|
||||
uint32_t StepGen2::sync0CycleTime = 0;
|
||||
1195
Cards/EaserCAT-2000/Firmware/src/StepGen3.cpp
Executable file
1195
Cards/EaserCAT-2000/Firmware/src/StepGen3.cpp
Executable file
File diff suppressed because it is too large
Load Diff
@@ -5,45 +5,21 @@
|
||||
Created on: Nov 20, 2020
|
||||
Author: GoktugH.
|
||||
*/
|
||||
|
||||
// TIM2, TIM3, TIM4, TIM8
|
||||
Encoder::Encoder()
|
||||
{
|
||||
int unit;
|
||||
}
|
||||
|
||||
void Encoder::eattach(int enco)
|
||||
// void Encoder::SetCount(enum EncTimer enc, int64_t Counter)
|
||||
void Encoder::SetCount(int64_t Counter)
|
||||
{
|
||||
tim_base->CNT = Counter;
|
||||
}
|
||||
|
||||
void Encoder::attachh(int encoNumber)
|
||||
// uint16_t Encoder::GetCount(enum EncTimer enc)
|
||||
uint16_t Encoder::GetCount()
|
||||
{
|
||||
eattach(encoNumber);
|
||||
}
|
||||
|
||||
void Encoder::SetCount(enum EncTimer enc, int64_t Counter)
|
||||
{
|
||||
|
||||
if (enc == Tim2)
|
||||
TIM2->CNT = Counter;
|
||||
else if (enc == Tim3)
|
||||
TIM3->CNT = Counter;
|
||||
else if (enc == Tim4)
|
||||
TIM4->CNT = Counter;
|
||||
else if (enc == Tim8)
|
||||
TIM8->CNT = Counter;
|
||||
}
|
||||
uint16_t Encoder::GetCount(enum EncTimer enc)
|
||||
{
|
||||
|
||||
if (enc == Tim2)
|
||||
c = (TIM2->CNT);
|
||||
else if (enc == Tim3)
|
||||
c = (TIM3->CNT);
|
||||
else if (enc == Tim4)
|
||||
c = (TIM4->CNT);
|
||||
else if (enc == Tim8)
|
||||
c = (TIM8->CNT);
|
||||
return c;
|
||||
return tim_base->CNT;
|
||||
}
|
||||
|
||||
void GpioConfigPortA(GPIO_TypeDef *GPIOx)
|
||||
@@ -287,7 +263,7 @@ void GPIO_PinAF(GPIO_TypeDef *GPIOx, uint16_t GPIO_PinSource, uint8_t GPIO_AF)
|
||||
GPIOx->AFR[GPIO_PinSource >> 0x03] = temp_2;
|
||||
}
|
||||
|
||||
void rcc_config()
|
||||
void encoder_config()
|
||||
{
|
||||
RCC->AHB1ENR |= 0x1; // GPIOA
|
||||
RCC->AHB1ENR |= 0x4; // GPIOC
|
||||
@@ -295,27 +271,27 @@ void rcc_config()
|
||||
RCC->AHB1ENR |= 0x10; // GPIOE
|
||||
|
||||
RCC->APB1ENR |= 0x20000000; // ENABLE DAC
|
||||
RCC->APB2ENR |= 0x00000002; // APB2 TIM8
|
||||
// RCC->APB2ENR |= 0x00000002; // APB2 TIM8
|
||||
RCC->APB1ENR |= 0x00000004; // APB1 TIM4
|
||||
RCC->APB1ENR |= 0x00000001; // APB1 TIM2
|
||||
RCC->APB1ENR |= 0x00000002; // APB1 TIM3
|
||||
// RCC->APB1ENR |= 0x00000002; // APB1 TIM3
|
||||
|
||||
GpioConfigPortA(GPIOA);
|
||||
GpioConfigPortC(GPIOC);
|
||||
// GpioConfigPortC(GPIOC);
|
||||
GpioConfigPortD(GPIOD);
|
||||
|
||||
#if 0 // Skipping since TIM8 is step generator and TIM3, chan4 is smae as TIM8, chan4
|
||||
GPIO_PinAF(GPIOA, GPIO_PinSource6, GPIO_AF_TIM3);
|
||||
GPIO_PinAF(GPIOA, GPIO_PinSource7, GPIO_AF_TIM3);
|
||||
|
||||
|
||||
GPIO_PinAF(GPIOC, GPIO_PinSource6, GPIO_AF_TIM8);
|
||||
GPIO_PinAF(GPIOC, GPIO_PinSource7, GPIO_AF_TIM8);
|
||||
|
||||
#endif
|
||||
GPIO_PinAF(GPIOD, GPIO_PinSource12, GPIO_AF_TIM4);
|
||||
GPIO_PinAF(GPIOD, GPIO_PinSource13, GPIO_AF_TIM4);
|
||||
|
||||
GPIO_PinAF(GPIOA, GPIO_PinSource0, GPIO_AF_TIM2);
|
||||
GPIO_PinAF(GPIOA, GPIO_PinSource1, GPIO_AF_TIM2);
|
||||
|
||||
#if 0 // Skipping since I use TIM8 as stepper generator
|
||||
TIM_EncoderInterConfig(TIM8, TIM_EncoderMode_TI12, TIM_ICPolarity_Rising, TIM_ICPolarity_Falling);
|
||||
TIMER_InitStructure.TIM_Period = 65535;
|
||||
TIMER_InitStructure.TIM_CounterMode = TIM_CounterMode_Up | TIM_CounterMode_Down;
|
||||
@@ -323,7 +299,7 @@ void rcc_config()
|
||||
TIM_TimeBaseStructInit(&TIMER_InitStructure);
|
||||
TIM_Cmd(TIM8, ENABLE);
|
||||
TIM8->CNT = 0;
|
||||
|
||||
#endif
|
||||
TIM_EncoderInterConfig(TIM4, TIM_EncoderMode_TI12, TIM_ICPolarity_Rising, TIM_ICPolarity_Falling);
|
||||
TIMER_InitStructureE.TIM_Period = 65535;
|
||||
TIMER_InitStructureE.TIM_CounterMode = TIM_CounterMode_Up | TIM_CounterMode_Down;
|
||||
@@ -340,7 +316,7 @@ void rcc_config()
|
||||
TIM_Cmd(TIM2, ENABLE);
|
||||
|
||||
TIM2->CNT = 0;
|
||||
|
||||
#if 0
|
||||
TIM_EncoderInterConfig(TIM3, TIM_EncoderMode_TI12, TIM_ICPolarity_Rising, TIM_ICPolarity_Falling);
|
||||
TIMER_InitStructureEEG.TIM_Period = 65535;
|
||||
TIMER_InitStructureEEG.TIM_CounterMode = TIM_CounterMode_Up | TIM_CounterMode_Down;
|
||||
@@ -349,4 +325,67 @@ void rcc_config()
|
||||
TIM_Cmd(TIM3, ENABLE);
|
||||
|
||||
TIM3->CNT = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
void encoder2_config()
|
||||
{
|
||||
#if 0
|
||||
#include "mbed.h"
|
||||
#include "stm32f4xx.h"
|
||||
#include "stm32f4xx_hal_tim_ex.h"
|
||||
|
||||
TIM_HandleTypeDef timer;
|
||||
TIM_Encoder_InitTypeDef encoder;
|
||||
|
||||
// direction to PA_9 -- step pulse to PA_8
|
||||
|
||||
int main()
|
||||
{
|
||||
|
||||
GPIO_InitTypeDef GPIO_InitStruct;
|
||||
__TIM1_CLK_ENABLE();
|
||||
__GPIOA_CLK_ENABLE();
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_8 | GPIO_PIN_9;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_PULLDOWN;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
|
||||
GPIO_InitStruct.Alternate = GPIO_AF1_TIM1;
|
||||
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||
|
||||
timer.Instance = TIM1;
|
||||
timer.Init.Period = 0xffff;
|
||||
timer.Init.Prescaler = 0;
|
||||
timer.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
|
||||
timer.Init.CounterMode = TIM_COUNTERMODE_UP;
|
||||
|
||||
encoder.EncoderMode = TIM_ENCODERMODE_TI12;
|
||||
encoder.IC1Filter = 0x0f;
|
||||
encoder.IC1Polarity = TIM_INPUTCHANNELPOLARITY_RISING;
|
||||
encoder.IC1Prescaler = TIM_ICPSC_DIV4;
|
||||
encoder.IC1Selection = TIM_ICSELECTION_DIRECTTI;
|
||||
|
||||
encoder.IC2Filter = 0x0f;
|
||||
encoder.IC2Polarity = TIM_INPUTCHANNELPOLARITY_FALLING;
|
||||
encoder.IC2Prescaler = TIM_ICPSC_DIV4;
|
||||
encoder.IC2Selection = TIM_ICSELECTION_DIRECTTI;
|
||||
|
||||
HAL_TIM_Encoder_Init(&timer, &encoder);
|
||||
HAL_TIM_Encoder_Start(&timer,TIM_CHANNEL_1);
|
||||
|
||||
|
||||
TIM1->EGR = 1; // Generate an update event
|
||||
TIM1->CR1 = 1; // Enable the counter
|
||||
|
||||
|
||||
while (1) {
|
||||
int16_t count1;
|
||||
count1=TIM1->CNT;
|
||||
|
||||
printf("%d\r\n", count1);
|
||||
wait(1.0);
|
||||
|
||||
};
|
||||
}
|
||||
#endif
|
||||
}
|
||||
18
Cards/EaserCAT-2000/Firmware/src/extend32to64.cpp
Executable file
18
Cards/EaserCAT-2000/Firmware/src/extend32to64.cpp
Executable file
@@ -0,0 +1,18 @@
|
||||
#include "extend32to64.h"
|
||||
|
||||
// Extend from 32-bit to 64-bit precision
|
||||
int64_t extend32to64::extendTime(uint32_t in)
|
||||
{
|
||||
int64_t c64 = (int64_t)in - HALF_PERIOD; // remove half period to determine (+/-) sign of the wrap
|
||||
int64_t dif = (c64 - previousTimeValue); // core concept: prev + (current - prev) = current
|
||||
|
||||
// wrap difference from -HALF_PERIOD to HALF_PERIOD. modulo prevents differences after the wrap from having an incorrect result
|
||||
int64_t mod_dif = ((dif + HALF_PERIOD) % ONE_PERIOD) - HALF_PERIOD;
|
||||
if (dif < int64_t(-HALF_PERIOD))
|
||||
mod_dif += ONE_PERIOD; // account for mod of negative number behavior in C
|
||||
|
||||
int64_t unwrapped = previousTimeValue + mod_dif;
|
||||
previousTimeValue = unwrapped; // load previous value
|
||||
|
||||
return unwrapped + HALF_PERIOD; // remove the shift we applied at the beginning, and return
|
||||
}
|
||||
355
Cards/EaserCAT-2000/Firmware/src/main.cpp
Executable file
355
Cards/EaserCAT-2000/Firmware/src/main.cpp
Executable file
@@ -0,0 +1,355 @@
|
||||
#include <Arduino.h>
|
||||
#include <stdio.h>
|
||||
extern "C"
|
||||
{
|
||||
#include "ecat_slv.h"
|
||||
#include "utypes.h"
|
||||
};
|
||||
_Objects Obj;
|
||||
|
||||
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"
|
||||
uint32_t sync0CycleTime; // nanosecs, often 1000000 ( 1 ms )
|
||||
|
||||
#include "MyEncoder.h"
|
||||
volatile uint16_t encCnt = 0;
|
||||
void indexPulseEncoderCB1(void);
|
||||
MyEncoder Encoder1(TIM2, PA2, indexPulseEncoderCB1);
|
||||
void indexPulseEncoderCB1(void)
|
||||
{
|
||||
encCnt++;
|
||||
Encoder1.indexPulse();
|
||||
}
|
||||
// #include <RunningAverage.h>
|
||||
// RunningAverage irqServeDelays(1000); // To get the max delay of the irq serve time over the last second
|
||||
CircularBuffer<uint16_t, 1000> irqServeDelays;
|
||||
|
||||
#include "StepGen3.h"
|
||||
StepGen3 *Step = 0;
|
||||
|
||||
#include "extend32to64.h"
|
||||
|
||||
volatile uint64_t irqTime = 0, irqCnt = 0;
|
||||
extend32to64 longTime;
|
||||
|
||||
void setFrequencyAdjustedMicrosSeconds(HardwareTimer *timer, uint32_t usecs);
|
||||
|
||||
void cb_set_outputs(void) // Master outputs gets here, slave inputs, first operation
|
||||
{
|
||||
Encoder1.setLatch(Obj.IndexLatchEnable);
|
||||
Encoder1.setScale(2000);
|
||||
}
|
||||
|
||||
volatile uint16_t basePeriodCnt;
|
||||
volatile uint64_t makePulsesCnt = 0, prevMakePulsesCnt = 0;
|
||||
volatile uint16_t deltaMakePulsesCnt;
|
||||
|
||||
volatile double posCmd1, posCmd2;
|
||||
double oldPosCmd1, oldPosCmd2;
|
||||
double deltaPosCmd1, deltaPosCmd2;
|
||||
|
||||
void syncWithLCNC()
|
||||
{
|
||||
syncTimer->pause();
|
||||
baseTimer->pause();
|
||||
deltaMakePulsesCnt = makePulsesCnt - prevMakePulsesCnt;
|
||||
prevMakePulsesCnt = makePulsesCnt;
|
||||
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)
|
||||
{
|
||||
if (--basePeriodCnt > 0) // Stop
|
||||
Step->makeAllPulses();
|
||||
else
|
||||
baseTimer->pause();
|
||||
}
|
||||
|
||||
int32_t delayT;
|
||||
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 / 1000));
|
||||
nLoopsAboveNorm += nLoops - 1;
|
||||
}
|
||||
oldIrqTime = irqTime;
|
||||
|
||||
uint32_t diffT = longTime.extendTime(micros()) - irqTime; // Time from interrupt was received by isr
|
||||
irqServeDelays.push(diffT);
|
||||
if (irqServeDelays.isFull()) // Do max calcs, just waiting a second
|
||||
{
|
||||
uint16_t maxInBuffer = 0;
|
||||
using index_t = decltype(irqServeDelays)::index_t;
|
||||
for (index_t i = 0; i < irqServeDelays.size(); i++)
|
||||
{
|
||||
if (maxInBuffer < irqServeDelays[i])
|
||||
maxInBuffer = irqServeDelays[i];
|
||||
}
|
||||
if (maxIrqServeTime > maxInBuffer) // Reduce by one, slowly eating up excess time
|
||||
maxIrqServeTime--;
|
||||
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;
|
||||
|
||||
// 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;
|
||||
|
||||
delayT = maxIrqServeTime - diffT; // Add 10 as some safety margin
|
||||
if (delayT > 0 && delayT < 900)
|
||||
{
|
||||
syncTimer->setOverflow(delayT, MICROSEC_FORMAT); // Work in flawed units, its ok
|
||||
syncTimer->refresh();
|
||||
syncTimer->resume();
|
||||
}
|
||||
else
|
||||
{
|
||||
syncWithLCNC();
|
||||
}
|
||||
}
|
||||
|
||||
float_t oldCommandedPosition = 0;
|
||||
void cb_get_inputs(void) // Set Master inputs, slave outputs, last operation
|
||||
{
|
||||
Obj.IndexStatus = Encoder1.indexHappened();
|
||||
Obj.EncPos = Encoder1.currentPos();
|
||||
Obj.EncFrequency = Encoder1.frequency(longTime.extendTime(micros()));
|
||||
Obj.IndexByte = Encoder1.getIndexState();
|
||||
|
||||
Obj.DiffT = nLoops;
|
||||
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;
|
||||
}
|
||||
|
||||
void ESC_interrupt_enable(uint32_t mask);
|
||||
void ESC_interrupt_disable(uint32_t mask);
|
||||
uint16_t dc_checker(void);
|
||||
void sync0Handler(void);
|
||||
|
||||
static esc_cfg_t config =
|
||||
{
|
||||
.user_arg = NULL,
|
||||
.use_interrupt = 1,
|
||||
.watchdog_cnt = 150,
|
||||
.set_defaults_hook = NULL,
|
||||
.pre_state_change_hook = NULL,
|
||||
.post_state_change_hook = NULL,
|
||||
.application_hook = handleStepper,
|
||||
.safeoutput_override = NULL,
|
||||
.pre_object_download_hook = NULL,
|
||||
.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_eep_handler = NULL,
|
||||
.esc_check_dc_handler = dc_checker,
|
||||
};
|
||||
|
||||
void measureCrystalFrequency(void);
|
||||
|
||||
volatile byte serveIRQ = 0;
|
||||
|
||||
void setup(void)
|
||||
{
|
||||
Serial1.begin(115200);
|
||||
#if 0
|
||||
measureCrystalFrequency(); // Calibrate crystal frequency
|
||||
#endif
|
||||
Step = new StepGen3;
|
||||
|
||||
encoder_config(); // Needed by encoder, probably breaks some timers.
|
||||
ecat_slv_init(&config);
|
||||
|
||||
pinMode(PA11, OUTPUT); // Step X
|
||||
pinMode(PA12, OUTPUT); // Dir X
|
||||
pinMode(PC9, OUTPUT); // Step Z
|
||||
pinMode(PC10, OUTPUT); // Dir Z
|
||||
|
||||
baseTimer = new HardwareTimer(TIM11); // The base period timer
|
||||
setFrequencyAdjustedMicrosSeconds(baseTimer, BASE_PERIOD / 1000);
|
||||
// baseTimer->setOverflow(BASE_PERIOD / 1000, MICROSEC_FORMAT); // Or the line above, This one is uncalibrated
|
||||
baseTimer->attachInterrupt(basePeriodCB);
|
||||
|
||||
syncTimer = new HardwareTimer(TIM3); // The Linuxcnc servo period sync timer
|
||||
syncTimer->attachInterrupt(syncWithLCNC);
|
||||
}
|
||||
|
||||
void loop(void)
|
||||
{
|
||||
uint64_t dTime;
|
||||
if (serveIRQ)
|
||||
{
|
||||
DIG_process(ALEventIRQ, DIG_PROCESS_WD_FLAG | DIG_PROCESS_OUTPUTS_FLAG |
|
||||
DIG_PROCESS_APP_HOOK_FLAG | DIG_PROCESS_INPUTS_FLAG);
|
||||
serveIRQ = 0;
|
||||
ESCvar.PrevTime = ESCvar.Time;
|
||||
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();
|
||||
}
|
||||
|
||||
void sync0Handler(void)
|
||||
{
|
||||
ALEventIRQ = ESC_ALeventread();
|
||||
// if (ALEventIRQ & ESCREG_ALEVENT_SM2)
|
||||
{
|
||||
irqTime = longTime.extendTime(micros());
|
||||
serveIRQ = 1;
|
||||
}
|
||||
irqCnt++; // debug output
|
||||
}
|
||||
|
||||
// Enable SM2 interrupts
|
||||
void ESC_interrupt_enable(uint32_t mask)
|
||||
{
|
||||
// Enable interrupt for SYNC0 or SM2 or SM3
|
||||
// uint32_t user_int_mask = ESCREG_ALEVENT_DC_SYNC0 | ESCREG_ALEVENT_SM2 | ESCREG_ALEVENT_SM3;
|
||||
uint32_t user_int_mask = ESCREG_ALEVENT_SM2; // Only SM2
|
||||
if (mask & user_int_mask)
|
||||
{
|
||||
ESC_ALeventmaskwrite(ESC_ALeventmaskread() | (mask & user_int_mask));
|
||||
ESC_ALeventmaskwrite(ESC_ALeventmaskread() & ~(ESCREG_ALEVENT_DC_SYNC0 | ESCREG_ALEVENT_SM3));
|
||||
attachInterrupt(digitalPinToInterrupt(PC3), sync0Handler, RISING);
|
||||
|
||||
// Set LAN9252 interrupt pin driver as push-pull active high
|
||||
uint32_t bits = 0x00000111;
|
||||
ESC_write(0x54, &bits, 4);
|
||||
|
||||
// Enable LAN9252 interrupt
|
||||
bits = 0x00000001;
|
||||
ESC_write(0x5c, &bits, 4);
|
||||
}
|
||||
}
|
||||
|
||||
// Disable SM2 interrupts
|
||||
void ESC_interrupt_disable(uint32_t mask)
|
||||
{
|
||||
// Enable interrupt for SYNC0 or SM2 or SM3
|
||||
// uint32_t user_int_mask = ESCREG_ALEVENT_DC_SYNC0 | ESCREG_ALEVENT_SM2 | ESCREG_ALEVENT_SM3;
|
||||
uint32_t user_int_mask = ESCREG_ALEVENT_SM2;
|
||||
|
||||
if (mask & user_int_mask)
|
||||
{
|
||||
// Disable interrupt from SYNC0
|
||||
ESC_ALeventmaskwrite(ESC_ALeventmaskread() & ~(mask & user_int_mask));
|
||||
detachInterrupt(digitalPinToInterrupt(PC3));
|
||||
// Disable LAN9252 interrupt
|
||||
uint32_t bits = 0x00000000;
|
||||
ESC_write(0x5c, &bits, 4);
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" uint32_t ESC_SYNC0cycletime(void);
|
||||
|
||||
// Setup of DC
|
||||
uint16_t dc_checker(void)
|
||||
{
|
||||
// Indicate we run DC
|
||||
ESCvar.dcsync = 1;
|
||||
sync0CycleTime = ESC_SYNC0cycletime(); // nanosecs
|
||||
return 0;
|
||||
}
|
||||
|
||||
//
|
||||
// Code to calibrate the crystal.
|
||||
//
|
||||
|
||||
#include <HardwareTimer.h>
|
||||
HardwareTimer *timer;
|
||||
volatile uint32_t cnt;
|
||||
|
||||
void CB(void)
|
||||
{
|
||||
if (cnt-- == 0)
|
||||
{
|
||||
timer->pause();
|
||||
}
|
||||
}
|
||||
|
||||
void setFrequencyAdjustedMicrosSeconds(HardwareTimer *timer, uint32_t usecs)
|
||||
{
|
||||
const uint16_t calibrated1000 = 1042; // <- This is the factor to adjust to make 1 sec = 1 sec
|
||||
uint32_t period_cyc = (usecs * (timer->getTimerClkFreq() / 1000)) / calibrated1000; // Avoid overflow during math
|
||||
uint32_t Prescalerfactor = (period_cyc / 0x10000) + 1;
|
||||
uint32_t PeriodTicks = period_cyc / Prescalerfactor;
|
||||
timer->setPrescaleFactor(Prescalerfactor);
|
||||
timer->setOverflow(PeriodTicks, TICK_FORMAT);
|
||||
// Serial1.printf("Period_cyc=%u Prescalefactor =%u ticks = %u\n", period_cyc, Prescalerfactor, PeriodTicks);
|
||||
}
|
||||
|
||||
void measureCrystalFrequency(void)
|
||||
{
|
||||
timer = new HardwareTimer(TIM1);
|
||||
Serial1.begin(115200);
|
||||
delay(3000);
|
||||
Serial1.printf("Clock freq = %u\n", timer->getTimerClkFreq());
|
||||
setFrequencyAdjustedMicrosSeconds(timer, 1000);
|
||||
timer->refresh();
|
||||
timer->attachInterrupt(CB);
|
||||
cnt = 10000;
|
||||
|
||||
Serial1.printf("\n");
|
||||
uint32_t startT = micros();
|
||||
timer->resume();
|
||||
|
||||
while (cnt != 0)
|
||||
;
|
||||
|
||||
uint32_t endT = micros();
|
||||
uint32_t diffT = endT - startT;
|
||||
Serial1.printf("\n");
|
||||
Serial1.printf("diff = %u\n", diffT);
|
||||
|
||||
Serial1.printf("\n");
|
||||
delay(10000);
|
||||
Serial1.printf("\n");
|
||||
|
||||
exit(0);
|
||||
}
|
||||
47
Cards/EaserCAT-2000/Kicad/.gitignore
vendored
Normal file
47
Cards/EaserCAT-2000/Kicad/.gitignore
vendored
Normal 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.*
|
||||
61631
Cards/EaserCAT-2000/Kicad/Ethercat-stm32.kicad_pcb
Executable file
61631
Cards/EaserCAT-2000/Kicad/Ethercat-stm32.kicad_pcb
Executable file
File diff suppressed because it is too large
Load Diff
@@ -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",
|
||||
176
Cards/EaserCAT-2000/Kicad/Ethercat-stm32.kicad_sch
Executable file
176
Cards/EaserCAT-2000/Kicad/Ethercat-stm32.kicad_sch
Executable 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")
|
||||
)
|
||||
)
|
||||
)
|
||||
6236
Cards/EaserCAT-2000/Kicad/LAN9252.kicad_sch
Executable file
6236
Cards/EaserCAT-2000/Kicad/LAN9252.kicad_sch
Executable file
File diff suppressed because it is too large
Load Diff
11312
Cards/EaserCAT-2000/Kicad/LAN9252_diverse.kicad_sch
Executable file
11312
Cards/EaserCAT-2000/Kicad/LAN9252_diverse.kicad_sch
Executable file
File diff suppressed because it is too large
Load Diff
12965
Cards/EaserCAT-2000/Kicad/STM32F4.kicad_sch
Executable file
12965
Cards/EaserCAT-2000/Kicad/STM32F4.kicad_sch
Executable file
File diff suppressed because it is too large
Load Diff
4695
Cards/EaserCAT-2000/Kicad/peripherals.kicad_sch
Executable file
4695
Cards/EaserCAT-2000/Kicad/peripherals.kicad_sch
Executable file
File diff suppressed because it is too large
Load Diff
BIN
Cards/EaserCAT-2000/linuxcnc/Performance.ods
Executable file
BIN
Cards/EaserCAT-2000/linuxcnc/Performance.ods
Executable file
Binary file not shown.
0
linuxcnc/sim.gmoccapy.lathe_configs/LatheMacro.svg → Cards/EaserCAT-2000/linuxcnc/Turner.2ms/LatheMacro.svg
Executable file → Normal file
0
linuxcnc/sim.gmoccapy.lathe_configs/LatheMacro.svg → Cards/EaserCAT-2000/linuxcnc/Turner.2ms/LatheMacro.svg
Executable file → Normal file
|
Before Width: | Height: | Size: 4.8 MiB After Width: | Height: | Size: 4.8 MiB |
0
linuxcnc/sim.gmoccapy.lathe_configs/README → Cards/EaserCAT-2000/linuxcnc/Turner.2ms/README
Executable file → Normal file
0
linuxcnc/sim.gmoccapy.lathe_configs/README → Cards/EaserCAT-2000/linuxcnc/Turner.2ms/README
Executable file → Normal file
159
Cards/EaserCAT-2000/linuxcnc/Turner.2ms/Turner.hal
Normal file
159
Cards/EaserCAT-2000/linuxcnc/Turner.2ms/Turner.hal
Normal file
@@ -0,0 +1,159 @@
|
||||
# Generated by PNCconf at Sat Sep 10 10:10:56 2016
|
||||
# If you make changes to this file, they will be
|
||||
# overwritten when you run PNCconf again
|
||||
|
||||
loadrt [KINS]KINEMATICS
|
||||
#autoconverted trivkins
|
||||
loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS
|
||||
|
||||
loadusr -W lcec_conf ethercat-conf.xml
|
||||
loadrt lcec
|
||||
loadrt metalmusings_encoder
|
||||
|
||||
addf lcec.read-all servo-thread
|
||||
addf metalmusings-encoder.0 servo-thread
|
||||
addf motion-command-handler servo-thread
|
||||
addf motion-controller servo-thread
|
||||
|
||||
#*******************
|
||||
# AXIS X
|
||||
#*******************
|
||||
|
||||
# --- joint signals for motion
|
||||
|
||||
net x-pos-cmd <= joint.0.motor-pos-cmd
|
||||
net x-vel-cmd <= joint.0.vel-cmd
|
||||
net x-pos-fb <= joint.0.motor-pos-fb
|
||||
net x-enable <= joint.0.amp-enable-out
|
||||
|
||||
# --- connect stepper driver to joint
|
||||
# 1/2 of stepper's p/rev 2000 => 1000
|
||||
setp lcec.0.0.steps-per-mm-1 200
|
||||
net x-pos-cmd => lcec.0.0.commanded-position-1
|
||||
net x-pos-fb => lcec.0.0.actual-position-1
|
||||
#net x-enable => lcec.0.0.enable
|
||||
|
||||
#*******************
|
||||
# AXIS Z
|
||||
#*******************
|
||||
|
||||
# --- joint signals for motion
|
||||
|
||||
net z-pos-cmd <= joint.1.motor-pos-cmd
|
||||
net z-vel-cmd <= joint.1.vel-cmd
|
||||
net z-pos-fb <= joint.1.motor-pos-fb
|
||||
net z-enable <= joint.1.amp-enable-out
|
||||
|
||||
# --- connect stepper driver to the joint
|
||||
|
||||
setp lcec.0.0.steps-per-mm-2 80
|
||||
# 1/5 of drive's step/rev
|
||||
net z-pos-cmd => lcec.0.0.commanded-position-2
|
||||
net z-pos-fb => lcec.0.0.actual-position-2
|
||||
# net z-enable => lcec.0.0.enable
|
||||
|
||||
#*********************
|
||||
# E-STOP
|
||||
#*********************
|
||||
|
||||
setp iocontrol.0.emc-enable-in 1
|
||||
#net estop iocontrol.0.emc-enable-in lcec.0.1.din-0
|
||||
|
||||
#setp lcec.0.3.enc-pos-scale [SPINDLE_9]ENCODER_SCALE
|
||||
#setp lcec.0.0.enc-pos-scale [SPINDLE_9]ENCODER_SCALE
|
||||
|
||||
#net spindle-revs <= lcec.0.3.enc-pos
|
||||
net spindle-revs <= lcec.0.0.enc-position
|
||||
loadrt invert
|
||||
loadrt mult2 names=mult2.rps,mult2.rpm
|
||||
addf invert.0 servo-thread
|
||||
addf mult2.rps servo-thread
|
||||
addf mult2.rpm servo-thread
|
||||
|
||||
setp invert.0.in [SPINDLE_9]ENCODER_SCALE
|
||||
setp mult2.rpm.in0 -60.0
|
||||
setp mult2.rpm.in0 60.0
|
||||
#net enc-invert-pos-scale mult2.rps.in0 <= invert.0.out
|
||||
#net enc-get-freq-rps mult2.rps.in1 <= lcec.0.3.enc-frequency
|
||||
#net spindle-vel-fb-rps mult2.rpm.in1 <= mult2.rps.out
|
||||
#net spindle-vel-fb-rpm mult2.rpm.out
|
||||
#net spindle-index-enable lcec.0.3.enc-index-c-enable
|
||||
|
||||
net spindle-vel-fb-rps mult2.rpm.in1 <= lcec.0.0.enc-frequency
|
||||
net spindle-vel-fb-rpm mult2.rpm.out
|
||||
|
||||
net to_encoder metalmusings-encoder.0.index-latch-enable lcec.0.0.enc-index-latch-enable
|
||||
net from_encoder metalmusings-encoder.0.index-status lcec.0.0.index-status
|
||||
net spindle-index-enable metalmusings-encoder.0.index-c-enable
|
||||
|
||||
# ---setup spindle control signals---
|
||||
|
||||
net spindle-vel-cmd-rps <= spindle.0.speed-out-rps
|
||||
net spindle-vel-cmd-rps-abs <= spindle.0.speed-out-rps-abs
|
||||
net spindle-vel-cmd-rpm <= spindle.0.speed-out
|
||||
net spindle-vel-cmd-rpm-abs <= spindle.0.speed-out-abs
|
||||
net spindle-enable <= spindle.0.on
|
||||
net spindle-cw <= spindle.0.forward
|
||||
net spindle-ccw <= spindle.0.reverse
|
||||
net spindle-brake <= spindle.0.brake
|
||||
net spindle-revs => spindle.0.revs
|
||||
net spindle-at-speed => spindle.0.at-speed
|
||||
net spindle-vel-fb-rps => spindle.0.speed-in
|
||||
net spindle-index-enable <=> spindle.0.index-enable
|
||||
|
||||
|
||||
#******************************
|
||||
# connect miscellaneous signals
|
||||
#******************************
|
||||
|
||||
# ---HALUI signals---
|
||||
|
||||
net joint-select-a halui.axis.x.select
|
||||
net x-is-homed halui.joint.0.is-homed
|
||||
net jog-x-pos halui.axis.x.plus
|
||||
net jog-x-neg halui.axis.x.minus
|
||||
net jog-x-analog halui.axis.x.analog
|
||||
net joint-select-b halui.axis.z.select
|
||||
net z-is-homed halui.joint.1.is-homed
|
||||
net jog-z-pos halui.axis.z.plus
|
||||
net jog-z-neg halui.axis.z.minus
|
||||
net jog-z-analog halui.axis.z.analog
|
||||
net jog-selected-pos halui.axis.selected.plus
|
||||
net jog-selected-neg halui.axis.selected.minus
|
||||
net spindle-manual-cw halui.spindle.0.forward
|
||||
net spindle-manual-ccw halui.spindle.0.reverse
|
||||
net spindle-manual-stop halui.spindle.0.stop
|
||||
net machine-is-on halui.machine.is-on
|
||||
net jog-speed halui.axis.jog-speed
|
||||
net MDI-mode halui.mode.is-mdi
|
||||
|
||||
# ---coolant signals---
|
||||
|
||||
net coolant-mist <= iocontrol.0.coolant-mist
|
||||
net coolant-flood <= iocontrol.0.coolant-flood
|
||||
|
||||
# ---probe signal---
|
||||
|
||||
net probe-in => motion.probe-input
|
||||
|
||||
# ---motion control signals---
|
||||
|
||||
net in-position <= motion.in-position
|
||||
net machine-is-enabled <= motion.motion-enabled
|
||||
|
||||
# ---digital in / out signals---
|
||||
|
||||
# ---estop signals---
|
||||
|
||||
net estop-out <= iocontrol.0.user-enable-out
|
||||
net estop-ext => iocontrol.0.emc-enable-in
|
||||
|
||||
# ---manual tool change signals---
|
||||
|
||||
loadusr -W hal_manualtoolchange
|
||||
#net tool-change-request iocontrol.0.tool-change => hal_manualtoolchange.change
|
||||
#net tool-change-confirmed iocontrol.0.tool-changed <= hal_manualtoolchange.changed
|
||||
#net tool-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number
|
||||
#net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared
|
||||
|
||||
addf lcec.write-all servo-thread
|
||||
164
Cards/EaserCAT-2000/linuxcnc/Turner.2ms/Turner.ini
Normal file
164
Cards/EaserCAT-2000/linuxcnc/Turner.2ms/Turner.ini
Normal file
@@ -0,0 +1,164 @@
|
||||
# This config file was created 2016-11-26 11:13:55.093594 by the update_ini script
|
||||
# The original config files may be found in the /home/debian/linuxcnc/configs/Turner/Turner.old directory
|
||||
|
||||
# Generated by PNCconf at Fri Sep 9 22:31:33 2016
|
||||
# If you make changes to this file, they will be
|
||||
# overwritten when you run PNCconf again
|
||||
|
||||
[EMC]
|
||||
# The version string for this INI file.
|
||||
VERSION = 1.1
|
||||
|
||||
MACHINE = Turner
|
||||
DEBUG = 0
|
||||
|
||||
[DISPLAY]
|
||||
LATHE=1
|
||||
DISPLAY = gmoccapy
|
||||
BACK_TOOL_LATHE = 0
|
||||
CYCLE_TIME = 150
|
||||
POSITION_OFFSET = RELATIVE
|
||||
POSITION_FEEDBACK = ACTUAL
|
||||
MAX_FEED_OVERRIDE = 2.000000
|
||||
MAX_SPINDLE_OVERRIDE = 2.000000
|
||||
MIN_SPINDLE_OVERRIDE = 0.500000
|
||||
INTRO_GRAPHIC = linuxcnc.gif
|
||||
INTRO_TIME = 1
|
||||
PROGRAM_PREFIX = /home/debian/linuxcnc/configs/Turner/nc_files
|
||||
INCREMENTS = 5mm 1mm .5mm .1mm .05mm .01mm .005mm
|
||||
LATHE = 1
|
||||
POSITION_FEEDBACK = ACTUAL
|
||||
DEFAULT_LINEAR_VELOCITY = 6.000000
|
||||
MAX_LINEAR_VELOCITY = 25.000000
|
||||
MIN_LINEAR_VELOCITY = 0.500000
|
||||
DEFAULT_ANGULAR_VELOCITY = 12.000000
|
||||
MAX_ANGULAR_VELOCITY = 1800.000000
|
||||
MIN_ANGULAR_VELOCITY = 1.666667
|
||||
EDITOR = gedit
|
||||
|
||||
#EMBED_TAB_NAME = Cycles
|
||||
#EMBED_TAB_LOCATION = ntb_preview
|
||||
#EMBED_TAB_LOCATION = ntb_user_tabs
|
||||
#EMBED_TAB_COMMAND = halcmd loadusr -Wn gladevcp gladevcp -c gladevcp -U notouch=1 -U norun=0 -u lathehandler.py -x {XID} lathemacro.ui
|
||||
|
||||
[FILTER]
|
||||
PROGRAM_EXTENSION = .png,.gif,.jpg Greyscale Depth Image
|
||||
PROGRAM_EXTENSION = .py Python Script
|
||||
png = image-to-gcode
|
||||
gif = image-to-gcode
|
||||
jpg = image-to-gcode
|
||||
py = python
|
||||
|
||||
[RS274NGC]
|
||||
PARAMETER_FILE = linuxcnc.var
|
||||
SUBROUTINE_PATH = .:../../nc_files/subs:nc_files:../../../nc2
|
||||
RS274NGC_STARTUP_CODE = G18 G21 G40 G49 G54 G80 G90 G94 G7 M9 M5 G64 P0.005
|
||||
FEATURES=12
|
||||
USER_M_PATH = nc_files:.
|
||||
|
||||
[EMCMOT]
|
||||
EMCMOT = motmod
|
||||
COMM_TIMEOUT = 1.0
|
||||
COMM_WAIT = 0.010
|
||||
BASE_PERIOD = 100000
|
||||
SERVO_PERIOD = 2000000
|
||||
|
||||
[TASK]
|
||||
TASK = milltask
|
||||
CYCLE_TIME = 0.001
|
||||
|
||||
[HAL]
|
||||
TWOPASS = true
|
||||
HALUI = halui
|
||||
HALFILE = Turner.hal
|
||||
#HALFILE = custom_vfd.hal
|
||||
HALFILE = custom.hal
|
||||
#HALFILE = xhc-hb04.tcl
|
||||
#HALFILE = monitor_xhc-hb04.tcl
|
||||
POSTGUI_HALFILE = postgui_call_list.hal
|
||||
SHUTDOWN = shutdown.hal
|
||||
|
||||
[TRAJ]
|
||||
COORDINATES = X Z
|
||||
LINEAR_UNITS = mm
|
||||
ANGULAR_UNITS = degree
|
||||
CYCLE_TIME = 0.010
|
||||
DEFAULT_LINEAR_VELOCITY = 20.0
|
||||
MAX_LINEAR_VELOCITY = 40.00
|
||||
DEFAULT_ACCELERATION = 400.0
|
||||
MAX_ACCELERATION = 400.0
|
||||
NO_FORCE_HOMING = 1
|
||||
|
||||
[EMCIO]
|
||||
EMCIO = io
|
||||
CYCLE_TIME = 0.100
|
||||
TOOL_TABLE = tool.tbl
|
||||
|
||||
[KINS]
|
||||
KINEMATICS = trivkins coordinates=XZ
|
||||
#This is a best-guess at the number of joints, it should be checked
|
||||
JOINTS = 2
|
||||
|
||||
#********************
|
||||
# Axis X
|
||||
#********************
|
||||
|
||||
[AXIS_X]
|
||||
MIN_LIMIT = -106
|
||||
MAX_LIMIT = 106
|
||||
MAX_VELOCITY = 15.0
|
||||
MAX_ACCELERATION = 400.0
|
||||
|
||||
[JOINT_0]
|
||||
|
||||
TYPE = LINEAR
|
||||
HOME = 0.0
|
||||
FERROR = 0.5
|
||||
MIN_FERROR = 1
|
||||
MAX_VELOCITY = 20.0
|
||||
MAX_ACCELERATION = 400.0
|
||||
MAX_OUTPUT = 0.0
|
||||
MIN_LIMIT = -106
|
||||
MAX_LIMIT = 106
|
||||
HOME_SEARCH_VEL = 0
|
||||
HOME_LATCH_VEL = 0
|
||||
HOME_SEQUENCE = 0
|
||||
|
||||
|
||||
#********************
|
||||
# Axis Z
|
||||
#********************
|
||||
[AXIS_Z]
|
||||
MIN_LIMIT = -560.0
|
||||
MAX_LIMIT = 560.0
|
||||
MAX_VELOCITY = 50.0
|
||||
MAX_ACCELERATION = 400.0
|
||||
|
||||
[JOINT_1]
|
||||
|
||||
TYPE = LINEAR
|
||||
HOME = 0.0
|
||||
FERROR = 0.5
|
||||
MIN_FERROR = 1
|
||||
MAX_VELOCITY = 75.0
|
||||
MAX_ACCELERATION = 400.0
|
||||
HOME_SEARCH_VEL = 0
|
||||
HOME_LATCH_VEL = 0
|
||||
HOME_SEQUENCE = 0
|
||||
|
||||
[SPINDLE_9]
|
||||
P = 0.0
|
||||
I = 0.0
|
||||
D = 0.0
|
||||
FF0 = 1.0
|
||||
FF1 = 0.0
|
||||
FF2 = 0.0
|
||||
BIAS = 0.0
|
||||
DEADBAND = 0.0
|
||||
MAX_OUTPUT = 2400.0
|
||||
OUTPUT_SCALE =5760
|
||||
OUTPUT_MIN_LIMIT = 0
|
||||
OUTPUT_MAX_LIMIT = 2400
|
||||
#ENCODER_SCALE = -4000
|
||||
ENCODER_SCALE = 2000
|
||||
|
||||
79
Cards/EaserCAT-2000/linuxcnc/Turner.2ms/Turner.pref
Normal file
79
Cards/EaserCAT-2000/linuxcnc/Turner.2ms/Turner.pref
Normal file
@@ -0,0 +1,79 @@
|
||||
[DEFAULT]
|
||||
dro_digits = 3
|
||||
dro_size = 28
|
||||
abs_color = #0000FF
|
||||
rel_color = #000000
|
||||
dtg_color = #FFFF00
|
||||
homed_color = #00FF00
|
||||
unhomed_color = #FF0000
|
||||
enable_dro = False
|
||||
scale_jog_vel = 24.0
|
||||
scale_spindle_override = 1
|
||||
scale_feed_override = 1
|
||||
scale_rapid_override = 1
|
||||
spindle_bar_min = 0.0
|
||||
spindle_bar_max = 6000.0
|
||||
turtle_jog_factor = 20
|
||||
hide_turtle_jog_button = False
|
||||
unlock_code = 123
|
||||
toggle_readout = True
|
||||
spindle_start_rpm = 300.0
|
||||
kbd_height = 250
|
||||
view = y
|
||||
blockheight = 0.0
|
||||
reload_tool = False
|
||||
open_file =
|
||||
screen1 = window
|
||||
hide_titlebar = False
|
||||
x_pos = 40
|
||||
y_pos = 30
|
||||
width = 979
|
||||
height = 750
|
||||
use_toolmeasurement = False
|
||||
gtk_theme = Follow System Theme
|
||||
icon_theme = classic
|
||||
audio_enabled = True
|
||||
audio_alert = /usr/share/sounds/freedesktop/stereo/dialog-warning.oga
|
||||
audio_error = /usr/share/sounds/freedesktop/stereo/dialog-error.oga
|
||||
grid_size = 1.0
|
||||
mouse_btn_mode = 4
|
||||
hide_cursor = False
|
||||
hide_tooltips = False
|
||||
system_name_tool = Tool
|
||||
system_name_g5x = G5x
|
||||
system_name_rot = Rot
|
||||
system_name_g92 = G92
|
||||
system_name_g54 = G54
|
||||
system_name_g55 = G55
|
||||
system_name_g56 = G56
|
||||
system_name_g57 = G57
|
||||
system_name_g58 = G58
|
||||
system_name_g59 = G59
|
||||
system_name_g59.1 = G59.1
|
||||
system_name_g59.2 = G59.2
|
||||
system_name_g59.3 = G59.3
|
||||
jump_to_dir = /home/debian
|
||||
show_keyboard_on_offset = False
|
||||
show_keyboard_on_tooledit = False
|
||||
show_keyboard_on_edit = False
|
||||
show_keyboard_on_mdi = False
|
||||
show_keyboard_on_file_selection = False
|
||||
x_pos_popup = 45.0
|
||||
y_pos_popup = 55
|
||||
width_popup = 250.0
|
||||
max_messages = 10
|
||||
message_font = sans 10
|
||||
use_frames = True
|
||||
blockdel = False
|
||||
show_offsets = False
|
||||
show_dtg = False
|
||||
view_tool_path = False
|
||||
view_dimension = True
|
||||
run_from_line = no_run
|
||||
unlock_way = no
|
||||
show_preview_on_offset = False
|
||||
use_keyboard_shortcuts = False
|
||||
offset_axis_z = 150.0
|
||||
diameter offset_axis_x = 0
|
||||
offset_axis_x = 0.0
|
||||
|
||||
Binary file not shown.
27
Cards/EaserCAT-2000/linuxcnc/Turner.2ms/autosave.halscope
Normal file
27
Cards/EaserCAT-2000/linuxcnc/Turner.2ms/autosave.halscope
Normal file
@@ -0,0 +1,27 @@
|
||||
THREAD servo-thread
|
||||
MAXCHAN 4
|
||||
HMULT 1
|
||||
HZOOM 1
|
||||
HPOS 4,132653e-01
|
||||
CHAN 1
|
||||
PIN lcec.0.0.D1
|
||||
VSCALE 1
|
||||
VPOS 0,781382
|
||||
VOFF 0,000000e+00
|
||||
CHAN 2
|
||||
PIN lcec.0.0.DiffT
|
||||
VSCALE 0
|
||||
VPOS 0,678420
|
||||
VOFF 0,000000e+00
|
||||
CHAN 3
|
||||
PIN lcec.0.0.D3
|
||||
VSCALE 1
|
||||
VPOS 0,743300
|
||||
VOFF 2,000000e+02
|
||||
CHAN 4
|
||||
PIN lcec.0.0.D4
|
||||
VSCALE 5
|
||||
VPOS 0,364679
|
||||
VOFF 0,000000e+00
|
||||
TMODE 1
|
||||
RMODE 2
|
||||
0
linuxcnc/sim.gmoccapy.lathe_configs/boring.ngc → Cards/EaserCAT-2000/linuxcnc/Turner.2ms/boring.ngc
Executable file → Normal file
0
linuxcnc/sim.gmoccapy.lathe_configs/boring.ngc → Cards/EaserCAT-2000/linuxcnc/Turner.2ms/boring.ngc
Executable file → Normal file
0
linuxcnc/sim.gmoccapy.lathe_configs/chamfer.ngc → Cards/EaserCAT-2000/linuxcnc/Turner.2ms/chamfer.ngc
Executable file → Normal file
0
linuxcnc/sim.gmoccapy.lathe_configs/chamfer.ngc → Cards/EaserCAT-2000/linuxcnc/Turner.2ms/chamfer.ngc
Executable file → Normal file
31
Cards/EaserCAT-2000/linuxcnc/Turner.2ms/core_sim_lathe.hal
Normal file
31
Cards/EaserCAT-2000/linuxcnc/Turner.2ms/core_sim_lathe.hal
Normal file
@@ -0,0 +1,31 @@
|
||||
# core HAL config file for simulation
|
||||
|
||||
# first load all the RT modules that will be needed
|
||||
# kinematics
|
||||
loadrt [KINS]KINEMATICS
|
||||
# motion controller, get name and thread periods from ini file
|
||||
loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS
|
||||
|
||||
# add motion controller functions to servo thread
|
||||
addf motion-command-handler servo-thread
|
||||
addf motion-controller servo-thread
|
||||
|
||||
# create HAL signals for position commands from motion module
|
||||
# loop position commands back to motion module feedback
|
||||
net Xpos joint.0.motor-pos-cmd => joint.0.motor-pos-fb
|
||||
net Zpos joint.1.motor-pos-cmd => joint.1.motor-pos-fb
|
||||
|
||||
# estop loopback
|
||||
net estop-loop iocontrol.0.user-enable-out iocontrol.0.emc-enable-in
|
||||
|
||||
# create signals for tool loading loopback
|
||||
net tool-prep-loop iocontrol.0.tool-prepare iocontrol.0.tool-prepared
|
||||
net tool-change-loop iocontrol.0.tool-change iocontrol.0.tool-changed
|
||||
|
||||
net spindle-fwd spindle.0.forward
|
||||
net spindle-rev spindle.0.reverse
|
||||
#net spindle-speed spindle.0.speed-out
|
||||
|
||||
net lube iocontrol.0.lube
|
||||
net flood iocontrol.0.coolant-flood
|
||||
net mist iocontrol.0.coolant-mist
|
||||
0
linuxcnc/sim.gmoccapy.lathe_configs/core_sim_lathe_C.hal → Cards/EaserCAT-2000/linuxcnc/Turner.2ms/core_sim_lathe_C.hal
Executable file → Normal file
0
linuxcnc/sim.gmoccapy.lathe_configs/core_sim_lathe_C.hal → Cards/EaserCAT-2000/linuxcnc/Turner.2ms/core_sim_lathe_C.hal
Executable file → Normal file
0
linuxcnc/sim.gmoccapy.lathe_configs/core_sim_lathe_CW.hal → Cards/EaserCAT-2000/linuxcnc/Turner.2ms/core_sim_lathe_CW.hal
Executable file → Normal file
0
linuxcnc/sim.gmoccapy.lathe_configs/core_sim_lathe_CW.hal → Cards/EaserCAT-2000/linuxcnc/Turner.2ms/core_sim_lathe_CW.hal
Executable file → Normal file
4
Cards/EaserCAT-2000/linuxcnc/Turner.2ms/custom.hal
Normal file
4
Cards/EaserCAT-2000/linuxcnc/Turner.2ms/custom.hal
Normal file
@@ -0,0 +1,4 @@
|
||||
|
||||
# Gamepad
|
||||
loadusr -W hal_input -KRAL F310
|
||||
# Resten är i custom_postgui.hal
|
||||
0
linuxcnc/sim.gmoccapy.lathe_configs/custom_postgui.hal → Cards/EaserCAT-2000/linuxcnc/Turner.2ms/custom_postgui.hal
Executable file → Normal file
0
linuxcnc/sim.gmoccapy.lathe_configs/custom_postgui.hal → Cards/EaserCAT-2000/linuxcnc/Turner.2ms/custom_postgui.hal
Executable file → Normal file
48
Cards/EaserCAT-2000/linuxcnc/Turner.2ms/custom_vfd.hal
Normal file
48
Cards/EaserCAT-2000/linuxcnc/Turner.2ms/custom_vfd.hal
Normal file
@@ -0,0 +1,48 @@
|
||||
# Include your custom HAL commands here
|
||||
|
||||
# Load the Huanyang VFD user component
|
||||
loadusr -Wn spindle-vfd hy_vfd -n spindle-vfd -d /dev/hy_vfd -r 19200 -p none -s 1 -b 8
|
||||
|
||||
# motion.spindle-speed-in needs rev per second
|
||||
loadrt scale names=scale.0,scale.1,scale.2
|
||||
# scale.0 gearbox via M101-M106, M101 being lowest gear.
|
||||
# scale.1 Inverted gear ratio
|
||||
# scale.2 motion.spindle-speed.in in rev/sec
|
||||
loadrt limit2 names=spindlemax
|
||||
loadrt mult2 names=mult2.1
|
||||
addf scale.0 servo-thread
|
||||
addf scale.1 servo-thread
|
||||
addf scale.2 servo-thread
|
||||
addf mult2.1 servo-thread
|
||||
addf spindlemax servo-thread
|
||||
setp scale.0.gain 0.8846 # Start with fourth gear
|
||||
setp scale.1.gain 1.13045
|
||||
setp scale.2.gain 0.0166666667
|
||||
setp mult2.1.in1 25.0
|
||||
unlinkp spindle.0.forward
|
||||
unlinkp spindle.0.reverse
|
||||
unlinkp spindle.0.on
|
||||
#unlinkp motion.spindle-at-speed
|
||||
net spindle-fwd spindle.0.forward => spindle-vfd.spindle-forward
|
||||
net spindle-reverse spindle.0.reverse => spindle-vfd.spindle-reverse
|
||||
net spindle-on spindle.0.on => spindle-vfd.spindle-on
|
||||
net spindle-at-speed <= spindle-vfd.spindle-at-speed
|
||||
#net spindle-enable => spindle-vfd.enable
|
||||
setp spindle-vfd.enable 1
|
||||
|
||||
# Prepare max limit rpm for spindle
|
||||
net spindle-max-freq spindle-vfd.max-freq => mult2.1.in0
|
||||
net spindle-max-rpm mult2.1.out => spindlemax.max # Max limit for motor rpm, like 67*25 = 1675
|
||||
|
||||
# Give speed to vfd, limited to max possible
|
||||
unlinkp spindle.0.speed-out-abs
|
||||
net spindle-speed-scale spindle.0.speed-out-abs => scale.1.in # Spindle rpm => Motor rpm
|
||||
net spindle-speed-cmd-unlimited scale.1.out => spindlemax.in # Limit spindle rpm
|
||||
net spindle-speed-cmd-limited spindlemax.out => spindle-vfd.speed-command # Feed to vfd
|
||||
|
||||
# Convert actual feed from rpm to rps, consider gear in use.
|
||||
unlinkp spindle.0.speed-in
|
||||
net spindle-speed-scale2 spindle-vfd.spindle-speed-fb => scale.2.in # Motor rpm => Motor rps
|
||||
net spindle-speed-gears scale.2.out => scale.0.in # Motor rps => spindle rps
|
||||
net spindle-speed-in scale.0.out => spindle.0.speed-in
|
||||
|
||||
0
linuxcnc/sim.gmoccapy.lathe_configs/drilling.ngc → Cards/EaserCAT-2000/linuxcnc/Turner.2ms/drilling.ngc
Executable file → Normal file
0
linuxcnc/sim.gmoccapy.lathe_configs/drilling.ngc → Cards/EaserCAT-2000/linuxcnc/Turner.2ms/drilling.ngc
Executable file → Normal file
59
Cards/EaserCAT-2000/linuxcnc/Turner.2ms/ethercat-conf.xml
Normal file
59
Cards/EaserCAT-2000/linuxcnc/Turner.2ms/ethercat-conf.xml
Normal file
@@ -0,0 +1,59 @@
|
||||
<masters>
|
||||
<master idx="0" appTimePeriod="2000000" refClockSyncCycles="1">
|
||||
<slave idx="0" type="generic" vid="00aaa" pid="000bbbccc" configPdos="true">
|
||||
<dcConf assignActivate="300" sync0Cycle="*1" sync0Shift="500000"/>
|
||||
<syncManager idx="2" dir="out">
|
||||
<pdo idx="1600">
|
||||
<pdoEntry idx="7000" subIdx="00" bitLen="32" halPin="enc-index-latch-enable" halType="u32"/>
|
||||
</pdo>
|
||||
<pdo idx="1601">
|
||||
<pdoEntry idx="7001" subIdx="00" bitLen="32" halPin="commanded-position-1" halType="float-ieee"/>
|
||||
</pdo>
|
||||
<pdo idx="1602">
|
||||
<pdoEntry idx="7002" subIdx="00" bitLen="32" halPin="commanded-position-2" halType="float-ieee"/>
|
||||
</pdo>
|
||||
<pdo idx="1603">
|
||||
<pdoEntry idx="7003" subIdx="00" bitLen="16" halPin="steps-per-mm-1" halType="s32"/>
|
||||
</pdo>
|
||||
<pdo idx="1604">
|
||||
<pdoEntry idx="7004" subIdx="00" bitLen="16" halPin="steps-per-mm-2" halType="s32"/>
|
||||
</pdo>
|
||||
</syncManager>
|
||||
<syncManager idx="3" dir="in">
|
||||
<pdo idx="1a00">
|
||||
<pdoEntry idx="6000" subIdx="00" bitLen="32" halPin="enc-position" halType="float-ieee"/>
|
||||
</pdo>
|
||||
<pdo idx="1a01">
|
||||
<pdoEntry idx="6001" subIdx="00" bitLen="32" halPin="enc-frequency" halType="float-ieee"/>
|
||||
</pdo>
|
||||
<pdo idx="1a02">
|
||||
<pdoEntry idx="6002" subIdx="00" bitLen="16" halPin="DiffT" halType="u32"/>
|
||||
</pdo>
|
||||
<pdo idx="1a03">
|
||||
<pdoEntry idx="6003" subIdx="00" bitLen="32" halPin="index-byte" halType="u32"/>
|
||||
</pdo>
|
||||
<pdo idx="1a04">
|
||||
<pdoEntry idx="6004" subIdx="00" bitLen="32" halPin="index-status" halType="u32"/>
|
||||
</pdo>
|
||||
<pdo idx="1a05">
|
||||
<pdoEntry idx="6005" subIdx="00" bitLen="32" halPin="actual-position-1" halType="float-ieee"/>
|
||||
</pdo>
|
||||
<pdo idx="1a06">
|
||||
<pdoEntry idx="6006" subIdx="00" bitLen="32" halPin="actual-position-2" halType="float-ieee"/>
|
||||
</pdo>
|
||||
<pdo idx="1a07">
|
||||
<pdoEntry idx="6007" subIdx="00" bitLen="16" halPin="D1" halType="s32"/>
|
||||
</pdo>
|
||||
<pdo idx="1a08">
|
||||
<pdoEntry idx="6008" subIdx="00" bitLen="16" halPin="D2" halType="s32"/>
|
||||
</pdo>
|
||||
<pdo idx="1a09">
|
||||
<pdoEntry idx="6009" subIdx="00" bitLen="16" halPin="D3" halType="s32"/>
|
||||
</pdo>
|
||||
<pdo idx="1a0a">
|
||||
<pdoEntry idx="600a" subIdx="00" bitLen="16" halPin="D4" halType="s32"/>
|
||||
</pdo>
|
||||
</syncManager>
|
||||
</slave>
|
||||
</master>
|
||||
</masters>
|
||||
@@ -0,0 +1,82 @@
|
||||
<masters>
|
||||
<master idx="0" appTimePeriod="1000000" refClockSyncCycles="5">
|
||||
<slave idx="0" type="EK1100"/>
|
||||
<slave idx="1" type="EL1008"/>
|
||||
<slave idx="2" type="EL2008"/>
|
||||
<slave idx="3" type="EL5101"/>
|
||||
<slave idx="4" type="generic" vid="00000a88" pid="0a880002" configPdos="true">
|
||||
<dcConf assignActivate="300" sync0Cycle="*1" sync0Shift="0"/>
|
||||
<sdoConfig idx="2000" subIdx="0"><sdoDataRaw data ="b8 0b"/></sdoConfig> <!-- Max motor current (3.0A) -->
|
||||
<sdoConfig idx="2003" subIdx="0"><sdoDataRaw data ="64 00"/></sdoConfig> <!-- Standby current percentage (100%) -->
|
||||
<sdoConfig idx="2011" subIdx="0"><sdoDataRaw data ="00 00"/></sdoConfig> <!-- Open loop -->
|
||||
<syncManager idx="2" dir="out">
|
||||
<pdo idx="1600">
|
||||
<pdoEntry idx="6040" subIdx="00" bitLen="16" halPin="cia-controlword" halType="u32"/>
|
||||
<pdoEntry idx="6060" subIdx="00" bitLen="8" halPin="opmode" halType="s32"/>
|
||||
<pdoEntry idx="607A" subIdx="00" bitLen="32" halPin="target-position" halType="s32"/>
|
||||
<pdoEntry idx="60FF" subIdx="00" bitLen="32" halPin="target-velocity" halType="s32"/>
|
||||
</pdo>
|
||||
</syncManager>
|
||||
<syncManager idx="3" dir="in">
|
||||
<pdo idx="1a00">
|
||||
<pdoEntry idx="6041" subIdx="00" bitLen="16" halPin="cia-statusword" halType="u32"/>
|
||||
<pdoEntry idx="6061" subIdx="00" bitLen="8" halPin="opmode-display" halType="s32"/>
|
||||
<pdoEntry idx="6064" subIdx="00" bitLen="32" halPin="actual-position" halType="s32"/>
|
||||
<pdoEntry idx="606C" subIdx="00" bitLen="32" halPin="actual-velocity" halType="s32"/>
|
||||
<pdoEntry idx="6077" subIdx="00" bitLen="32" halPin="actual-torque" halType="s32"/>
|
||||
</pdo>
|
||||
</syncManager>
|
||||
</slave>
|
||||
<slave idx="5" type="generic" vid="00000a88" pid="0a880002" configPdos="true">
|
||||
<dcConf assignActivate="300" sync0Cycle="*1" sync0Shift="0"/>
|
||||
<sdoConfig idx="2000" subIdx="0"><sdoDataRaw data ="68 10"/></sdoConfig> <!-- Max motor current (4.2A) -->
|
||||
<sdoConfig idx="2003" subIdx="0"><sdoDataRaw data ="64 00"/></sdoConfig> <!-- Standby current percentage (100%) -->
|
||||
<sdoConfig idx="2011" subIdx="0"><sdoDataRaw data ="00 00"/></sdoConfig> <!-- Open loop -->
|
||||
<syncManager idx="2" dir="out">
|
||||
<pdo idx="1600">
|
||||
<pdoEntry idx="6040" subIdx="00" bitLen="16" halPin="cia-controlword" halType="u32"/>
|
||||
<pdoEntry idx="6060" subIdx="00" bitLen="8" halPin="opmode" halType="s32"/>
|
||||
<pdoEntry idx="607A" subIdx="00" bitLen="32" halPin="target-position" halType="s32"/>
|
||||
<pdoEntry idx="60FF" subIdx="00" bitLen="32" halPin="target-velocity" halType="s32"/>
|
||||
</pdo>
|
||||
</syncManager>
|
||||
<syncManager idx="3" dir="in">
|
||||
<pdo idx="1a00">
|
||||
<pdoEntry idx="6041" subIdx="00" bitLen="16" halPin="cia-statusword" halType="u32"/>
|
||||
<pdoEntry idx="6061" subIdx="00" bitLen="8" halPin="opmode-display" halType="s32"/>
|
||||
<pdoEntry idx="6064" subIdx="00" bitLen="32" halPin="actual-position" halType="s32"/>
|
||||
<pdoEntry idx="606C" subIdx="00" bitLen="32" halPin="actual-velocity" halType="s32"/>
|
||||
<pdoEntry idx="6077" subIdx="00" bitLen="32" halPin="actual-torque" halType="s32"/>
|
||||
</pdo>
|
||||
</syncManager>
|
||||
</slave>
|
||||
<slave idx="6" type="generic" vid="00aaa" pid="000bbbccc" configPdos="true">
|
||||
<dcConf assignActivate="300" sync0Cycle="*1" sync0Shift="0"/>
|
||||
<syncManager idx="2" dir="out">
|
||||
<pdo idx="1600">
|
||||
<pdoEntry idx="7000" subIdx="00" bitLen="32" halPin="enc-pos-scale" halType="s32"/>
|
||||
</pdo>
|
||||
<pdo idx="1601">
|
||||
<pdoEntry idx="7001" subIdx="00" bitLen="32" halPin="enc-index-latch-enable" halType="u32"/>
|
||||
</pdo>
|
||||
</syncManager>
|
||||
<syncManager idx="3" dir="in">
|
||||
<pdo idx="1a00">
|
||||
<pdoEntry idx="6000" subIdx="00" bitLen="32" halPin="enc-position" halType="float-ieee"/>
|
||||
</pdo>
|
||||
<pdo idx="1a01">
|
||||
<pdoEntry idx="6001" subIdx="00" bitLen="32" halPin="enc-frequency" halType="float-ieee"/>
|
||||
</pdo>
|
||||
<pdo idx="1a02">
|
||||
<pdoEntry idx="6002" subIdx="00" bitLen="32" halPin="DiffT" halType="u32"/>
|
||||
</pdo>
|
||||
<pdo idx="1a03">
|
||||
<pdoEntry idx="6003" subIdx="00" bitLen="32" halPin="index-byte" halType="u32"/>
|
||||
</pdo>
|
||||
<pdo idx="1a04">
|
||||
<pdoEntry idx="6004" subIdx="00" bitLen="32" halPin="index-status" halType="u32"/>
|
||||
</pdo>
|
||||
</syncManager>
|
||||
</slave>
|
||||
</master>
|
||||
</masters>
|
||||
0
linuxcnc/sim.gmoccapy.lathe_configs/facing.ngc → Cards/EaserCAT-2000/linuxcnc/Turner.2ms/facing.ngc
Executable file → Normal file
0
linuxcnc/sim.gmoccapy.lathe_configs/facing.ngc → Cards/EaserCAT-2000/linuxcnc/Turner.2ms/facing.ngc
Executable file → Normal file
83
Cards/EaserCAT-2000/linuxcnc/Turner.2ms/gmoccapy_lathe.pref
Normal file
83
Cards/EaserCAT-2000/linuxcnc/Turner.2ms/gmoccapy_lathe.pref
Normal file
@@ -0,0 +1,83 @@
|
||||
[DEFAULT]
|
||||
dro_size = 28
|
||||
abs_color = #0000FF
|
||||
rel_color = #000000
|
||||
dtg_color = #FFFF00
|
||||
homed_color = #00FF00
|
||||
unhomed_color = #FF0000
|
||||
spindle_bar_min = 0.0
|
||||
spindle_bar_max = 6000.0
|
||||
unlock_code = 123
|
||||
view = y
|
||||
blockheight = 0.0
|
||||
spindle_start_rpm = 300.0
|
||||
scale_jog_vel = 140.4
|
||||
scale_spindle_override = 1
|
||||
scale_feed_override = 1
|
||||
scale_rapid_override = 1
|
||||
hide_turtle_jog_button = False
|
||||
turtle_jog_factor = 20
|
||||
open_file =
|
||||
screen1 = window
|
||||
x_pos = 40
|
||||
y_pos = 30
|
||||
width = 979
|
||||
height = 750
|
||||
gtk_theme = Follow System Theme
|
||||
audio_alert = /usr/share/sounds/freedesktop/stereo/dialog-warning.oga
|
||||
audio_error = /usr/share/sounds/freedesktop/stereo/dialog-error.oga
|
||||
grid_size = 1.0
|
||||
mouse_btn_mode = 4
|
||||
hide_cursor = False
|
||||
system_name_tool = Tool
|
||||
system_name_g5x = G5x
|
||||
system_name_rot = Rot
|
||||
system_name_g92 = G92
|
||||
system_name_g54 = G54
|
||||
system_name_g55 = G55
|
||||
system_name_g56 = G56
|
||||
system_name_g57 = G57
|
||||
system_name_g58 = G58
|
||||
system_name_g59 = G59
|
||||
system_name_g59.1 = G59.1
|
||||
system_name_g59.2 = G59.2
|
||||
system_name_g59.3 = G59.3
|
||||
jump_to_dir = /home/emcmesa
|
||||
show_keyboard_on_offset = False
|
||||
show_keyboard_on_tooledit = False
|
||||
show_keyboard_on_edit = False
|
||||
show_keyboard_on_mdi = False
|
||||
show_keyboard_on_file_selection = False
|
||||
x_pos_popup = 45.0
|
||||
y_pos_popup = 55
|
||||
width_popup = 250.0
|
||||
max_messages = 10
|
||||
message_font = sans 10
|
||||
use_frames = True
|
||||
reload_tool = True
|
||||
blockdel = False
|
||||
opstop = False
|
||||
enable_dro = False
|
||||
show_offsets = False
|
||||
show_dtg = False
|
||||
view_tool_path = True
|
||||
view_dimension = True
|
||||
run_from_line = no_run
|
||||
unlock_way = no
|
||||
show_preview_on_offset = False
|
||||
use_keyboard_shortcuts = True
|
||||
dro_digits = 3
|
||||
toggle_readout = True
|
||||
tool_in_spindle = 3
|
||||
diameter offset_axis_x = 0
|
||||
offset_axis_x = 0.0
|
||||
offset_axis_z = 0.0
|
||||
offset_axis_r = 50.0
|
||||
radius offset_axis_x = 0
|
||||
use_toolmeasurement = False
|
||||
kbd_height = 250
|
||||
icon_theme = None
|
||||
hide_tooltips = False
|
||||
hide_titlebar = False
|
||||
audio_enabled = True
|
||||
|
||||
0
linuxcnc/sim.gmoccapy.lathe_configs/gmoccapy_lathe_c.pref → Cards/EaserCAT-2000/linuxcnc/Turner.2ms/gmoccapy_lathe_c.pref
Executable file → Normal file
0
linuxcnc/sim.gmoccapy.lathe_configs/gmoccapy_lathe_c.pref → Cards/EaserCAT-2000/linuxcnc/Turner.2ms/gmoccapy_lathe_c.pref
Executable file → Normal file
0
linuxcnc/sim.gmoccapy.lathe_configs/gmoccapy_postgui.hal → Cards/EaserCAT-2000/linuxcnc/Turner.2ms/gmoccapy_postgui.hal
Executable file → Normal file
0
linuxcnc/sim.gmoccapy.lathe_configs/gmoccapy_postgui.hal → Cards/EaserCAT-2000/linuxcnc/Turner.2ms/gmoccapy_postgui.hal
Executable file → Normal file
0
linuxcnc/sim.gmoccapy.lathe_configs/grooving.ngc → Cards/EaserCAT-2000/linuxcnc/Turner.2ms/grooving.ngc
Executable file → Normal file
0
linuxcnc/sim.gmoccapy.lathe_configs/grooving.ngc → Cards/EaserCAT-2000/linuxcnc/Turner.2ms/grooving.ngc
Executable file → Normal file
22
Cards/EaserCAT-2000/linuxcnc/Turner.2ms/halshow.preferences
Normal file
22
Cards/EaserCAT-2000/linuxcnc/Turner.2ms/halshow.preferences
Normal file
@@ -0,0 +1,22 @@
|
||||
# Halshow settings
|
||||
# This file is generated automatically.
|
||||
wm geometry . 700x475+1121+46
|
||||
placeFrames 0.3
|
||||
set ::ratio 0.3
|
||||
set ::old_w_leftf 160
|
||||
set ::watchlist {
|
||||
pin+lcec.0.0.DiffT
|
||||
pin+lcec.0.0.D1
|
||||
pin+lcec.0.0.D2
|
||||
pin+lcec.0.0.D3
|
||||
pin+lcec.0.0.D4
|
||||
pin+lcec.0.0.commanded-position-2
|
||||
pin+lcec.0.0.actual-position-2
|
||||
}
|
||||
set ::workmode watchhal
|
||||
set ::watchInterval 100
|
||||
set ::col1_width 100
|
||||
set ::ffmts
|
||||
set ::ifmts
|
||||
set ::alwaysOnTop 0
|
||||
set ::autoSaveWatchlist 1
|
||||
159
Cards/EaserCAT-2000/linuxcnc/Turner.2ms/lathe.ini
Normal file
159
Cards/EaserCAT-2000/linuxcnc/Turner.2ms/lathe.ini
Normal file
@@ -0,0 +1,159 @@
|
||||
# EMC controller parameters for a simulated machine.
|
||||
# General note: Comments can either be preceded with a # or ; - either is
|
||||
# acceptable, although # is in keeping with most linux config files.
|
||||
|
||||
# General section -------------------------------------------------------------
|
||||
[EMC]
|
||||
VERSION = 1.1
|
||||
MACHINE = gmoccapy_lathe
|
||||
#DEBUG = 0x7FFFFFFF
|
||||
DEBUG = 0
|
||||
|
||||
# for details see nc_files/subroutines/maco_instructions.txt
|
||||
[DISPLAY]
|
||||
DISPLAY = gmoccapy
|
||||
LATHE = 1
|
||||
BACK_TOOL_LATHE = 0
|
||||
|
||||
# Cycle time, in milliseconds, that display will sleep between polls
|
||||
CYCLE_TIME = 100
|
||||
|
||||
# Highest value that will be allowed for feed override, 1.0 = 100%
|
||||
MAX_FEED_OVERRIDE = 1.5
|
||||
MAX_SPINDLE_OVERRIDE = 1.2
|
||||
MIN_SPINDLE_OVERRIDE = .5
|
||||
|
||||
# Prefix to be used
|
||||
PROGRAM_PREFIX = /home/debian/linuxcnc/nc_files
|
||||
|
||||
# Introductory graphic
|
||||
INTRO_GRAPHIC = linuxcnc.gif
|
||||
INTRO_TIME = 5
|
||||
|
||||
# list of selectable jog increments
|
||||
INCREMENTS = 1.000 mm, 0.100 mm, 0.010 mm, 0.001 mm
|
||||
|
||||
[FILTER]
|
||||
PROGRAM_EXTENSION = .png,.gif,.jpg Grayscale Depth Image
|
||||
PROGRAM_EXTENSION = .py Python Script
|
||||
png = image-to-gcode
|
||||
gif = image-to-gcode
|
||||
jpg = image-to-gcode
|
||||
py = python
|
||||
|
||||
# Task controller section -----------------------------------------------------
|
||||
[RS274NGC]
|
||||
RS274NGC_STARTUP_CODE = G18 G21 G40 G49 G54 G80 G90 G94 G8 M9 M5 G64 P0.005
|
||||
PARAMETER_FILE = sim.var
|
||||
SUBROUTINE_PATH = macros
|
||||
|
||||
# Motion control section ------------------------------------------------------
|
||||
[EMCMOT]
|
||||
EMCMOT = motmod
|
||||
COMM_TIMEOUT = 1.0
|
||||
BASE_PERIOD = 100000
|
||||
SERVO_PERIOD = 1000000
|
||||
|
||||
# Hardware Abstraction Layer section --------------------------------------------------
|
||||
[TASK]
|
||||
TASK = milltask
|
||||
CYCLE_TIME = 0.001
|
||||
|
||||
# Part program interpreter section --------------------------------------------
|
||||
[HAL]
|
||||
HALFILE = core_sim_lathe.hal
|
||||
HALFILE = spindle_sim.hal
|
||||
HALFILE = simulated_home_lathe.hal
|
||||
|
||||
# Single file that is executed after the GUI has started.
|
||||
POSTGUI_HALFILE = gmoccapy_postgui.hal
|
||||
|
||||
HALUI = halui
|
||||
|
||||
# Trajectory planner section --------------------------------------------------
|
||||
[HALUI]
|
||||
#No Content
|
||||
|
||||
[TRAJ]
|
||||
COORDINATES = X Z
|
||||
LINEAR_UNITS = mm
|
||||
ANGULAR_UNITS = degree
|
||||
DEFAULT_LINEAR_VELOCITY = 50
|
||||
MAX_LINEAR_VELOCITY = 234
|
||||
POSITION_FILE = position.txt
|
||||
#NO_FORCE_HOMING = 1
|
||||
|
||||
# First axis
|
||||
[EMCIO]
|
||||
EMCIO = io
|
||||
CYCLE_TIME = 0.100
|
||||
|
||||
# tool table file
|
||||
TOOL_TABLE = lathe.tbl
|
||||
|
||||
[KINS]
|
||||
KINEMATICS = trivkins coordinates=XZ
|
||||
JOINTS = 2
|
||||
|
||||
[AXIS_X]
|
||||
MIN_LIMIT = -50.0
|
||||
MAX_LIMIT = 200.0
|
||||
MAX_VELOCITY = 166
|
||||
MAX_ACCELERATION = 1500.0
|
||||
|
||||
[JOINT_0]
|
||||
TYPE = LINEAR
|
||||
MAX_VELOCITY = 166
|
||||
MAX_ACCELERATION = 1500.0
|
||||
BACKLASH = 0.000
|
||||
INPUT_SCALE = 4000
|
||||
OUTPUT_SCALE = 1.000
|
||||
MIN_LIMIT = -50.0
|
||||
MAX_LIMIT = 200.0
|
||||
FERROR = 0.050
|
||||
MIN_FERROR = 0.010
|
||||
HOME_OFFSET = 0.0
|
||||
HOME = 100
|
||||
HOME_SEARCH_VEL = 200.0
|
||||
HOME_LATCH_VEL = 20.0
|
||||
HOME_USE_INDEX = NO
|
||||
HOME_IGNORE_LIMITS = NO
|
||||
HOME_SEQUENCE = 1
|
||||
HOME_IS_SHARED = 1
|
||||
|
||||
# Third axis
|
||||
[AXIS_Z]
|
||||
MIN_LIMIT = -75.0
|
||||
MAX_LIMIT = 1000.0
|
||||
MAX_VELOCITY = 166
|
||||
MAX_ACCELERATION = 1500.0
|
||||
|
||||
[JOINT_1]
|
||||
TYPE = LINEAR
|
||||
MAX_VELOCITY = 166
|
||||
MAX_ACCELERATION = 1500.0
|
||||
BACKLASH = 0.000
|
||||
INPUT_SCALE = 4000
|
||||
OUTPUT_SCALE = 1.000
|
||||
MIN_LIMIT = -75.0
|
||||
MAX_LIMIT = 1000.0
|
||||
FERROR = 0.050
|
||||
MIN_FERROR = 0.010
|
||||
HOME_OFFSET = 1.0
|
||||
HOME = 250
|
||||
HOME_SEARCH_VEL = 200.0
|
||||
HOME_LATCH_VEL = 20.0
|
||||
HOME_USE_INDEX = NO
|
||||
HOME_IGNORE_LIMITS = NO
|
||||
HOME_SEQUENCE = 0
|
||||
HOME_IS_SHARED = 1
|
||||
|
||||
# section for main IO controller parameters -----------------------------------
|
||||
[MACROS]
|
||||
MACRO = i_am_lost
|
||||
MACRO = halo_world
|
||||
MACRO = jog_around
|
||||
MACRO = increment xinc yinc
|
||||
MACRO = go_to_position X-pos Y-pos Z-pos
|
||||
|
||||
|
||||
0
linuxcnc/sim.gmoccapy.lathe_configs/lathe.pref → Cards/EaserCAT-2000/linuxcnc/Turner.2ms/lathe.pref
Executable file → Normal file
0
linuxcnc/sim.gmoccapy.lathe_configs/lathe.pref → Cards/EaserCAT-2000/linuxcnc/Turner.2ms/lathe.pref
Executable file → Normal file
0
linuxcnc/sim.gmoccapy.lathe_configs/lathe.tbl → Cards/EaserCAT-2000/linuxcnc/Turner.2ms/lathe.tbl
Executable file → Normal file
0
linuxcnc/sim.gmoccapy.lathe_configs/lathe.tbl → Cards/EaserCAT-2000/linuxcnc/Turner.2ms/lathe.tbl
Executable file → Normal file
0
linuxcnc/sim.gmoccapy.lathe_configs/lathe_C.ini → Cards/EaserCAT-2000/linuxcnc/Turner.2ms/lathe_C.ini
Executable file → Normal file
0
linuxcnc/sim.gmoccapy.lathe_configs/lathe_C.ini → Cards/EaserCAT-2000/linuxcnc/Turner.2ms/lathe_C.ini
Executable file → Normal file
0
linuxcnc/sim.gmoccapy.lathe_configs/lathe_CW.ini → Cards/EaserCAT-2000/linuxcnc/Turner.2ms/lathe_CW.ini
Executable file → Normal file
0
linuxcnc/sim.gmoccapy.lathe_configs/lathe_CW.ini → Cards/EaserCAT-2000/linuxcnc/Turner.2ms/lathe_CW.ini
Executable file → Normal file
0
linuxcnc/sim.gmoccapy.lathe_configs/lathe_backtool.ini → Cards/EaserCAT-2000/linuxcnc/Turner.2ms/lathe_backtool.ini
Executable file → Normal file
0
linuxcnc/sim.gmoccapy.lathe_configs/lathe_backtool.ini → Cards/EaserCAT-2000/linuxcnc/Turner.2ms/lathe_backtool.ini
Executable file → Normal file
0
linuxcnc/sim.gmoccapy.lathe_configs/lathe_c.pref → Cards/EaserCAT-2000/linuxcnc/Turner.2ms/lathe_c.pref
Executable file → Normal file
0
linuxcnc/sim.gmoccapy.lathe_configs/lathe_c.pref → Cards/EaserCAT-2000/linuxcnc/Turner.2ms/lathe_c.pref
Executable file → Normal file
0
linuxcnc/sim.gmoccapy.lathe_configs/lathe_cw.pref → Cards/EaserCAT-2000/linuxcnc/Turner.2ms/lathe_cw.pref
Executable file → Normal file
0
linuxcnc/sim.gmoccapy.lathe_configs/lathe_cw.pref → Cards/EaserCAT-2000/linuxcnc/Turner.2ms/lathe_cw.pref
Executable file → Normal file
0
linuxcnc/sim.gmoccapy.lathe_configs/lathe_imperial.ini → Cards/EaserCAT-2000/linuxcnc/Turner.2ms/lathe_imperial.ini
Executable file → Normal file
0
linuxcnc/sim.gmoccapy.lathe_configs/lathe_imperial.ini → Cards/EaserCAT-2000/linuxcnc/Turner.2ms/lathe_imperial.ini
Executable file → Normal file
0
linuxcnc/sim.gmoccapy.lathe_configs/lathe_imperial.pref → Cards/EaserCAT-2000/linuxcnc/Turner.2ms/lathe_imperial.pref
Executable file → Normal file
0
linuxcnc/sim.gmoccapy.lathe_configs/lathe_imperial.pref → Cards/EaserCAT-2000/linuxcnc/Turner.2ms/lathe_imperial.pref
Executable file → Normal file
0
linuxcnc/sim.gmoccapy.lathe_configs/lathe_macros.ini → Cards/EaserCAT-2000/linuxcnc/Turner.2ms/lathe_macros.ini
Executable file → Normal file
0
linuxcnc/sim.gmoccapy.lathe_configs/lathe_macros.ini → Cards/EaserCAT-2000/linuxcnc/Turner.2ms/lathe_macros.ini
Executable file → Normal file
0
linuxcnc/sim.gmoccapy.lathe_configs/lathemacro.ui → Cards/EaserCAT-2000/linuxcnc/Turner.2ms/lathemacro.ui
Executable file → Normal file
0
linuxcnc/sim.gmoccapy.lathe_configs/lathemacro.ui → Cards/EaserCAT-2000/linuxcnc/Turner.2ms/lathemacro.ui
Executable file → Normal file
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user