raschemmel,
I'm a bit confused by the code that I've run across and am using.
1st of all, I originally used the AutoDriver.h library, but 2 things were happening:
- the board would get very hot even when using a single small stepper) to the point of "runaway" while checking with my remote thermometer.
- I was not getting the speed I wanted, and from what I had read up on the L6470's I should have been getting much higher speeds.
I guess i got a bit ahead of myself with my prior posts, I should have referenced this site from where I picked up the original code:
https://codebender.cc/example/AutoDriver/dSPIN_example:dSPIN_support
if you go there, you'll notice that there are 4 files: 3 ino sketches and the "L6470.h" header.
it seems i have to bring in all the files into a folder: "dSPIN_example".
I then open "dSPIN_example" and the other 2 "ino" sketches appear in different tabs on my Arduino IDE.
The actual "setup()" and "loop()" calls are in the "dSPIN_example.ino" sketch, as are the PIN assignments.
I remind you that I'm using the "MEGA 2560" board. and the SPI assignments I've used are as follows:
#include <SPI.h> // include the SPI library:
#include "L6470.h" // include the register and bit definitions
#define SLAVE_SELECT_PIN 53 //10 // Wire this to the CSN pin
#define MOSI 51 //11 // Wire this to the SDI pin
#define MISO 50 //12 // Wire this to the SDO pin
#define SCK 52 //13 // Wire this to the CK pin
#define dSPIN_RESET 6 //17 // Wire this to the STBY line
#define dSPIN_BUSYN 5 //16 // Wire this to the BSYN line
#define STAT1 13 // Hooked to an LED on the test jig
#define STAT2 15 // Hooked to an LED on the test jig
#define SWITCH 8 // Hooked to the switch input and a pB on the jig
I'm not really using the last 3 lines.
so - as you can see and to answer your question... on the Mega board, pin 53 is the Slave_Select_Pin. I've commented out the original PINS in that they were set for an UNO setup.
I think part of my problem here is that this code (all 3 sketches) don't seem to #Define a board as you would do if one used the library "AutoDriver". If you used that Library, you could define "instances" <-- right word? to refer to the boards like:
AutoDriver boardA(10, 6);
AutoDriver boardB(14, 6);
... Which define the boards and the pins used to refer to them.
this is very frustrating in that I feel there is a simple solution to addressing each board inside the sketch, and if I can get to it, I'll be on my way.
thanks for keeping up w/this.
Russ from Coral Springs, Fl.