Commit 6baefd2f authored by mattdr's avatar mattdr
Browse files

This code is working on the 35 teensy and the motor is spinning decently on sin control

parent e3477d23
{
"terminal.integrated.env.windows": {
"PATH": "C:\\Users\\Matt\\.platformio\\penv\\Scripts;C:\\Users\\Matt\\.platformio\\penv;C:\\Program Files\\Dell\\DW WLAN Card;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;c:\\Program Files\\WIDCOMM\\Bluetooth Software\\;c:\\Program Files\\WIDCOMM\\Bluetooth Software\\syswow64;C:\\WINDOWS\\system32\\config\\systemprofile\\.dnx\\bin;C:\\Program Files\\Microsoft DNX\\Dnvm\\;C:\\Program Files (x86)\\Windows Kits\\8.1\\Windows Performance Toolkit\\;C:\\Program Files\\Microsoft SQL Server\\130\\Tools\\Binn\\;C:\\Program Files\\PuTTY\\;C:\\Program Files (x86)\\Xoreax\\IncrediBuild;C:\\Program Files\\MATLAB\\R2017b\\runtime\\win64;C:\\Program Files\\MATLAB\\R2017b\\bin;C:\\WINDOWS\\System32\\OpenSSH\\;C:\\Program Files\\Git\\cmd;C:\\Program Files\\Git\\mingw64\\bin;C:\\Program Files\\Git\\usr\\bin;C:\\Program Files (x86)\\Microsoft VS Code\\bin;C:\\Users\\Matt\\Anaconda3;C:\\Users\\Matt\\Anaconda3\\Library\\mingw-w64\\bin;C:\\Users\\Matt\\Anaconda3\\Library\\usr\\bin;C:\\Users\\Matt\\Anaconda3\\Library\\bin;C:\\Users\\Matt\\Anaconda3\\Scripts;C:\\Users\\Matt\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Program Files (x86)\\Microsoft VS Code\\bin;C:\\Users\\Matt\\AppData\\Local\\Programs\\Microsoft VS Code\\bin;C:\\Program Files\\Dell\\DW WLAN Card;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;c:\\Program Files\\WIDCOMM\\Bluetooth Software\\;c:\\Program Files\\WIDCOMM\\Bluetooth Software\\syswow64;C:\\WINDOWS\\system32\\config\\systemprofile\\.dnx\\bin;C:\\Program Files\\Microsoft DNX\\Dnvm\\;C:\\Program Files (x86)\\Windows Kits\\8.1\\Windows Performance Toolkit\\;C:\\Program Files\\Microsoft SQL Server\\130\\Tools\\Binn\\;C:\\Program Files\\PuTTY\\;C:\\Program Files (x86)\\Xoreax\\IncrediBuild;C:\\Program Files\\MATLAB\\R2017b\\runtime\\win64;C:\\Program Files\\MATLAB\\R2017b\\bin;C:\\WINDOWS\\System32\\OpenSSH\\;C:\\Program Files\\Git\\cmd;C:\\Program Files\\Git\\mingw64\\bin;C:\\Program Files\\Git\\usr\\bin;C:\\Program Files (x86)\\Microsoft VS Code\\bin;C:\\Users\\Matt\\Anaconda3;C:\\Users\\Matt\\Anaconda3\\Library\\mingw-w64\\bin;C:\\Users\\Matt\\Anaconda3\\Library\\usr\\bin;C:\\Users\\Matt\\Anaconda3\\Library\\bin;C:\\Users\\Matt\\Anaconda3\\Scripts;C:\\Users\\Matt\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Program Files (x86)\\Microsoft VS Code\\bin;C:\\Users\\Matt\\AppData\\Local\\Programs\\Microsoft VS Code\\bin",
"PLATFORMIO_CALLER": "vscode"
}
}
\ No newline at end of file
......@@ -20,7 +20,7 @@ int Zoffset = 0;
// This is the difference in encoder tics from the Z index to
// the electrical encoder zero (which is found by powering the
// AB block and waiting for the motor to settle)
int hard_coded_offset = 5101;
int hard_coded_offset = -1041;
// how long in microsec (us) to delay between phases while calibrating
// the wheel
......
......@@ -22,7 +22,8 @@ O TO START OPEN LOOP CONTROL\n\
L TO LOCATE STATE POSITIONS\n\
D TO START DIRECT POSITION CONTROL\n\
B TO START BUTT CONTROL (NON-OPTIMIZED)\n\
S TO START BUTT CONTROL (OPTIMIZED)\n");
S TO START BUTT CONTROL (OPTIMIZED)\n\n\
Y TO DEBUG LOW STATE BY STATE\n");
short incomingByte = 0;
while(1)
......@@ -66,6 +67,11 @@ S TO START BUTT CONTROL (OPTIMIZED)\n");
charge_bootstrap_capacitors();
motor_butt_control_precalculated();
}
else if (incomingByte == 'y') // 'y'
{
debug_low_state_by_state();
}
}
charge_bootstrap_capacitors();
......@@ -78,6 +84,7 @@ S TO START BUTT CONTROL (OPTIMIZED)\n");
}
}
Serial.println("CALIBRATION COMPLETE");
return;
}
......
......@@ -17,10 +17,10 @@
const int led = LED_BUILTIN;
// This scale factor scales the potentiometer
int const SCALE_FACTOR = 20;
int const SCALE_FACTOR = 50;
// This is the PWM frequency and it is very important
int FREQ = 8000; //8000;
int FREQ = 48000; //8000;
// This is the lower limit of PWM frequency
// its important for not breaking gate drivers
......
......@@ -102,4 +102,29 @@ void locate_state_positions(void)
while(1)
{
}
}
void debug_low_state_by_state(void)
{
Serial.println("lets run some debug tests");
Serial.println("Hit space to call turn_all_off()");
block_until_spacebar();
turn_all_off();
Serial.println("Hit space to call setphase(0,0,0,0,0,0)");
block_until_spacebar();
set_phase(0,0,0,0,0,0);
Serial.println("Hit space to call setphase(0,0,0,1,0,0)");
block_until_spacebar();
set_phase(0,0,0,1,0,0);
Serial.println("Hit space to call setphase(0,0,0,0,1,0)");
block_until_spacebar();
set_phase(0,0,0,0,1,0);
Serial.println("Hit space to call setphase(0,0,0,0,0,1)");
block_until_spacebar();
set_phase(0,0,0,0,0,1);
Serial.println("Hit space to call setphase(0,0,0,1,1,1)");
block_until_spacebar();
set_phase(0,0,0,1,1,1);
Serial.println("Thats all i got restart board!!!");
while(1){}
}
\ No newline at end of file
......@@ -7,6 +7,7 @@ int get_pot_1_inv(void);
int get_pot_0_scaled(int scaleFactor, float period_over_255);
void locate_state_positions(void);
void direct_position_control(void);
void debug_low_state_by_state(void);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment