Coder Social home page Coder Social logo

arduino-l6470's People

Contributors

ameyer avatar ivankravets avatar per1234 avatar saqoosha avatar thinkyhead avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

arduino-l6470's Issues

Library 'L6470' attemp to compile exits with an error

Hello!
The Marlin Firmware now supports the L6470 Stepperdriver and needs this Library to support it.
I think it is a very interesting driver and so I ordered 2 Drivermodules.
Now i try to get it to work. I downloaded and installed the 'Arduino-L6470' library in the Arduino Ide 1.8.2.
It looks OK an I can select in Examples the example code. But if i try to compile it it exits with errors. If it activate the L6470 support the errors are the same. I tried it to compile in Arduino 1.0.1 (if it is an version problem). But it is the same. Unfortunately I am not an experienced arduino programmer. I don´t know whats the problem. I wonder that this library is necessary for Marlin but there is now further information...
Perhaps it is a stupid mistake from me. Thanks a lot.

Underneath the compiling errors of the L6470 example code

Error Log
Arduino: 1.8.2 (Windows 7), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"

C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\TK_T530\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\TK_T530\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\TK_T530\Documents\Arduino\libraries -fqbn=arduino:avr:mega:cpu=atmega2560 -ide-version=10802 -build-path C:\Users\TK_T530\AppData\Local\Temp\arduino_build_426690 -warnings=none -build-cache C:\Users\TK_T530\AppData\Local\Temp\arduino_cache_859426 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arduinoOTA.path=C:\Users\TK_T530\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA\1.1.1 -prefs=runtime.tools.avrdude.path=C:\Users\TK_T530\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino9 -prefs=runtime.tools.avr-gcc.path=C:\Users\TK_T530\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2 -verbose C:\Users\TK_T530\Documents\Arduino\libraries\L6470\examples\L6470\L6470.ino
C:\Program Files (x86)\Arduino\arduino-builder -compile -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\TK_T530\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\TK_T530\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\TK_T530\Documents\Arduino\libraries -fqbn=arduino:avr:mega:cpu=atmega2560 -ide-version=10802 -build-path C:\Users\TK_T530\AppData\Local\Temp\arduino_build_426690 -warnings=none -build-cache C:\Users\TK_T530\AppData\Local\Temp\arduino_cache_859426 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arduinoOTA.path=C:\Users\TK_T530\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA\1.1.1 -prefs=runtime.tools.avrdude.path=C:\Users\TK_T530\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino9 -prefs=runtime.tools.avr-gcc.path=C:\Users\TK_T530\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2 -verbose C:\Users\TK_T530\Documents\Arduino\libraries\L6470\examples\L6470\L6470.ino
Using board 'mega' from platform in folder: C:\Users\TK_T530\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.21
Using core 'arduino' from platform in folder: C:\Users\TK_T530\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.21
Build-Optionen wurden verändert, alles wird neu kompiliert
Detecting libraries used...
"C:\Users\TK_T530\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/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=atmega2560 -DF_CPU=16000000L -DARDUINO=10802 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR   "-IC:\Users\TK_T530\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.21\cores\arduino" "-IC:\Users\TK_T530\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.21\variants\mega" "C:\Users\TK_T530\AppData\Local\Temp\arduino_build_426690\sketch\L6470.ino.cpp" -o "nul"
"C:\Users\TK_T530\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/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=atmega2560 -DF_CPU=16000000L -DARDUINO=10802 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR   "-IC:\Users\TK_T530\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.21\cores\arduino" "-IC:\Users\TK_T530\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.21\variants\mega" "-IC:\Users\TK_T530\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.21\libraries\SPI\src" "C:\Users\TK_T530\AppData\Local\Temp\arduino_build_426690\sketch\L6470.ino.cpp" -o "nul"
"C:\Users\TK_T530\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/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=atmega2560 -DF_CPU=16000000L -DARDUINO=10802 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR   "-IC:\Users\TK_T530\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.21\cores\arduino" "-IC:\Users\TK_T530\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.21\variants\mega" "-IC:\Users\TK_T530\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.21\libraries\SPI\src" "-IC:\Users\TK_T530\Documents\Arduino\libraries\L6470" "C:\Users\TK_T530\AppData\Local\Temp\arduino_build_426690\sketch\L6470.ino.cpp" -o "nul"
"C:\Users\TK_T530\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/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=atmega2560 -DF_CPU=16000000L -DARDUINO=10802 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR   "-IC:\Users\TK_T530\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.21\cores\arduino" "-IC:\Users\TK_T530\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.21\variants\mega" "-IC:\Users\TK_T530\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.21\libraries\SPI\src" "-IC:\Users\TK_T530\Documents\Arduino\libraries\L6470" "C:\Users\TK_T530\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.21\libraries\SPI\src\SPI.cpp" -o "nul"
"C:\Users\TK_T530\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/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=atmega2560 -DF_CPU=16000000L -DARDUINO=10802 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR   "-IC:\Users\TK_T530\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.21\cores\arduino" "-IC:\Users\TK_T530\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.21\variants\mega" "-IC:\Users\TK_T530\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.21\libraries\SPI\src" "-IC:\Users\TK_T530\Documents\Arduino\libraries\L6470" "C:\Users\TK_T530\Documents\Arduino\libraries\L6470\L6470.cpp" -o "nul"
Generating function prototypes...
"C:\Users\TK_T530\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/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=atmega2560 -DF_CPU=16000000L -DARDUINO=10802 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR   "-IC:\Users\TK_T530\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.21\cores\arduino" "-IC:\Users\TK_T530\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.21\variants\mega" "-IC:\Users\TK_T530\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.21\libraries\SPI\src" "-IC:\Users\TK_T530\Documents\Arduino\libraries\L6470" "C:\Users\TK_T530\AppData\Local\Temp\arduino_build_426690\sketch\L6470.ino.cpp" -o "C:\Users\TK_T530\AppData\Local\Temp\arduino_build_426690\preproc\ctags_target_for_gcc_minus_e.cpp"
"C:\Program Files (x86)\Arduino\tools-builder\ctags\5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "C:\Users\TK_T530\AppData\Local\Temp\arduino_build_426690\preproc\ctags_target_for_gcc_minus_e.cpp"
Sketch wird kompiliert...
"C:\Users\TK_T530\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -flto -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10802 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR   "-IC:\Users\TK_T530\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.21\cores\arduino" "-IC:\Users\TK_T530\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.21\variants\mega" "-IC:\Users\TK_T530\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.21\libraries\SPI\src" "-IC:\Users\TK_T530\Documents\Arduino\libraries\L6470" "C:\Users\TK_T530\AppData\Local\Temp\arduino_build_426690\sketch\L6470.ino.cpp" -o "C:\Users\TK_T530\AppData\Local\Temp\arduino_build_426690\sketch\L6470.ino.cpp.o"
Compiling libraries...
Compiling library "SPI"
"C:\Users\TK_T530\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -flto -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10802 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR   "-IC:\Users\TK_T530\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.21\cores\arduino" "-IC:\Users\TK_T530\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.21\variants\mega" "-IC:\Users\TK_T530\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.21\libraries\SPI\src" "-IC:\Users\TK_T530\Documents\Arduino\libraries\L6470" "C:\Users\TK_T530\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.21\libraries\SPI\src\SPI.cpp" -o "C:\Users\TK_T530\AppData\Local\Temp\arduino_build_426690\libraries\SPI\SPI.cpp.o"
Compiling library "L6470"
"C:\Users\TK_T530\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -flto -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10802 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR   "-IC:\Users\TK_T530\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.21\cores\arduino" "-IC:\Users\TK_T530\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.21\variants\mega" "-IC:\Users\TK_T530\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.21\libraries\SPI\src" "-IC:\Users\TK_T530\Documents\Arduino\libraries\L6470" "C:\Users\TK_T530\Documents\Arduino\libraries\L6470\L6470.cpp" -o "C:\Users\TK_T530\AppData\Local\Temp\arduino_build_426690\libraries\L6470\L6470.cpp.o"
C:\Users\TK_T530\Documents\Arduino\libraries\L6470\L6470.cpp: In member function 'int L6470::getStatus()':

