jcchurch13 / mechaduino-firmware Goto Github PK
View Code? Open in Web Editor NEWHardware available here:
Home Page: http://tropical-labs.com
License: Other
Hardware available here:
Home Page: http://tropical-labs.com
License: Other
Hello there,
I made a test implementation of anticogging. Here is a video. It is especially noticeable for fine control in velocity and torque mode.
The calibration is done in python for now. It should be migrated to the firmware, similarly to the encoder calibration.
The calibration is longer, as it requires finer steps. It should be done if forward and reverse direction, and averaged, as there is a constant friction term. The blue line is a calibration pass in both directions.
Changes to mechaduino:
https://github.com/charles-blouin/Mechaduino-Firmware/commits/cogging
Calibration code
https://gitlab.com/charles-blouin/pendulum-ml/-/tree/master/anticogging_calibration
You can run 'measure-torque-ripple' followed by interpolate_360
Just cloned the latest version and trying to upload to my Mechaduino and getting an invalid type argument of '->' (have 'uint16_t')
error.
Arduino: 1.8.1 (Mac OS X), Board: "Arduino/Genuino Uno"
/Applications/Arduino.app/Contents/Java/arduino-builder -dump-prefs -logger=machine -hardware /Applications/Arduino.app/Contents/Java/hardware -hardware /Users/allen/Library/Arduino15/packages -hardware /Users/allen/Documents/Arduino/hardware -tools /Applications/Arduino.app/Contents/Java/tools-builder -tools /Applications/Arduino.app/Contents/Java/hardware/tools/avr -tools /Users/allen/Library/Arduino15/packages -built-in-libraries /Applications/Arduino.app/Contents/Java/libraries -libraries /Users/allen/Documents/Arduino/libraries -fqbn=arduino:avr:uno -ide-version=10801 -build-path /var/folders/_y/wxctgwss5zv1fq27s5hw50zr0000gn/T/arduino_build_11632 -warnings=all -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avrdude.path=/Users/allen/Library/Arduino15/packages/arduino/tools/avrdude/6.0.1-arduino5 -prefs=runtime.tools.avr-gcc.path=/Applications/Arduino.app/Contents/Java/hardware/tools/avr -verbose /Users/allen/code/Mechaduino-Firmware/Mechaduino_01/Mechaduino_01/Mechaduino_01.ino
/Applications/Arduino.app/Contents/Java/arduino-builder -compile -logger=machine -hardware /Applications/Arduino.app/Contents/Java/hardware -hardware /Users/allen/Library/Arduino15/packages -hardware /Users/allen/Documents/Arduino/hardware -tools /Applications/Arduino.app/Contents/Java/tools-builder -tools /Applications/Arduino.app/Contents/Java/hardware/tools/avr -tools /Users/allen/Library/Arduino15/packages -built-in-libraries /Applications/Arduino.app/Contents/Java/libraries -libraries /Users/allen/Documents/Arduino/libraries -fqbn=arduino:avr:uno -ide-version=10801 -build-path /var/folders/_y/wxctgwss5zv1fq27s5hw50zr0000gn/T/arduino_build_11632 -warnings=all -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avrdude.path=/Users/allen/Library/Arduino15/packages/arduino/tools/avrdude/6.0.1-arduino5 -prefs=runtime.tools.avr-gcc.path=/Applications/Arduino.app/Contents/Java/hardware/tools/avr -verbose /Users/allen/code/Mechaduino-Firmware/Mechaduino_01/Mechaduino_01/Mechaduino_01.ino
Using board 'uno' from platform in folder: /Users/allen/Library/Arduino15/packages/arduino/hardware/avr/1.6.13
Using core 'arduino' from platform in folder: /Users/allen/Library/Arduino15/packages/arduino/hardware/avr/1.6.13
Build options changed, rebuilding all
Detecting libraries used...
"/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10801 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-I/Users/allen/Library/Arduino15/packages/arduino/hardware/avr/1.6.13/cores/arduino" "-I/Users/allen/Library/Arduino15/packages/arduino/hardware/avr/1.6.13/variants/standard" "/var/folders/_y/wxctgwss5zv1fq27s5hw50zr0000gn/T/arduino_build_11632/sketch/Mechaduino_01.ino.cpp" -o "/dev/null"
"/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10801 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-I/Users/allen/Library/Arduino15/packages/arduino/hardware/avr/1.6.13/cores/arduino" "-I/Users/allen/Library/Arduino15/packages/arduino/hardware/avr/1.6.13/variants/standard" "/var/folders/_y/wxctgwss5zv1fq27s5hw50zr0000gn/T/arduino_build_11632/sketch/Controller.cpp" -o "/dev/null"
"/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10801 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-I/Users/allen/Library/Arduino15/packages/arduino/hardware/avr/1.6.13/cores/arduino" "-I/Users/allen/Library/Arduino15/packages/arduino/hardware/avr/1.6.13/variants/standard" "-I/Users/allen/Library/Arduino15/packages/arduino/hardware/avr/1.6.13/libraries/SPI/src" "/var/folders/_y/wxctgwss5zv1fq27s5hw50zr0000gn/T/arduino_build_11632/sketch/Controller.cpp" -o "/dev/null"
"/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10801 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-I/Users/allen/Library/Arduino15/packages/arduino/hardware/avr/1.6.13/cores/arduino" "-I/Users/allen/Library/Arduino15/packages/arduino/hardware/avr/1.6.13/variants/standard" "-I/Users/allen/Library/Arduino15/packages/arduino/hardware/avr/1.6.13/libraries/SPI/src" "/var/folders/_y/wxctgwss5zv1fq27s5hw50zr0000gn/T/arduino_build_11632/sketch/Parameters.cpp" -o "/dev/null"
"/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10801 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-I/Users/allen/Library/Arduino15/packages/arduino/hardware/avr/1.6.13/cores/arduino" "-I/Users/allen/Library/Arduino15/packages/arduino/hardware/avr/1.6.13/variants/standard" "-I/Users/allen/Library/Arduino15/packages/arduino/hardware/avr/1.6.13/libraries/SPI/src" "-I/Users/allen/Library/Arduino15/packages/arduino/hardware/avr/1.6.13/libraries/Wire/src" "/var/folders/_y/wxctgwss5zv1fq27s5hw50zr0000gn/T/arduino_build_11632/sketch/Parameters.cpp" -o "/dev/null"
"/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10801 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-I/Users/allen/Library/Arduino15/packages/arduino/hardware/avr/1.6.13/cores/arduino" "-I/Users/allen/Library/Arduino15/packages/arduino/hardware/avr/1.6.13/variants/standard" "-I/Users/allen/Library/Arduino15/packages/arduino/hardware/avr/1.6.13/libraries/SPI/src" "-I/Users/allen/Library/Arduino15/packages/arduino/hardware/avr/1.6.13/libraries/Wire/src" "/var/folders/_y/wxctgwss5zv1fq27s5hw50zr0000gn/T/arduino_build_11632/sketch/State.cpp" -o "/dev/null"
"/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10801 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-I/Users/allen/Library/Arduino15/packages/arduino/hardware/avr/1.6.13/cores/arduino" "-I/Users/allen/Library/Arduino15/packages/arduino/hardware/avr/1.6.13/variants/standard" "-I/Users/allen/Library/Arduino15/packages/arduino/hardware/avr/1.6.13/libraries/SPI/src" "-I/Users/allen/Library/Arduino15/packages/arduino/hardware/avr/1.6.13/libraries/Wire/src" "/var/folders/_y/wxctgwss5zv1fq27s5hw50zr0000gn/T/arduino_build_11632/sketch/Utils.cpp" -o "/dev/null"
"/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10801 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-I/Users/allen/Library/Arduino15/packages/arduino/hardware/avr/1.6.13/cores/arduino" "-I/Users/allen/Library/Arduino15/packages/arduino/hardware/avr/1.6.13/variants/standard" "-I/Users/allen/Library/Arduino15/packages/arduino/hardware/avr/1.6.13/libraries/SPI/src" "-I/Users/allen/Library/Arduino15/packages/arduino/hardware/avr/1.6.13/libraries/Wire/src" "/var/folders/_y/wxctgwss5zv1fq27s5hw50zr0000gn/T/arduino_build_11632/sketch/analogFastWrite.c" -o "/dev/null"
"/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10801 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-I/Users/allen/Library/Arduino15/packages/arduino/hardware/avr/1.6.13/cores/arduino" "-I/Users/allen/Library/Arduino15/packages/arduino/hardware/avr/1.6.13/variants/standard" "-I/Users/allen/Library/Arduino15/packages/arduino/hardware/avr/1.6.13/libraries/SPI/src" "-I/Users/allen/Library/Arduino15/packages/arduino/hardware/avr/1.6.13/libraries/Wire/src" "/Users/allen/Library/Arduino15/packages/arduino/hardware/avr/1.6.13/libraries/SPI/src/SPI.cpp" -o "/dev/null"
"/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10801 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-I/Users/allen/Library/Arduino15/packages/arduino/hardware/avr/1.6.13/cores/arduino" "-I/Users/allen/Library/Arduino15/packages/arduino/hardware/avr/1.6.13/variants/standard" "-I/Users/allen/Library/Arduino15/packages/arduino/hardware/avr/1.6.13/libraries/SPI/src" "-I/Users/allen/Library/Arduino15/packages/arduino/hardware/avr/1.6.13/libraries/Wire/src" "/Users/allen/Library/Arduino15/packages/arduino/hardware/avr/1.6.13/libraries/Wire/src/Wire.cpp" -o "/dev/null"
"/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10801 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-I/Users/allen/Library/Arduino15/packages/arduino/hardware/avr/1.6.13/cores/arduino" "-I/Users/allen/Library/Arduino15/packages/arduino/hardware/avr/1.6.13/variants/standard" "-I/Users/allen/Library/Arduino15/packages/arduino/hardware/avr/1.6.13/libraries/SPI/src" "-I/Users/allen/Library/Arduino15/packages/arduino/hardware/avr/1.6.13/libraries/Wire/src" "/Users/allen/Library/Arduino15/packages/arduino/hardware/avr/1.6.13/libraries/Wire/src/utility/twi.c" -o "/dev/null"
Generating function prototypes...
"/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10801 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-I/Users/allen/Library/Arduino15/packages/arduino/hardware/avr/1.6.13/cores/arduino" "-I/Users/allen/Library/Arduino15/packages/arduino/hardware/avr/1.6.13/variants/standard" "-I/Users/allen/Library/Arduino15/packages/arduino/hardware/avr/1.6.13/libraries/SPI/src" "-I/Users/allen/Library/Arduino15/packages/arduino/hardware/avr/1.6.13/libraries/Wire/src" "/var/folders/_y/wxctgwss5zv1fq27s5hw50zr0000gn/T/arduino_build_11632/sketch/Mechaduino_01.ino.cpp" -o "/var/folders/_y/wxctgwss5zv1fq27s5hw50zr0000gn/T/arduino_build_11632/preproc/ctags_target_for_gcc_minus_e.cpp"
"/Applications/Arduino.app/Contents/Java/tools-builder/ctags/5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "/var/folders/_y/wxctgwss5zv1fq27s5hw50zr0000gn/T/arduino_build_11632/preproc/ctags_target_for_gcc_minus_e.cpp"
Compiling sketch...
"/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avr-gcc" -c -g -Os -Wall -Wextra -std=gnu11 -ffunction-sections -fdata-sections -MMD -flto -fno-fat-lto-objects -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10801 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-I/Users/allen/Library/Arduino15/packages/arduino/hardware/avr/1.6.13/cores/arduino" "-I/Users/allen/Library/Arduino15/packages/arduino/hardware/avr/1.6.13/variants/standard" "-I/Users/allen/Library/Arduino15/packages/arduino/hardware/avr/1.6.13/libraries/SPI/src" "-I/Users/allen/Library/Arduino15/packages/arduino/hardware/avr/1.6.13/libraries/Wire/src" "/var/folders/_y/wxctgwss5zv1fq27s5hw50zr0000gn/T/arduino_build_11632/sketch/analogFastWrite.c" -o "/var/folders/_y/wxctgwss5zv1fq27s5hw50zr0000gn/T/arduino_build_11632/sketch/analogFastWrite.c.o"
/var/folders/_y/wxctgwss5zv1fq27s5hw50zr0000gn/T/arduino_build_11632/sketch/analogFastWrite.c: In function 'syncADC':
analogFastWrite.c:17: error: invalid type argument of '->' (have 'uint16_t')
while (ADC->STATUS.bit.SYNCBUSY == 1)
^
/var/folders/_y/wxctgwss5zv1fq27s5hw50zr0000gn/T/arduino_build_11632/sketch/analogFastWrite.c: In function 'syncDAC':
analogFastWrite.c:24: error: 'DAC' undeclared (first use in this function)
while (DAC->STATUS.bit.SYNCBUSY == 1)
^
/var/folders/_y/wxctgwss5zv1fq27s5hw50zr0000gn/T/arduino_build_11632/sketch/analogFastWrite.c:24:10: note: each undeclared identifier is reported only once for each function it appears in
/var/folders/_y/wxctgwss5zv1fq27s5hw50zr0000gn/T/arduino_build_11632/sketch/analogFastWrite.c: At top level:
analogFastWrite.c:29: error: unknown type name 'Tc'
static __inline__ void syncTC_8(Tc* TCx) __attribute__((always_inline, unused));
^
analogFastWrite.c:30: error: unknown type name 'Tc'
static void syncTC_8(Tc* TCx) {
^
analogFastWrite.c:35: error: unknown type name 'Tcc'
static __inline__ void syncTCC(Tcc* TCCx) __attribute__((always_inline, unused));
^
analogFastWrite.c:36: error: unknown type name 'Tcc'
static void syncTCC(Tcc* TCCx) {
^
/var/folders/_y/wxctgwss5zv1fq27s5hw50zr0000gn/T/arduino_build_11632/sketch/analogFastWrite.c: In function 'analogFastWrite':
analogFastWrite.c:67: error: unknown type name 'PinDescription'
PinDescription pinDesc = g_APinDescription[pin];
^
analogFastWrite.c:67: error: 'g_APinDescription' undeclared (first use in this function)
PinDescription pinDesc = g_APinDescription[pin];
^
analogFastWrite.c:68: error: request for member 'ulPinAttribute' in something not a structure or union
uint32_t attr = pinDesc.ulPinAttribute;
^
analogFastWrite.c:70: error: 'PIN_ATTR_ANALOG' undeclared (first use in this function)
if ((attr & PIN_ATTR_ANALOG) == PIN_ATTR_ANALOG)
^
analogFastWrite.c:81: error: 'DAC' undeclared (first use in this function)
DAC->DATA.reg = value & 0x3FF; // DAC on 10 bits.
^
analogFastWrite.c:88: error: 'PIN_ATTR_PWM' undeclared (first use in this function)
if ((attr & PIN_ATTR_PWM) == PIN_ATTR_PWM)
^
/var/folders/_y/wxctgwss5zv1fq27s5hw50zr0000gn/T/arduino_build_11632/sketch/analogFastWrite.c:91:5: warning: implicit declaration of function 'GetTCNumber' [-Wimplicit-function-declaration]
uint32_t tcNum = GetTCNumber(pinDesc.ulPWMChannel);
^
analogFastWrite.c:91: error: request for member 'ulPWMChannel' in something not a structure or union
uint32_t tcNum = GetTCNumber(pinDesc.ulPWMChannel);
^
/var/folders/_y/wxctgwss5zv1fq27s5hw50zr0000gn/T/arduino_build_11632/sketch/analogFastWrite.c:92:5: warning: implicit declaration of function 'GetTCChannelNumber' [-Wimplicit-function-declaration]
uint8_t tcChannel = GetTCChannelNumber(pinDesc.ulPWMChannel);
^
analogFastWrite.c:92: error: request for member 'ulPWMChannel' in something not a structure or union
uint8_t tcChannel = GetTCChannelNumber(pinDesc.ulPWMChannel);
^
analogFastWrite.c:93: error: 'TCC_INST_NUM' undeclared (first use in this function)
static bool tcEnabled[TCC_INST_NUM+TC_INST_NUM];
^
analogFastWrite.c:93: error: 'TC_INST_NUM' undeclared (first use in this function)
static bool tcEnabled[TCC_INST_NUM+TC_INST_NUM];
^
analogFastWrite.c:98: error: 'PIN_ATTR_TIMER' undeclared (first use in this function)
if (attr & PIN_ATTR_TIMER) {
^
analogFastWrite.c:101: error: request for member 'ulPinType' in something not a structure or union
if (pinDesc.ulPinType == PIO_TIMER_ALT) {
^
analogFastWrite.c:101: error: 'PIO_TIMER_ALT' undeclared (first use in this function)
if (pinDesc.ulPinType == PIO_TIMER_ALT) {
^
/var/folders/_y/wxctgwss5zv1fq27s5hw50zr0000gn/T/arduino_build_11632/sketch/analogFastWrite.c:102:11: warning: implicit declaration of function 'pinPeripheral' [-Wimplicit-function-declaration]
pinPeripheral(pin, PIO_TIMER_ALT);
^
analogFastWrite.c:106: error: 'PIO_TIMER' undeclared (first use in this function)
pinPeripheral(pin, PIO_TIMER);
^
/var/folders/_y/wxctgwss5zv1fq27s5hw50zr0000gn/T/arduino_build_11632/sketch/analogFastWrite.c:114:9: warning: implicit declaration of function 'GCLK_CLKCTRL_ID' [-Wimplicit-function-declaration]
GCLK_CLKCTRL_ID(GCM_TCC0_TCC1), // TCC0
^
analogFastWrite.c:114: error: 'GCM_TCC0_TCC1' undeclared (first use in this function)
GCLK_CLKCTRL_ID(GCM_TCC0_TCC1), // TCC0
^
analogFastWrite.c:116: error: 'GCM_TCC2_TC3' undeclared (first use in this function)
GCLK_CLKCTRL_ID(GCM_TCC2_TC3), // TCC2
^
analogFastWrite.c:118: error: 'GCM_TC4_TC5' undeclared (first use in this function)
GCLK_CLKCTRL_ID(GCM_TC4_TC5), // TC4
^
analogFastWrite.c:120: error: 'GCM_TC6_TC7' undeclared (first use in this function)
GCLK_CLKCTRL_ID(GCM_TC6_TC7), // TC6
^
analogFastWrite.c:123: error: 'GCLK' undeclared (first use in this function)
GCLK->CLKCTRL.reg = (uint16_t) (GCLK_CLKCTRL_CLKEN | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_IDs[tcNum]);
^
analogFastWrite.c:123: error: request for member 'CLKCTRL' in something not a structure or union
GCLK->CLKCTRL.reg = (uint16_t) (GCLK_CLKCTRL_CLKEN | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_IDs[tcNum]);
^
analogFastWrite.c:123: error: request for member 'reg' in something not a structure or union
GCLK->CLKCTRL.reg = (uint16_t) (GCLK_CLKCTRL_CLKEN | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_IDs[tcNum]);
^
analogFastWrite.c:123: error: 'GCLK_CLKCTRL_CLKEN' undeclared (first use in this function)
GCLK->CLKCTRL.reg = (uint16_t) (GCLK_CLKCTRL_CLKEN | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_IDs[tcNum]);
^
analogFastWrite.c:123: error: 'GCLK_CLKCTRL_GEN_GCLK0' undeclared (first use in this function)
GCLK->CLKCTRL.reg = (uint16_t) (GCLK_CLKCTRL_CLKEN | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_IDs[tcNum]);
^
analogFastWrite.c:123: error: invalid operands to binary | (have 'uint16_t *' and 'uint16_t *')
GCLK->CLKCTRL.reg = (uint16_t) (GCLK_CLKCTRL_CLKEN | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_IDs[tcNum]);
^
analogFastWrite.c:123: error: invalid operands to binary | (have 'uint16_t *' and 'uint16_t')
GCLK->CLKCTRL.reg = (uint16_t) (GCLK_CLKCTRL_CLKEN | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_IDs[tcNum]);
^
/var/folders/_y/wxctgwss5zv1fq27s5hw50zr0000gn/T/arduino_build_11632/sketch/analogFastWrite.c:123:7: warning: statement with no effect [-Wunused-value]
GCLK->CLKCTRL.reg = (uint16_t) (GCLK_CLKCTRL_CLKEN | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_IDs[tcNum]);
^
analogFastWrite.c:124: error: request for member 'STATUS' in something not a structure or union
while (GCLK->STATUS.bit.SYNCBUSY == 1);
^
analogFastWrite.c:124: error: request for member 'bit' in something not a structure or union
while (GCLK->STATUS.bit.SYNCBUSY == 1);
^
analogFastWrite.c:124: error: request for member 'SYNCBUSY' in something not a structure or union
while (GCLK->STATUS.bit.SYNCBUSY == 1);
^
/var/folders/_y/wxctgwss5zv1fq27s5hw50zr0000gn/T/arduino_build_11632/sketch/analogFastWrite.c:124:40: warning: comparison between pointer and integer
while (GCLK->STATUS.bit.SYNCBUSY == 1);
^
/var/folders/_y/wxctgwss5zv1fq27s5hw50zr0000gn/T/arduino_build_11632/sketch/analogFastWrite.c:127:17: warning: comparison between pointer and integer
if (tcNum >= TCC_INST_NUM) {
^
analogFastWrite.c:129: error: unknown type name 'Tc'
Tc* TCx = (Tc*) GetTC(pinDesc.ulPWMChannel);
^
analogFastWrite.c:129: error: 'Tc' undeclared (first use in this function)
Tc* TCx = (Tc*) GetTC(pinDesc.ulPWMChannel);
^
analogFastWrite.c:129: error: expected expression before ')' token
Tc* TCx = (Tc*) GetTC(pinDesc.ulPWMChannel);
^
analogFastWrite.c:129: error: invalid operands to binary * (have 'uint16_t *' and 'uint16_t *')
Tc* TCx = (Tc*) GetTC(pinDesc.ulPWMChannel);
^
/var/folders/_y/wxctgwss5zv1fq27s5hw50zr0000gn/T/arduino_build_11632/sketch/analogFastWrite.c:129:19: warning: pointer targets in initialization differ in signedness [-Wpointer-sign]
Tc* TCx = (Tc*) GetTC(pinDesc.ulPWMChannel);
^
analogFastWrite.c:131: error: request for member 'COUNT8' in something not a structure or union
TCx->COUNT8.CTRLA.bit.ENABLE = 0;
^
analogFastWrite.c:131: error: request for member 'CTRLA' in something not a structure or union
TCx->COUNT8.CTRLA.bit.ENABLE = 0;
^
analogFastWrite.c:131: error: request for member 'bit' in something not a structure or union
TCx->COUNT8.CTRLA.bit.ENABLE = 0;
^
analogFastWrite.c:131: error: request for member 'ENABLE' in something not a structure or union
TCx->COUNT8.CTRLA.bit.ENABLE = 0;
^
/var/folders/_y/wxctgwss5zv1fq27s5hw50zr0000gn/T/arduino_build_11632/sketch/analogFastWrite.c:131:9: warning: statement with no effect [-Wunused-value]
TCx->COUNT8.CTRLA.bit.ENABLE = 0;
^
/var/folders/_y/wxctgwss5zv1fq27s5hw50zr0000gn/T/arduino_build_11632/sketch/analogFastWrite.c:132:9: warning: implicit declaration of function 'syncTC_8' [-Wimplicit-function-declaration]
syncTC_8(TCx);
^
analogFastWrite.c:134: error: request for member 'COUNT8' in something not a structure or union
TCx->COUNT8.CTRLA.reg |= TC_CTRLA_MODE_COUNT8 | TC_CTRLA_WAVEGEN_NPWM;
^
analogFastWrite.c:134: error: request for member 'CTRLA' in something not a structure or union
TCx->COUNT8.CTRLA.reg |= TC_CTRLA_MODE_COUNT8 | TC_CTRLA_WAVEGEN_NPWM;
^
analogFastWrite.c:134: error: request for member 'reg' in something not a structure or union
TCx->COUNT8.CTRLA.reg |= TC_CTRLA_MODE_COUNT8 | TC_CTRLA_WAVEGEN_NPWM;
^
analogFastWrite.c:134: error: 'TC_CTRLA_MODE_COUNT8' undeclared (first use in this function)
TCx->COUNT8.CTRLA.reg |= TC_CTRLA_MODE_COUNT8 | TC_CTRLA_WAVEGEN_NPWM;
^
analogFastWrite.c:134: error: 'TC_CTRLA_WAVEGEN_NPWM' undeclared (first use in this function)
TCx->COUNT8.CTRLA.reg |= TC_CTRLA_MODE_COUNT8 | TC_CTRLA_WAVEGEN_NPWM;
^
analogFastWrite.c:134: error: invalid operands to binary | (have 'uint16_t *' and 'uint16_t *')
TCx->COUNT8.CTRLA.reg |= TC_CTRLA_MODE_COUNT8 | TC_CTRLA_WAVEGEN_NPWM;
^
/var/folders/_y/wxctgwss5zv1fq27s5hw50zr0000gn/T/arduino_build_11632/sketch/analogFastWrite.c:134:9: warning: statement with no effect [-Wunused-value]
TCx->COUNT8.CTRLA.reg |= TC_CTRLA_MODE_COUNT8 | TC_CTRLA_WAVEGEN_NPWM;
^
analogFastWrite.c:137: error: request for member 'COUNT8' in something not a structure or union
TCx->COUNT8.CC[tcChannel].reg = (uint8_t) value;
^
analogFastWrite.c:137: error: request for member 'CC' in something not a structure or union
TCx->COUNT8.CC[tcChannel].reg = (uint8_t) value;
^
analogFastWrite.c:137: error: request for member 'reg' in something not a structure or union
TCx->COUNT8.CC[tcChannel].reg = (uint8_t) value;
^
/var/folders/_y/wxctgwss5zv1fq27s5hw50zr0000gn/T/arduino_build_11632/sketch/analogFastWrite.c:137:9: warning: statement with no effect [-Wunused-value]
TCx->COUNT8.CC[tcChannel].reg = (uint8_t) value;
^
analogFastWrite.c:140: error: request for member 'COUNT8' in something not a structure or union
TCx->COUNT8.PER.reg = 0xFF;
^
analogFastWrite.c:140: error: request for member 'PER' in something not a structure or union
TCx->COUNT8.PER.reg = 0xFF;
^
analogFastWrite.c:140: error: request for member 'reg' in something not a structure or union
TCx->COUNT8.PER.reg = 0xFF;
^
/var/folders/_y/wxctgwss5zv1fq27s5hw50zr0000gn/T/arduino_build_11632/sketch/analogFastWrite.c:140:9: warning: statement with no effect [-Wunused-value]
TCx->COUNT8.PER.reg = 0xFF;
^
analogFastWrite.c:143: error: request for member 'COUNT8' in something not a structure or union
TCx->COUNT8.CTRLA.bit.ENABLE = 1;
^
analogFastWrite.c:143: error: request for member 'CTRLA' in something not a structure or union
TCx->COUNT8.CTRLA.bit.ENABLE = 1;
^
analogFastWrite.c:143: error: request for member 'bit' in something not a structure or union
TCx->COUNT8.CTRLA.bit.ENABLE = 1;
^
analogFastWrite.c:143: error: request for member 'ENABLE' in something not a structure or union
TCx->COUNT8.CTRLA.bit.ENABLE = 1;
^
/var/folders/_y/wxctgwss5zv1fq27s5hw50zr0000gn/T/arduino_build_11632/sketch/analogFastWrite.c:143:9: warning: statement with no effect [-Wunused-value]
TCx->COUNT8.CTRLA.bit.ENABLE = 1;
^
analogFastWrite.c:147: error: unknown type name 'Tcc'
Tcc* TCCx = (Tcc*) GetTC(pinDesc.ulPWMChannel);
^
analogFastWrite.c:147: error: 'Tcc' undeclared (first use in this function)
Tcc* TCCx = (Tcc*) GetTC(pinDesc.ulPWMChannel);
^
analogFastWrite.c:147: error: expected expression before ')' token
Tcc* TCCx = (Tcc*) GetTC(pinDesc.ulPWMChannel);
^
analogFastWrite.c:147: error: invalid operands to binary * (have 'uint16_t *' and 'uint16_t *')
Tcc* TCCx = (Tcc*) GetTC(pinDesc.ulPWMChannel);
^
/var/folders/_y/wxctgwss5zv1fq27s5hw50zr0000gn/T/arduino_build_11632/sketch/analogFastWrite.c:147:21: warning: pointer targets in initialization differ in signedness [-Wpointer-sign]
Tcc* TCCx = (Tcc*) GetTC(pinDesc.ulPWMChannel);
^
analogFastWrite.c:149: error: request for member 'CTRLA' in something not a structure or union
TCCx->CTRLA.bit.ENABLE = 0;
^
analogFastWrite.c:149: error: request for member 'bit' in something not a structure or union
TCCx->CTRLA.bit.ENABLE = 0;
^
analogFastWrite.c:149: error: request for member 'ENABLE' in something not a structure or union
TCCx->CTRLA.bit.ENABLE = 0;
^
/var/folders/_y/wxctgwss5zv1fq27s5hw50zr0000gn/T/arduino_build_11632/sketch/analogFastWrite.c:149:9: warning: statement with no effect [-Wunused-value]
TCCx->CTRLA.bit.ENABLE = 0;
^
/var/folders/_y/wxctgwss5zv1fq27s5hw50zr0000gn/T/arduino_build_11632/sketch/analogFastWrite.c:150:9: warning: implicit declaration of function 'syncTCC' [-Wimplicit-function-declaration]
syncTCC(TCCx);
^
analogFastWrite.c:153: error: request for member 'WAVE' in something not a structure or union
TCCx->WAVE.reg |= TCC_WAVE_WAVEGEN_NPWM;
^
analogFastWrite.c:153: error: request for member 'reg' in something not a structure or union
TCCx->WAVE.reg |= TCC_WAVE_WAVEGEN_NPWM;
^
analogFastWrite.c:153: error: 'TCC_WAVE_WAVEGEN_NPWM' undeclared (first use in this function)
TCCx->WAVE.reg |= TCC_WAVE_WAVEGEN_NPWM;
^
/var/folders/_y/wxctgwss5zv1fq27s5hw50zr0000gn/T/arduino_build_11632/sketch/analogFastWrite.c:153:9: warning: statement with no effect [-Wunused-value]
TCCx->WAVE.reg |= TCC_WAVE_WAVEGEN_NPWM;
^
analogFastWrite.c:156: error: request for member 'CC' in something not a structure or union
TCCx->CC[tcChannel].reg = (uint32_t) value;
^
analogFastWrite.c:156: error: request for member 'reg' in something not a structure or union
TCCx->CC[tcChannel].reg = (uint32_t) value;
^
/var/folders/_y/wxctgwss5zv1fq27s5hw50zr0000gn/T/arduino_build_11632/sketch/analogFastWrite.c:156:9: warning: statement with no effect [-Wunused-value]
TCCx->CC[tcChannel].reg = (uint32_t) value;
^
analogFastWrite.c:159: error: request for member 'PER' in something not a structure or union
TCCx->PER.reg = 0xFF; //change to 0x43FF for 10 bit... must also change mapping above
^
analogFastWrite.c:159: error: request for member 'reg' in something not a structure or union
TCCx->PER.reg = 0xFF; //change to 0x43FF for 10 bit... must also change mapping above
^
/var/folders/_y/wxctgwss5zv1fq27s5hw50zr0000gn/T/arduino_build_11632/sketch/analogFastWrite.c:159:9: warning: statement with no effect [-Wunused-value]
TCCx->PER.reg = 0xFF; //change to 0x43FF for 10 bit... must also change mapping above
^
analogFastWrite.c:162: error: request for member 'CTRLA' in something not a structure or union
TCCx->CTRLA.bit.ENABLE = 1;
^
analogFastWrite.c:162: error: request for member 'bit' in something not a structure or union
TCCx->CTRLA.bit.ENABLE = 1;
^
analogFastWrite.c:162: error: request for member 'ENABLE' in something not a structure or union
TCCx->CTRLA.bit.ENABLE = 1;
^
/var/folders/_y/wxctgwss5zv1fq27s5hw50zr0000gn/T/arduino_build_11632/sketch/analogFastWrite.c:162:9: warning: statement with no effect [-Wunused-value]
TCCx->CTRLA.bit.ENABLE = 1;
^
/var/folders/_y/wxctgwss5zv1fq27s5hw50zr0000gn/T/arduino_build_11632/sketch/analogFastWrite.c:166:17: warning: comparison between pointer and integer
if (tcNum >= TCC_INST_NUM) {
^
analogFastWrite.c:167: error: 'TCx' undeclared (first use in this function)
Tc* TCx = (Tc*) GetTC(pinDesc.ulPWMChannel);
^
analogFastWrite.c:167: error: invalid operands to binary * (have 'uint16_t *' and 'uint16_t *')
Tc* TCx = (Tc*) GetTC(pinDesc.ulPWMChannel);
^
analogFastWrite.c:167: error: expected expression before ')' token
Tc* TCx = (Tc*) GetTC(pinDesc.ulPWMChannel);
^
analogFastWrite.c:167: error: invalid operands to binary * (have 'uint16_t *' and 'uint16_t *')
Tc* TCx = (Tc*) GetTC(pinDesc.ulPWMChannel);
^
/var/folders/_y/wxctgwss5zv1fq27s5hw50zr0000gn/T/arduino_build_11632/sketch/analogFastWrite.c:167:9: warning: statement with no effect [-Wunused-value]
Tc* TCx = (Tc*) GetTC(pinDesc.ulPWMChannel);
^
analogFastWrite.c:168: error: request for member 'COUNT8' in something not a structure or union
TCx->COUNT8.CC[tcChannel].reg = (uint8_t) value;
^
analogFastWrite.c:168: error: request for member 'CC' in something not a structure or union
TCx->COUNT8.CC[tcChannel].reg = (uint8_t) value;
^
analogFastWrite.c:168: error: request for member 'reg' in something not a structure or union
TCx->COUNT8.CC[tcChannel].reg = (uint8_t) value;
^
/var/folders/_y/wxctgwss5zv1fq27s5hw50zr0000gn/T/arduino_build_11632/sketch/analogFastWrite.c:168:9: warning: statement with no effect [-Wunused-value]
TCx->COUNT8.CC[tcChannel].reg = (uint8_t) value;
^
analogFastWrite.c:171: error: 'TCCx' undeclared (first use in this function)
Tcc* TCCx = (Tcc*) GetTC(pinDesc.ulPWMChannel);
^
analogFastWrite.c:171: error: invalid operands to binary * (have 'uint16_t *' and 'uint16_t *')
Tcc* TCCx = (Tcc*) GetTC(pinDesc.ulPWMChannel);
^
analogFastWrite.c:171: error: expected expression before ')' token
Tcc* TCCx = (Tcc*) GetTC(pinDesc.ulPWMChannel);
^
analogFastWrite.c:171: error: invalid operands to binary * (have 'uint16_t *' and 'uint16_t *')
Tcc* TCCx = (Tcc*) GetTC(pinDesc.ulPWMChannel);
^
/var/folders/_y/wxctgwss5zv1fq27s5hw50zr0000gn/T/arduino_build_11632/sketch/analogFastWrite.c:171:9: warning: statement with no effect [-Wunused-value]
Tcc* TCCx = (Tcc*) GetTC(pinDesc.ulPWMChannel);
^
analogFastWrite.c:172: error: request for member 'CTRLBSET' in something not a structure or union
TCCx->CTRLBSET.bit.LUPD = 1;
^
analogFastWrite.c:172: error: request for member 'bit' in something not a structure or union
TCCx->CTRLBSET.bit.LUPD = 1;
^
analogFastWrite.c:172: error: request for member 'LUPD' in something not a structure or union
TCCx->CTRLBSET.bit.LUPD = 1;
^
/var/folders/_y/wxctgwss5zv1fq27s5hw50zr0000gn/T/arduino_build_11632/sketch/analogFastWrite.c:172:9: warning: statement with no effect [-Wunused-value]
TCCx->CTRLBSET.bit.LUPD = 1;
^
analogFastWrite.c:174: error: request for member 'CCB' in something not a structure or union
TCCx->CCB[tcChannel].reg = (uint32_t) value;
^
analogFastWrite.c:174: error: request for member 'reg' in something not a structure or union
TCCx->CCB[tcChannel].reg = (uint32_t) value;
^
/var/folders/_y/wxctgwss5zv1fq27s5hw50zr0000gn/T/arduino_build_11632/sketch/analogFastWrite.c:174:9: warning: statement with no effect [-Wunused-value]
TCCx->CCB[tcChannel].reg = (uint32_t) value;
^
analogFastWrite.c:176: error: request for member 'CTRLBCLR' in something not a structure or union
TCCx->CTRLBCLR.bit.LUPD = 1;
^
analogFastWrite.c:176: error: request for member 'bit' in something not a structure or union
TCCx->CTRLBCLR.bit.LUPD = 1;
^
analogFastWrite.c:176: error: request for member 'LUPD' in something not a structure or union
TCCx->CTRLBCLR.bit.LUPD = 1;
^
/var/folders/_y/wxctgwss5zv1fq27s5hw50zr0000gn/T/arduino_build_11632/sketch/analogFastWrite.c:176:9: warning: statement with no effect [-Wunused-value]
TCCx->CTRLBCLR.bit.LUPD = 1;
^
/var/folders/_y/wxctgwss5zv1fq27s5hw50zr0000gn/T/arduino_build_11632/sketch/analogFastWrite.c:93:17: warning: unused variable 'tcEnabled' [-Wunused-variable]
static bool tcEnabled[TCC_INST_NUM+TC_INST_NUM];
^
/var/folders/_y/wxctgwss5zv1fq27s5hw50zr0000gn/T/arduino_build_11632/sketch/analogFastWrite.c:67:18: warning: variable 'pinDesc' set but not used [-Wunused-but-set-variable]
PinDescription pinDesc = g_APinDescription[pin];
^
/var/folders/_y/wxctgwss5zv1fq27s5hw50zr0000gn/T/arduino_build_11632/sketch/analogFastWrite.c: At top level:
/var/folders/_y/wxctgwss5zv1fq27s5hw50zr0000gn/T/arduino_build_11632/sketch/analogFastWrite.c:10:12: warning: '_readResolution' defined but not used [-Wunused-variable]
static int _readResolution = 10;
^
/var/folders/_y/wxctgwss5zv1fq27s5hw50zr0000gn/T/arduino_build_11632/sketch/analogFastWrite.c:11:12: warning: '_ADCResolution' defined but not used [-Wunused-variable]
static int _ADCResolution = 10;
^
Using library SPI at version 1.0 in folder: /Users/allen/Library/Arduino15/packages/arduino/hardware/avr/1.6.13/libraries/SPI
Using library Wire at version 1.0 in folder: /Users/allen/Library/Arduino15/packages/arduino/hardware/avr/1.6.13/libraries/Wire
exit status 1
invalid type argument of '->' (have 'uint16_t')
Hello,
I am sure that i am missing something here but why are there only 3 different phases when stepping the motor?
Since i am still doing some initial testing, i am current running this on my Arduino Zero.
I discovered when probing pins 5, 6 ,7 ,8 and manually commanding steps from serial console, i would see the following pattern:
(Excuse my crude table)
D8 D7 D5 D6
IN_1 IN_2 IN_3 IN_4
Phase 1: L H L H
Phase 2: L H H L
Phase 3: H L L H
Phase 4: L H L H
As you can see, phase 1 and 4 are the same. I would have expected to see H L H L in one of them instead. Digging, I think i found the responsible code in the utils.cpp and the way it was written makes this seem intentional.
So either i am having a brain fart today or something is going on here.
Thanks
Hi,
Since the mechaduino have been released to public, it would be nice that your git tree contains the working firmware in the working branch, or maybe a tag with 0.1 written on it.
I had a hard time making it work ( i tried 3 steppers ) to make it work, until I used the developement branch.
Unable to compile the firmware with the latest arduino release 1.8.13
unsure what the issue is. fails to verify in multiple locations and I'm not advanced enough to troubleshoot on my own.
currently mechaduino's are paperweights.
From the code int cpr = 16384; //counts per rev
seems quite an achievement with a hall effect encoder. What is the effective CPR that can be independently held and stepped to/from reliably?
This is a really cool project that I'm very interested in, but one thing that stood out to me was the need for recompilation when changing settings and during calibration.
Now I'm aware that this microcontroller doesn't have any EEPROM storage, but there are some libraries to use the flash memory for this purpose. https://github.com/cmaglie/FlashStorage
By using flash storage for the calibration, it would then be possible to have the calibration routine writes its calibration directly and skip the recompilation step, making Mechaduino much easier to use.
Hey everyone,
So, finally got around to setting up two mechaduino's and I've run into the same issue with both. I can run the calibration for the mechaduino fine and paste the lookup values to Parameters.cpp -> const float lookup[] ={}. For testing I commented out digitalWrite(ledPin,LOW); // turn LED off
so that the LED would remain on. I can move the stepper around with single steps using 's', but when I go to closed loop position mode by sending 'x' then 'y' over the serial monitor, the led turns off when I send 'y' and the motor driver gets too hot to touch for longer than a couple seconds. When I try to send 'r' to enter a new step point, it asks me to "Enter setpoint:", which I can do and it prints the value entered back at me, but the stepper doesn't move for any input. Is the LED going out an indication of some sort of issue? Is something shorting? Any help is appreciated!
I'm opening an issue here as I had no reply for my post at Google Groups.
I have v0.1 hardware using the latest firmware from master branch.
Most of the time when I do calibration, the generated lookup table is unusable with the angle not changing at the beginning and end of the table. The angle only increase by 0.01 degree around middle of the table.
Occasionally I do get correct lookup table with about 0.02 degree increments.
I had checked through the encoder readouts and there are no problem.
What could be causing my Mechaduino to get bad lookup table almost all of the time?
The AS5047D hall sensors are dry all over the planet, are there any alternatives that can be used for your project? Or do you know where one can still find them?
I just received my Kickstarter Mechaduinos. I have flashed the Mechaduino_01 firmware. Using the serial monitor, I can give a few commands to make it move (I did perform the calibration first). However, after a few commands the communication locks up. Actually, it causes even the Arduino PC application to hang. The only thing to make it work again is unplug/replug the USB connector.
The issue occurs both in Mac OS X and in Windows 7. On Mac OS X I have used both the Arduino PC application and Minicom as serial terminal applications. In all cases I get the same result. Is this a known firmware issue?
I've been working with a couple of other advanced motor control projects (maslowcnc which uses brushed DC motors and encoders, odrive which uses high power brushless DC motors and encoders, pthat which can do very high speed stepper motor driving) that all need something more than the traditional step/direction interface. To be clear, I am not a part of the development team of any of these, just a user/community participant.
As I'm seeing multiple projects with similar needs, I'm trying to see if it's possible to create a standard so that getting the smarter protocol implemented in managing software (Initially I'm aiming at linuxCNC adn grbl) easier, on the basis that implementing one protocol will support multiple hardware offering.
PTHat has a well defined serial API at http://pthat.com/index.php/command-set/. I'm suggesting to different projects that if that they can implement something compatible, it would be easier to get good support from CNC software.
One addition to the pthat command that would be needed is a way to synchronize the execution of commands across multiple controllers. To do this, I am suggesting that one GPIO pin be connected to a common bus (with a pull-up resistor), under normal conditions, each controller would pull the pin low. When they are issued a 'delayed start' command, they would switch the pin to an input pin and wait for it to go high. Once every controller on the bus does this, the pin will go high and they all start executing simultaniously (and a short time later, pull the pin low again as they start moving). This can both serve as the initial synchronized start, and be scattered in every so often to make sure that the clocks of different boards haven't drifted.
This will allow coordinated moves to happen across motors managed by different controllers, be they several mechaduino board, or some managed by one type of board and others managed by other types of boards.
Is this something that you would be interested in participating in by implementing a subset of the pthat commands? (one axis, without the aux/adc commands)
The motor command goes to 100% as soon as the closed loop is enabled, leading to a sharp jolt. It would be nice to have to effort ramp up so that it doesn't shock load the system.
Self-built Mechaduino while waiting for Kickstarter units to arrive. Performed calibration routine and programmed it. Step mode with "s" command works. After sending "y" and "x" and "r 1080" no rotation occurs. Stepper axis can be easily moved my hand, there is some minor resistance, but no closed-loop control action occurs.
What parameters in the firmware to observe or print to evaluate what is going on.
In the Interrupt routine, I would like to know the number 150 ( in mode x ) and number 200 ( in mode v )
What do they represent ??? ( Ill do a define for those numbers )
switch (mode) {
case 'x':
e = (r - yw);
SerialUSB.print(y);
SerialUSB.print(";");
SerialUSB.print(e);
SerialUSB.println(";");
ITerm += (pKi * e);
if (ITerm > 150) ITerm = 150;
else if (ITerm < -150) ITerm = -150;
u = ((pKp * e) + ITerm - (pKd * (yw - yw_1))); //ARDUINO library style
//u = u+lookup_force(a)-20;
// u = u_1 + cA*e + cB*e_1 + cC*e_2; //ppt linked in octave script
// u = 20*e;//
break;
case 'v':
e = (r - ((yw - yw_1) * Fs*0.16666667));//error in degrees per rpm (sample frequency in Hz * (60 seconds/min) / (360 degrees/rev) )
ITerm += (vKi * e);
if (ITerm > 200) ITerm = 200;
else if (ITerm < -200) ITerm = -200;
u = ((vKp * e) + ITerm - (vKd * (yw - yw_1)));//+ lookup_force(a)-20; //ARDUINO library style
break;
Collect and document defaults for common configurations as a guide for assembling custom motor configurations.
I propose the following format or similar:
@jcchurch13 Can you please post your current working values for stepper motors and magnets you have.
can i use my own driver ? i will use it with cnc
Controller.cpp has a '#include <SPI.h>' but that include is not included in Mechaduino_01.ino, which gives an error on compiling.
After adding '#include "SPI.h"' to the .ino, it gives a ''PROGMEM' does not name a type' error in Parameters.h. Additionally, from what I can find out about PROGMEM in the Arduino, it's only supported in the AVR architecture.
Starting with this commit the FlaggedStorage
library was used, resulting in the compilation error: FlashStorage.h: No such file or directory
on a clean Arduino install.
Repro steps:
Arduino SAMD Boards (32-bit ARM Cortex-M0+)
in the Board Managermaster
Mechaduino\Mechaduino\Mechaduino.ino
Arduino Zero
(doesn't matter, all fail)Verify
Given that the README says "New firmware is in the default "master" branch" I think it's expected that the master branch be green (would recommend some CI).
Latest Release
still works.
I'm evaluating the Mechaduino for use in a client project, and it's very promising so far. However, I'm a bit confused by how the licensing is intended to work as it relates to commercial projects.
I'm a huge fan of the open source community, and I try to release my own software projects under the MIT license where possible, particularly in situations where my code can easily be adapted for use by others.
Crerative Commons recommends against using CC licenses for software, see https://creativecommons.org/faq/#can-i-apply-a-creative-commons-license-to-software, and as such, I have some questions related to using a Mechaduino in a bespoke client project where I have to assign copyright to the client:
The Share Alike provision implies that all modifications must be released under the same license. What is your intent here? Because of how the Mechaduino code is structured, basically every project that uses it needs custom modifications to the parameters and to the Mechaduino.ino file which are essentially useless to everyone else. Do you want everyone to share these types of changes?
The Mechaduino is only useful in the context of a larger hardware/software ecosystem. For example, there might be a program running on a laptop that communicates with the Mechaduino using a serial protocol. Would such a program also need to be released under the same license?
The CC-by-SA license is incompatible with other software licenses. Does that mean I wouldn't be able to use any libraries licensed under different terms in conjunction with Mechaduino?
If I use the Mechaduino, I would like to share the improvements I make. In particular, I would implement #25, substantially improve the PID tuning experience, and possibly implement #19. For PID tuning, I would create a program that graphs yw
and r
and allows users to adjust P,I,and D while the motor is following a square wave. Would I need to release that program under the same CC-by-SA license?
If I implement #25, I would like to improve the documentation pdf and release the new pdf under CC-by-SA v4. Could I get access to the source files used to make that pdf, for that purpose?
Thanks in advance!
The Mechaduino firmware should be organized as a library with example sketches, rather than a single monolithic firmware sketch. This would allow Mechaduino to be used as a platform that can adapt to various use-cases.
It is great that the current firmware keeps setup()
and loop()
so minimal, and does most of the work elsewhere. This makes it easy to add higher-level application-specific code. However it currently requires modifying Mechaduino_01.ino
, and so it lacks separation and makes it more difficult to maintain multiple application-specific sketches, or to pull changes when the firmware is improved.
It would be better if the Mechaduino was an Arduino library, allowing it to be included in other sketches. Arduino libraries have an examples
folder which would include the current Mechaduino_01.ino
as a basic example. Other example sketches could be used for things like auto-tuning, so that the core library wouldn't need to become monolithic.
In the output() function, there is this piece of code:
if (sin_coil_A > 1024) {
sin_coil_A = sin_coil_A - 65536;
}
The variable sin_coil_A is declared as an int. On an ARM processor, this is 4 bytes, or the equivalent of a long on smaller Arduinos. So, if the value is larger than 1024, say 1025 as an example, you would end up with a result of -64511. I'm not sure what this is supposed to accomplish, or why you would even need to do it. Since this value is directly looked up from the sin table, and you have control over the magnitude of the table, why do you need to attempt some sort of saturation? Even if the variable was only two bytes, it would give a result that was unchanged from what you started with, i.e. if sin_coil_A = 1025, the result of 1025 - 65536 = 1025.
Note that since an int on this architecture is 4 bytes, that your sin table takes up 14400 bytes of RAM (almost half). You could declare it as 'short int' instead, which would give you two byte ints. There is sometimes a speed penalty when accessing these however, as ARMs prefer to work in their word size. Or, you could store your sin table with much higher resolution than you currently are, though there might not be much point if the DAC resolution is limited.
At any rate, I don't think this does what you intended it to do.
The serial interface in serialCheck() is well suited for human interaction but not much for machine interaction, or for scriptable human interaction.
It would be nice if mechaduino were able to communicate with computers easily using some more-or-less standard protocol, such as firmata (https://github.com/firmata/protocol), min (https://github.com/min-protocol/min) plus some mini-language, python-arduino-command-API (https://github.com/thearn/Python-Arduino-Command-API), ArduinoSerialCommand (https://github.com/scogswell/ArduinoSerialCommand) or such. This would allow for rapid integration in host controller software and/or debugging/development GUIs.
At this moment, one GUI (Windows-only) project for mechaduino, https://github.com/Kaiwol1990/Mechaduino, uses its own protocol.
I have been reading through all the other posts, and it looks like these boards should be able to drive 0.9 degree steppers. The only information that I have found about it is that spr needs to be set to 400 instead of 200 in the Parameters.cpp file. I have done that, and the motor now runs through all 400 steps during calibration, and will move fine in open loop mode, but when put into closed loop mode, it fails. The same board and magnet works fine on a 1.8 degree stepper with spr set to 200. Any ideas?
When using 5x geared stepper motor in closed loop the motor goes into constant rotation at high speed when applying torque on the axle.
I'm just about to kick off a print for the first time and I can't help but feel like my PIDs are going to be innacurate, maybe even hugely inacurate.
PID autotuning is an obvious answer to this problem to get into the ballpark of a good tune. I'd love this to be implemented in future releases.
In the code you have :
const float rSense = 0.150;
In one schematic you wrote 0.250.
Can you confirm that it's .150 that are installed on mechaduino 0.1 ??
Thanks
Prior to calibrating it would be good to implement a sanity check if magnetic field is sufficient and encoder generates valid results. Note the encoder may return magnetic field too high flag even if ti is too low.
Just wanted to share my experience with a hard bricked Mechaduino v0.2.
The SAMD21 is known to get his flags/fuses mixed up in some programming situations.
In this case, the bootloader area is set to write-protected and re-flashing the Arduino Zero bootloader via SWD port will fail.
A possible solution, if you do not have an ATMEL-ICE is using a black magic probe (BMP).
https://1bitsquared.de/products/black-magic-probe
Fortunatelly, a "Blue Pill" (STM32 dev board) can be programmed to function as a BMP.
https://buger.dread.cz/category/stm32.html
The solution is coming from here:
https://electronics.stackexchange.com/questions/438386/samd21-how-do-i-write-to-nvm-fuses
$ /home/peter/snap/arduino-mhall119/5/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/bin/arm-none-eabi-gdb
(gdb) target extended-remote /dev/ttyACM0
Remote debugging using /dev/ttyACM0
(gdb) monitor swdp_scan
Available Targets:
No. Att Driver
1 Atmel SAMD21G18A (rev D) M0+
(gdb) attach 1
Attaching to Remote target
warning: No executable has been specified and target does not support
determining executable automatically. Try using the "file" command.
0x00001314 in ?? ()
(gdb) file samd21_sam_ba.hex
A program is being debugged already.
Are you sure you want to change the file? (y or n) y
Reading symbols from samd21_sam_ba.hex...(no debugging symbols found)...done.
(gdb) monitor unlock_flash
(gdb) monitor unlock_bootprot
(gdb) monitor erase_mass
Erase successful!
(gdb) load
Loading section .sec1, size 0x1968 lma 0x0
Start address 0x60c, load size 6504
Transfer rate: 37 KB/sec, 929 bytes/write.
Which pins are supposed to be used for step and direction? I see in #define step_pin 1
definition in https://github.com/jcchurch13/Mechaduino-Firmware/blob/master/Mechaduino/Mechaduino/Parameters.h#L59 and the schematic looks like it should have external pullups on it, but pulsing pin D1 to ground doesn't seem to make it step in position hold mode or in open-loop mode.
Enabling the control loop with y
and using r
to set the set points works, so am I missing something or does a different mode need to be enabled?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.