![](/media/cache/profiles/15ae3b9d6286f1b2a489ea4f3f4abaed.50x50_q85.jpg)
Testprogram for TMC2209-Library. Uses Speed-Control via VACTUAL instead of Step/Dir
Dependencies: TMCStepper mRotaryEncoder-os
Diff: main.cpp
- Revision:
- 7:51cb60bf3e2d
- Parent:
- 6:6ad7bc10ac20
- Child:
- 8:f44d70665051
--- 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?