C:\Users\TK_T530\Documents\Arduino\libraries\L6470\L6470.cpp:316:10: error: expected primary-expression before '=' token

   return = Xfer(0) << 8 | Xfer(0);

          ^

C:\Users\TK_T530\Documents\Arduino\libraries\L6470\L6470.cpp: In member function 'long unsigned int L6470::AccCalc(float)':

C:\Users\TK_T530\Documents\Arduino\libraries\L6470\L6470.cpp:325:28: error: expected ';' before ':' token

   return temp < 0x00000FFF : temp : 0x00000FFF;

                            ^

C:\Users\TK_T530\Documents\Arduino\libraries\L6470\L6470.cpp:325:28: error: expected primary-expression before ':' token

C:\Users\TK_T530\Documents\Arduino\libraries\L6470\L6470.cpp: In member function 'long unsigned int L6470::DecCalc(float)':

C:\Users\TK_T530\Documents\Arduino\libraries\L6470\L6470.cpp:332:28: error: expected ';' before ':' token

   return temp < 0x00000FFF : temp : 0x00000FFF;

                            ^

C:\Users\TK_T530\Documents\Arduino\libraries\L6470\L6470.cpp:332:28: error: expected primary-expression before ':' token

C:\Users\TK_T530\Documents\Arduino\libraries\L6470\L6470.cpp: In member function 'long unsigned int L6470::MaxSpdCalc(float)':

C:\Users\TK_T530\Documents\Arduino\libraries\L6470\L6470.cpp:341:28: error: expected ';' before ':' token

   return temp < 0x000003FF : temp : 0x000003FF;

                            ^

C:\Users\TK_T530\Documents\Arduino\libraries\L6470\L6470.cpp:341:28: error: expected primary-expression before ':' token

C:\Users\TK_T530\Documents\Arduino\libraries\L6470\L6470.cpp: In member function 'long unsigned int L6470::MinSpdCalc(float)':

