Testprogram for TMC2209-Library. Uses Speed-Control via VACTUAL instead of Step/Dir
Dependencies: TMCStepper mRotaryEncoder-os
Revision 7:51cb60bf3e2d, committed 2021-03-22
- Comitter:
- charly
- Date:
- Mon Mar 22 21:38:03 2021 +0000
- Parent:
- 6:6ad7bc10ac20
- Child:
- 8:f44d70665051
- Commit message:
- push()
Changed in this revision
| TMCStepper.lib | Show annotated file Show diff for this revision Revisions of this file |
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/TMCStepper.lib Mon Mar 22 17:46:39 2021 +0000 +++ b/TMCStepper.lib Mon Mar 22 21:38:03 2021 +0000 @@ -1,1 +1,1 @@ -https://os.mbed.com/users/charly/code/TMCStepper/#f4343071c8b1 +https://os.mbed.com/users/charly/code/TMCStepper/#5ba0c258c4ed
--- a/main.cpp Mon Mar 22 17:46:39 2021 +0000
+++ b/main.cpp Mon Mar 22 21:38:03 2021 +0000
@@ -93,12 +93,13 @@
ledCW = 1;
ledCCW = 1;
- diag.rise(&trigger_diag);
// Initialize Stepper
printf("connecting to TMC-Module...\r\n");
stepper.begin(); // UART: Init SW UART (if selected) with default baudrate
printf("TMC-Version: %02X\r\n",stepper.version());
+ stepper.push(); // initialize all registers??? required?
+
stepper.toff(3); // Enables driver in software - 3, 5 ????
stepper.rms_current(RMSCURRENT); // Set motor RMS current in mA / min 500 for 24V/speed:3000
// 1110, 800
@@ -117,6 +118,8 @@
uint32_t ioin = stepper.IOIN();
printf("IOIN(): "); printBits(sizeof(ioin),&ioin);printf("\r\n");
+ diag.rise(&trigger_diag);
+
//bool shaft = false; //direction CW or CCW
while(1) {
@@ -212,6 +215,13 @@
thisGet = wheel.Get();
stepper.VACTUAL(thisGet*100*MICROSTEPS);// Set Speed to value
printf("actspeed: %i\r\n",thisGet*100);
+
+ gstat = stepper.GSTAT();
+ printf("GSTAT(): "); printBits(sizeof(gstat),&gstat);printf("\r\n");
+ status = stepper.DRV_STATUS();
+ printf("DRV_STATUS(): "); printBits(sizeof(status),&status);printf("\r\n");
+ ioin = stepper.IOIN();
+ printf("IOIN(): "); printBits(sizeof(ioin),&ioin);printf("\r\n");
}
// anything changed?