Yeah, i have installed all library
C:\Users\Endrit\Documents\Arduino\sketch_jan25a\sketch_jan25a.ino:10:46: error: ‘UH’ was not declared in this scope
TMC6200Driver6PWM driver = TMC6200Driver6PWM(UH, UL, VH, VL, WH, WL, nCS, DRV_EN);
^~
C:\Users\Endrit\Documents\Arduino\sketch_jan25a\sketch_jan25a.ino:10:46: note: suggested alternative: ‘ZH’
TMC6200Driver6PWM driver = TMC6200Driver6PWM(UH, UL, VH, VL, WH, WL, nCS, DRV_EN);
^~
ZH
C:\Users\Endrit\Documents\Arduino\sketch_jan25a\sketch_jan25a.ino:10:50: error: ‘UL’ was not declared in this scope
TMC6200Driver6PWM driver = TMC6200Driver6PWM(UH, UL, VH, VL, WH, WL, nCS, DRV_EN);
^~
C:\Users\Endrit\Documents\Arduino\sketch_jan25a\sketch_jan25a.ino:10:50: note: suggested alternative: ‘YL’
TMC6200Driver6PWM driver = TMC6200Driver6PWM(UH, UL, VH, VL, WH, WL, nCS, DRV_EN);
^~
YL
C:\Users\Endrit\Documents\Arduino\sketch_jan25a\sketch_jan25a.ino:10:54: error: ‘VH’ was not declared in this scope
TMC6200Driver6PWM driver = TMC6200Driver6PWM(UH, UL, VH, VL, WH, WL, nCS, DRV_EN);
^~
C:\Users\Endrit\Documents\Arduino\sketch_jan25a\sketch_jan25a.ino:10:54: note: suggested alternative: ‘ZH’
TMC6200Driver6PWM driver = TMC6200Driver6PWM(UH, UL, VH, VL, WH, WL, nCS, DRV_EN);
^~
ZH
C:\Users\Endrit\Documents\Arduino\sketch_jan25a\sketch_jan25a.ino:10:58: error: ‘VL’ was not declared in this scope
TMC6200Driver6PWM driver = TMC6200Driver6PWM(UH, UL, VH, VL, WH, WL, nCS, DRV_EN);
^~
C:\Users\Endrit\Documents\Arduino\sketch_jan25a\sketch_jan25a.ino:10:58: note: suggested alternative: ‘YL’
TMC6200Driver6PWM driver = TMC6200Driver6PWM(UH, UL, VH, VL, WH, WL, nCS, DRV_EN);
^~
YL
C:\Users\Endrit\Documents\Arduino\sketch_jan25a\sketch_jan25a.ino:10:62: error: ‘WH’ was not declared in this scope
TMC6200Driver6PWM driver = TMC6200Driver6PWM(UH, UL, VH, VL, WH, WL, nCS, DRV_EN);
^~
C:\Users\Endrit\Documents\Arduino\sketch_jan25a\sketch_jan25a.ino:10:62: note: suggested alternative: ‘ZH’
TMC6200Driver6PWM driver = TMC6200Driver6PWM(UH, UL, VH, VL, WH, WL, nCS, DRV_EN);
^~
ZH
C:\Users\Endrit\Documents\Arduino\sketch_jan25a\sketch_jan25a.ino:10:66: error: ‘WL’ was not declared in this scope
TMC6200Driver6PWM driver = TMC6200Driver6PWM(UH, UL, VH, VL, WH, WL, nCS, DRV_EN);
^~
C:\Users\Endrit\Documents\Arduino\sketch_jan25a\sketch_jan25a.ino:10:66: note: suggested alternative: ‘YL’
TMC6200Driver6PWM driver = TMC6200Driver6PWM(UH, UL, VH, VL, WH, WL, nCS, DRV_EN);
^~
YL
C:\Users\Endrit\Documents\Arduino\sketch_jan25a\sketch_jan25a.ino:10:70: error: ‘nCS’ was not declared in this scope
TMC6200Driver6PWM driver = TMC6200Driver6PWM(UH, UL, VH, VL, WH, WL, nCS, DRV_EN);
^~~
C:\Users\Endrit\Documents\Arduino\sketch_jan25a\sketch_jan25a.ino:10:75: error: ‘DRV_EN’ was not declared in this scope
TMC6200Driver6PWM driver = TMC6200Driver6PWM(UH, UL, VH, VL, WH, WL, nCS, DRV_EN);
^~~~~~
C:\Users\Endrit\Documents\Arduino\sketch_jan25a\sketch_jan25a.ino: In function ‘void setup()’:
C:\Users\Endrit\Documents\Arduino\sketch_jan25a\sketch_jan25a.ino:18:13: error: ‘UL’ was not declared in this scope
pinMode(UL, OUTPUT);
^~
C:\Users\Endrit\Documents\Arduino\sketch_jan25a\sketch_jan25a.ino:18:13: note: suggested alternative: ‘YL’
pinMode(UL, OUTPUT);
^~
YL
C:\Users\Endrit\Documents\Arduino\sketch_jan25a\sketch_jan25a.ino:19:13: error: ‘VL’ was not declared in this scope
pinMode(VL, OUTPUT);
^~
C:\Users\Endrit\Documents\Arduino\sketch_jan25a\sketch_jan25a.ino:19:13: note: suggested alternative: ‘YL’
pinMode(VL, OUTPUT);
^~
YL
C:\Users\Endrit\Documents\Arduino\sketch_jan25a\sketch_jan25a.ino:20:13: error: ‘WL’ was not declared in this scope
pinMode(WL, OUTPUT);
^~
C:\Users\Endrit\Documents\Arduino\sketch_jan25a\sketch_jan25a.ino:20:13: note: suggested alternative: ‘YL’
pinMode(WL, OUTPUT);
^~
YL
In file included from C:\Users\Endrit\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino/Arduino.h:258:0,
from C:\Users\Endrit\Documents\Arduino\sketch_jan25a\sketch_jan25a.ino:1:
C:\Users\Endrit\Documents\Arduino\sketch_jan25a\sketch_jan25a.ino:46:43: error: ‘FAULT’ was not declared in this scope
attachInterrupt(digitalPinToInterrupt(FAULT), handleFault, RISING);
^
C:\Users\Endrit\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\variants\standard/pins_arduino.h:79:37: note: in definition of macro ‘digitalPinToInterrupt’
#define digitalPinToInterrupt(p) ((p) == 2 ? 0 : ((p) == 3 ? 1 : NOT_AN_INTERRUPT))
^
C:\Users\Endrit\Documents\Arduino\sketch_jan25a\sketch_jan25a.ino:46:43: note: suggested alternative: ‘DEFAULT’
attachInterrupt(digitalPinToInterrupt(FAULT), handleFault, RISING);
^
C:\Users\Endrit\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\variants\standard/pins_arduino.h:79:37: note: in definition of macro ‘digitalPinToInterrupt’
#define digitalPinToInterrupt(p) ((p) == 2 ? 0 : ((p) == 3 ? 1 : NOT_AN_INTERRUPT))
^
C:\Users\Endrit\Documents\Arduino\sketch_jan25a\sketch_jan25a.ino: In function ‘void handleFault()’:
C:\Users\Endrit\Documents\Arduino\sketch_jan25a\sketch_jan25a.ino:63:18: error: ‘DRV_EN’ was not declared in this scope
digitalWrite(DRV_EN, LOW);
^~~~~~
exit status 1
Compilation error: ‘UH’ was not declared in this scope
these are errors.
And here is my code
#include "Arduino.h"
#include <SimpleFOC.h>
#include "SimpleFOCDrivers.h"
#include "drivers/tmc6200/TMC6200.hpp"
// Motor instance
BLDCMotor motor = BLDCMotor(15);
// TMC6200 driver instance
TMC6200Driver6PWM driver = TMC6200Driver6PWM(UH, UL, VH, VL, WH, WL, nCS, DRV_EN);
void setup() {
// Initialize motor
motor.linkDriver(&driver);
motor.controller = MotionControlType::velocity_openloop;
// Set up pins for 6-PWM control
pinMode(UL, OUTPUT);
pinMode(VL, OUTPUT);
pinMode(WL, OUTPUT);
digitalWrite(WL, HIGH);
digitalWrite(UL, HIGH);
digitalWrite(VL, HIGH);
// Initialize SimpleFOC
motor.init();
// Set velocity setpoint
motor.target = 2.0; // RPM
// Align sensor and start FOC
motor.initFOC();
// Set driver options
driver.setCurrentSenseGain(TMC6200_AmplificationGain::_5);
driver.setCurrentSenseAmplifierState(true); // Ensure current sensing is on
driver.setDriverStrength(TMC6200_DRVStrength::Strong);
// Validate SPI connection
if(driver.getInputs().VERSION != TMC6200_VERSION) {
// Something is wrong with the SPI connection
Serial.println("SPI connection issue");
}
// Attach fault interrupt
attachInterrupt(digitalPinToInterrupt(FAULT), handleFault, RISING);
}
void loop() {
// Execute control loop
motor.loopFOC();
}
void handleFault() {
// Handle faults here
TMC6200GStatus status = driver.getStatus();
// Print fault status
Serial.println("Fault detected:");
Serial.print("U shorted: "); Serial.println(status.hasUShorted());
Serial.print("V shorted: "); Serial.println(status.hasVShorted());
Serial.print("W shorted: "); Serial.println(status.hasWShorted());
// Clear fault by cycling DRV_EN
digitalWrite(DRV_EN, LOW);
delayMicroseconds(100);
digitalWrite(DRV_EN, HIGH);
}