C:\Users\TK_T530\Documents\Arduino\libraries\L6470\L6470.cpp:350:28: error: expected ';' before ':' token

   return temp < 0x00000FFF : temp : 0x00000FFF;

                            ^

C:\Users\TK_T530\Documents\Arduino\libraries\L6470\L6470.cpp:350:28: error: expected primary-expression before ':' token

C:\Users\TK_T530\Documents\Arduino\libraries\L6470\L6470.cpp: In member function 'long unsigned int L6470::FSCalc(float)':

C:\Users\TK_T530\Documents\Arduino\libraries\L6470\L6470.cpp:359:28: error: expected ';' before ':' token

   return temp < 0x000003FF : temp : 0x000003FF;

                            ^

C:\Users\TK_T530\Documents\Arduino\libraries\L6470\L6470.cpp:359:28: error: expected primary-expression before ':' token

C:\Users\TK_T530\Documents\Arduino\libraries\L6470\L6470.cpp: In member function 'long unsigned int L6470::IntSpdCalc(float)':

C:\Users\TK_T530\Documents\Arduino\libraries\L6470\L6470.cpp:368:28: error: expected ';' before ':' token

   return temp < 0x00003FFF : temp : 0x00003FFF;

                            ^

C:\Users\TK_T530\Documents\Arduino\libraries\L6470\L6470.cpp:368:28: error: expected primary-expression before ':' token

C:\Users\TK_T530\Documents\Arduino\libraries\L6470\L6470.cpp: In member function 'long unsigned int L6470::SpdCalc(float)':

C:\Users\TK_T530\Documents\Arduino\libraries\L6470\L6470.cpp:377:28: error: expected ';' before ':' token

   return temp < 0x000FFFFF : temp : 0x000FFFFF;

                            ^

C:\Users\TK_T530\Documents\Arduino\libraries\L6470\L6470.cpp:377:28: error: expected primary-expression before ':' token

Bibliothek SPI in Version 1.0 im Ordner: C:\Users\TK_T530\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.21\libraries\SPI  wird verwendet
Bibliothek L6470 im Ordner: C:\Users\TK_T530\Documents\Arduino\libraries\L6470 (legacy) wird verwendet
exit status 1
Fehler beim Kompilieren für das Board Arduino/Genuino Mega or Mega 2560.

Run on ESP8266/32

Hi, while this compiles fine for the esp8266 it doesn't actually work.
What would be required for it to work on ESPs?
There are currently no available library's for the L6470 and yours looks like the closest to be able to get working.
Thanks

Errors and Warnings

.piolibdeps/3cd0993/L6470.h:189:0: warning: "DEC" redefined
#define DEC                  0x06

This name is defined by arduino/Print.h as a flag to print in base 10.

Serial.println('good to go');
Serial.println('Comm issue');

These strings should be double-quoted. A PR for that is pending.

debug/tune utilities support/implementation

I realized quickly that run time utilities to return status and set various parameters would be very useful. The biggest problem I had was accessing specific drivers with statements like:

LOOPXYZE(I) {
  get status(I)
  set parameter(I)
}

The solution I came up with was:

  • Create case statements at compile time #if def HAS_L64770_AXIS_Z .. case 3: {stepper##Q.getStatus(); break;}
  • Modify L6470::L6470( to accept more arguments and create arrays
extern uint8_t L6470_chain[L6470_driver(20 + 1]; // 0 - number of drivers in chain, 1... axis 
uint8_t L6470_chain[L6470_driver(MAX_L6470) + 1]; // 0 - number of drivers in chain, 1... axis
L6470::L6470(const int SSPin, const byte axis, const byte position) {
  //  _SSPin = SSPin;
  _SSPin = L6470_SS_PIN;
  // Serial.begin(9600);
  Axis = axis;
  _Position = position;
  L6470_chain[0]++;
  L6470_chain[position] = axis

I'd be surprised if there wasn't a much better method. Suggestions?

a small mistake in src/l6470.h

In L6470.h line 203 to 206, the status register of MOT_STATUS is bit 6 and bit 5, so I think the code should be modified from
STATUS_MOT_STATUS_STOPPED (0x0000<<13)
to
STATUS_MOT_STATUS_STOPPED (0x0000<<5)

Because if you left shift 13 bits, it would be bit 14 and bit 13.

External SPI driver

One of the things I did to implement the SPI chain for the Nucleo boards was to hardwire in a new SPI routine.

I'd appreciate suggestions on how to setup the library so that it can be directed to an optional L6470 specific SPI channel.


The only way I know is to test for a build flag, NOT compile the library's transfer function and depend of the project to provide it.

Something like this

PlatformIO.ini
   build_flags    = -DL6470_EXT_SPI

L6470.cpp
  #ifndef L6470_EXT_SPI
      byte L6470::Xfer(byte data) {
     …
  #endif
  
project file
  #ifdef L6470_EXT_SPI
      byte L6470::Xfer(byte data) {
     …
  #endif


The problem with this approach is the Arduino IDE doesn't have a way of creating the build flag. This would be Marlin specific.


I'd rather do something like #ifdef "file in project" but I don't think the C preprocessor can do that.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.