As for Firmware, I posted this last week on another thread on here... Here's a copy and paste of what I posted...
It sucks the rambo doesn't have very much in terms of technical documentation (especially v1.3, pretty much nothing)... To find the best pins and voltages, I literally had to unravel the schematic because the only schematic that gives (accurate) digital pin outs was for the v1.1... So I literally had to solve a riddle to figure out which pins (that weren't already used) go where... That's what took the longest for me... I'm a computer science guy by trade, coding is one of my strengths... So I had the firmware good before I even started with the electrical... However, The digipot is still a riddle to me right now...
I found the nomenclature for the digipot and looked up the manufactures specifications and data sheets. It's a 6 channel digipot, but only 5 of those channels are declared in the code... The main channel line is declared in pins.h
Code: Select all
#define DIGIPOT_CHANNELS {4,5,3,0,1} // X,Y,Z,E0,E1
To me, this is a very odd array of channels, especially when you look at the board - it makes no sense why they would number it that way... clearly there are 6 overall channels and channel 2 (or 3 if you're starting with 1) is not used...So there is an open channel on the digipot, it's just a matter of finding where it leads to... I would imagine, since the digipot's primary concern is current control and micro stepping, that the vmot aux that I showed in the video (the one seeme uses as a board fan) is actually that 6th channels voltage out, or can at least be mapped to it... Even more proof is that, the 12v (vmot) out is also under the same fuse as the rest of the motors... and then the microstepping pins (MS1 and MS2 for 4982) route out to the analog auxiliary due to the fact that the majority of the MS pins are in the pin 60-69 range - which is also the auxiliary out ports' range... But like I said, the documentation to verify all this is nonexistent, so I'm literally solving this problem like a detective... I would love to have at least one accurate pinout/schematic... Their github doesn't even have anything of great use... Even an eagle file would be great... I mean, the board exists, it had to be made somehow, this shit does exist somewhere.
So I ended up adding another channel to the array (2) for the third extruder
Code: Select all
#define DIGIPOT_CHANNELS {4,5,3,0,1,2} // X,Y,Z,E0,E1,E2
The objects/constructors for the digipot channels are constructed in commands.cpp here...
Code: Select all
#if STEPPER_CURRENT_CONTROL==CURRENT_CONTROL_DIGIPOT
// Digipot methods for controling current and microstepping
#if defined(DIGIPOTSS_PIN) && DIGIPOTSS_PIN > -1
int digitalPotWrite(int address, unsigned int value) // From Arduino DigitalPotControl example
{
WRITE(DIGIPOTSS_PIN,LOW); // take the SS pin low to select the chip
HAL::spiSend(address); // send in the address and value via SPI:
HAL::spiSend(value);
WRITE(DIGIPOTSS_PIN,HIGH); // take the SS pin high to de-select the chip:
//delay(10);
}
void setMotorCurrent(uint8_t driver, unsigned int current)
{
const uint8_t digipot_ch[] = DIGIPOT_CHANNELS;
digitalPotWrite(digipot_ch[driver], current);
}
#endif
void motorCurrentControlInit() //Initialize Digipot Motor Current
{
#if DIGIPOTSS_PIN && DIGIPOTSS_PIN > -1
const uint8_t digipot_motor_current[] = MOTOR_CURRENT;
HAL::spiInit(0); //SPI.begin();
SET_OUTPUT(DIGIPOTSS_PIN);
for(int i=0; i<=4; i++)
//digitalPotWrite(digipot_ch[i], digipot_motor_current[i]);
setMotorCurrent(i,digipot_motor_current[i]);
#endif
In the same file "commands.cpp" I added my Extruder2 (3) variables and identities, only a few lines... but it all compiled and didn't throw back any pointers, throw exceptions, errors or whatever shit the compiler usually wants to give me in error... So the digipot must be using those added pins and controlling them because the motor is spinning after all... So I'm not sure if it's magic, or if I actually figured it out...
NOTE: Arduino's compiler is
NOT backwards compatible with repetier firmware... This FW is written in Rep v0.91, the new version is v0.92... This code
WILL compile in arduino 1.6.5, however, it
WILL NOT compile in 1.6.6 or newer... And visa-versa - Rep FW v0.92 will compile in 1.6.6 and newer, but not in 1.6.5 or older...
SOLUTION: tough shit? uninstall arduino IDE and reinstall it with the version that will work... It's a pain in the ass, but arduino is a glorified text editor -
AT BEST - it's not comprehensive IDE like Eclipse or Netbeans... So there's a lot of short comings with Arduino IDE in terms of debugging and configuring advanced FW packages like this one... Someone should really create a new IDE with ardiuno API so it would be easier to configure stuff like this...
There are only a few lines of REAL source code I changed outside of the basic macro declaration header files - pins.h and configuration.h - that most people like to call "the code", but they've never touched any other file and would be completely lost 5 lines into any of the cpp files... But Repetier is good code, and a good sign of good code is scalability and object orientedness, so I didn't have to do much and had very little trouble throwing those lines in there and getting it to compile without issue.
Code: Select all
#if defined(X_MS1_PIN) && X_MS1_PIN > -1
void microstepMS(uint8_t driver, int8_t ms1, int8_t ms2)
{
if(ms1 > -1) switch(driver)
{
case 0:
WRITE( X_MS1_PIN,ms1);
break;
case 1:
WRITE( Y_MS1_PIN,ms1);
break;
case 2:
WRITE( Z_MS1_PIN,ms1);
break;
case 3:
WRITE(E0_MS1_PIN,ms1);
break;
case 4:
WRITE(E1_MS1_PIN,ms1);
break;
case 5:
WRITE(E2_MS1_PIN,ms1);
break;
}
if(ms2 > -1) switch(driver)
{
case 0:
WRITE( X_MS2_PIN,ms2);
break;
case 1:
WRITE( Y_MS2_PIN,ms2);
break;
case 2:
WRITE( Z_MS2_PIN,ms2);
break;
case 3:
WRITE(E0_MS2_PIN,ms2);
break;
case 4:
WRITE(E1_MS2_PIN,ms2);
break;
case 5:
WRITE(E2_MS2_PIN,ms2);
break;
}
}
void microstepMode(uint8_t driver, uint8_t stepping_mode)
{
switch(stepping_mode)
{
case 1:
microstepMS(driver,MICROSTEP1);
break;
case 2:
microstepMS(driver,MICROSTEP2);
break;
case 4:
microstepMS(driver,MICROSTEP4);
break;
case 8:
microstepMS(driver,MICROSTEP8);
break;
case 16:
microstepMS(driver,MICROSTEP16);
break;
}
}
void microstepReadings()
{
Com::printFLN(Com::tMS1MS2Pins);
Com::printF(Com::tXColon,READ(X_MS1_PIN));
Com::printFLN(Com::tComma,READ(X_MS2_PIN));
Com::printF(Com::tYColon,READ(Y_MS1_PIN));
Com::printFLN(Com::tComma,READ(Y_MS2_PIN));
Com::printF(Com::tZColon,READ(Z_MS1_PIN));
Com::printFLN(Com::tComma,READ(Z_MS2_PIN));
Com::printF(Com::tE0Colon,READ(E0_MS1_PIN));
Com::printFLN(Com::tComma,READ(E0_MS2_PIN));
Com::printF(Com::tE1Colon,READ(E1_MS1_PIN));
Com::printFLN(Com::tComma,READ(E1_MS2_PIN));
Com::printF(Com::tE2Colon,READ(E2_MS1_PIN));
Com::printFLN(Com::tComma,READ(E2_MS2_PIN));
}
#endif
void microstepInit()
{
#if defined(X_MS1_PIN) && X_MS1_PIN > -1
const uint8_t microstep_modes[] = MICROSTEP_MODES;
SET_OUTPUT(X_MS2_PIN);
SET_OUTPUT(Y_MS2_PIN);
SET_OUTPUT(Z_MS2_PIN);
SET_OUTPUT(E0_MS2_PIN);
SET_OUTPUT(E1_MS2_PIN);
SET_OUTPUT(E2_MS1_PIN);
SET_OUTPUT(E2_MS2_PIN);
SET_OUTPUT(E2_MS3_PIN);
for(int i=0; i<=4; i++) microstepMode(i,microstep_modes[i]);
#endif
I'm not too far away though, I have the stepper motor spinning as third extruder through repetier, so the hard part is done... now I just need to fine tune everything and get all my steps, current, heat, etc all together... It should be about another week and I'll be done...