Browse Source

Add Ultiboard2 electronics. With PWM current settings. For the few people that have this new board as experiment in their UM-Original.

daid 10 years ago
parent
commit
380144c20f
3 changed files with 110 additions and 0 deletions
  1. 9
    0
      Marlin/Marlin_main.cpp
  2. 83
    0
      Marlin/pins.h
  3. 18
    0
      Marlin/stepper.cpp

+ 9
- 0
Marlin/Marlin_main.cpp View File

@@ -2778,6 +2778,15 @@ void process_commands()
2778 2778
         if(code_seen('B')) digipot_current(4,code_value());
2779 2779
         if(code_seen('S')) for(int i=0;i<=4;i++) digipot_current(i,code_value());
2780 2780
       #endif
2781
+      #ifdef MOTOR_CURRENT_PWM_XY_PIN
2782
+        if(code_seen('X')) digipot_current(0, code_value());
2783
+      #endif
2784
+      #ifdef MOTOR_CURRENT_PWM_Z_PIN
2785
+        if(code_seen('Z')) digipot_current(1, code_value());
2786
+      #endif
2787
+      #ifdef MOTOR_CURRENT_PWM_E_PIN
2788
+        if(code_seen('E')) digipot_current(2, code_value());
2789
+      #endif
2781 2790
     }
2782 2791
     break;
2783 2792
     case 908: // M908 Control digital trimpot directly.

+ 83
- 0
Marlin/pins.h View File

@@ -1295,6 +1295,89 @@
1295 1295
 
1296 1296
 #endif
1297 1297
 
1298
+#if MOTHERBOARD == 72
1299
+#define KNOWN_BOARD
1300
+/*****************************************************************
1301
+* Ultiboard v2.0 pin assignment
1302
+******************************************************************/
1303
+
1304
+#ifndef __AVR_ATmega2560__
1305
+ #error Oops!  Make sure you have 'Arduino Mega 2560' selected from the 'Tools -> Boards' menu.
1306
+#endif
1307
+
1308
+#define X_STEP_PIN 25
1309
+#define X_DIR_PIN 23
1310
+#define X_STOP_PIN 22
1311
+#define X_ENABLE_PIN 27
1312
+
1313
+#define Y_STEP_PIN 32
1314
+#define Y_DIR_PIN 33
1315
+#define Y_STOP_PIN 26
1316
+#define Y_ENABLE_PIN 31
1317
+
1318
+#define Z_STEP_PIN 35
1319
+#define Z_DIR_PIN 36
1320
+#define Z_STOP_PIN 29
1321
+#define Z_ENABLE_PIN 34
1322
+
1323
+#define HEATER_BED_PIN 4
1324
+#define TEMP_BED_PIN 10
1325
+
1326
+#define HEATER_0_PIN  2
1327
+#define TEMP_0_PIN 8
1328
+
1329
+#define HEATER_1_PIN 3
1330
+#define TEMP_1_PIN 9
1331
+
1332
+#define HEATER_2_PIN -1
1333
+#define TEMP_2_PIN -1
1334
+
1335
+#define E0_STEP_PIN         42
1336
+#define E0_DIR_PIN          43
1337
+#define E0_ENABLE_PIN       37
1338
+
1339
+#define E1_STEP_PIN         49
1340
+#define E1_DIR_PIN          47
1341
+#define E1_ENABLE_PIN       48
1342
+
1343
+#define SDPOWER            -1
1344
+#define SDSS               53
1345
+#define LED_PIN            8
1346
+#define FAN_PIN            7
1347
+#define PS_ON_PIN          12
1348
+#define KILL_PIN           -1
1349
+#define SUICIDE_PIN        -1  //PIN that has to be turned on right after start, to keep power flowing.
1350
+#define SAFETY_TRIGGERED_PIN     28 //PIN to detect the safety circuit has triggered
1351
+#define MAIN_VOLTAGE_MEASURE_PIN 14 //Analogue PIN to measure the main voltage, with a 100k - 4k7 resitor divider.
1352
+
1353
+#define MOTOR_CURRENT_PWM_XY_PIN 44
1354
+#define MOTOR_CURRENT_PWM_Z_PIN 45
1355
+#define MOTOR_CURRENT_PWM_E_PIN 46
1356
+//Motor current PWM conversion, PWM value = MotorCurrentSetting * 255 / range
1357
+#define MOTOR_CURRENT_PWM_RANGE 2000
1358
+
1359
+//arduino pin witch triggers an piezzo beeper
1360
+#define BEEPER 18
1361
+
1362
+#define LCD_PINS_RS 20
1363
+#define LCD_PINS_ENABLE 15
1364
+#define LCD_PINS_D4 14
1365
+#define LCD_PINS_D5 21
1366
+#define LCD_PINS_D6 5
1367
+#define LCD_PINS_D7 6
1368
+
1369
+//buttons are directly attached
1370
+#define BTN_EN1 40
1371
+#define BTN_EN2 41
1372
+#define BTN_ENC 19  //the click
1373
+
1374
+#define BLEN_C 2
1375
+#define BLEN_B 1
1376
+#define BLEN_A 0
1377
+
1378
+#define SDCARDDETECT 39
1379
+
1380
+#endif//MOTHERBOARD == 72
1298 1381
 
1299 1382
 /****************************************************************************************
1300 1383
 * RUMBA pin assignment

+ 18
- 0
Marlin/stepper.cpp View File

@@ -72,6 +72,9 @@ static volatile bool endstop_z_hit=false;
72 72
 #ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
73 73
 bool abort_on_endstop_hit = false;
74 74
 #endif
75
+#ifdef MOTOR_CURRENT_PWM_XY_PIN
76
+  int motor_current_setting[3] = DEFAULT_PWM_MOTOR_CURRENT;
77
+#endif
75 78
 
76 79
 static bool old_x_min_endstop=false;
77 80
 static bool old_x_max_endstop=false;
@@ -1198,6 +1201,16 @@ void digipot_init() //Initialize Digipot Motor Current
1198 1201
       //digitalPotWrite(digipot_ch[i], digipot_motor_current[i]);
1199 1202
       digipot_current(i,digipot_motor_current[i]);
1200 1203
   #endif
1204
+  #ifdef MOTOR_CURRENT_PWM_XY_PIN
1205
+    pinMode(MOTOR_CURRENT_PWM_XY_PIN, OUTPUT);
1206
+    pinMode(MOTOR_CURRENT_PWM_Z_PIN, OUTPUT);
1207
+    pinMode(MOTOR_CURRENT_PWM_E_PIN, OUTPUT);
1208
+    digipot_current(0, motor_current_setting[0]);
1209
+    digipot_current(1, motor_current_setting[1]);
1210
+    digipot_current(2, motor_current_setting[2]);
1211
+    //Set timer5 to 31khz so the PWM of the motor power is as constant as possible. (removes a buzzing noise)
1212
+    TCCR5B = (TCCR5B & ~(_BV(CS50) | _BV(CS51) | _BV(CS52))) | _BV(CS50);
1213
+  #endif
1201 1214
 }
1202 1215
 
1203 1216
 void digipot_current(uint8_t driver, int current)
@@ -1206,6 +1219,11 @@ void digipot_current(uint8_t driver, int current)
1206 1219
     const uint8_t digipot_ch[] = DIGIPOT_CHANNELS;
1207 1220
     digitalPotWrite(digipot_ch[driver], current);
1208 1221
   #endif
1222
+  #ifdef MOTOR_CURRENT_PWM_XY_PIN
1223
+  if (driver == 0) analogWrite(MOTOR_CURRENT_PWM_XY_PIN, (long)current * 255L / (long)MOTOR_CURRENT_PWM_RANGE);
1224
+  if (driver == 1) analogWrite(MOTOR_CURRENT_PWM_Z_PIN, (long)current * 255L / (long)MOTOR_CURRENT_PWM_RANGE);
1225
+  if (driver == 2) analogWrite(MOTOR_CURRENT_PWM_E_PIN, (long)current * 255L / (long)MOTOR_CURRENT_PWM_RANGE);
1226
+  #endif
1209 1227
 }
1210 1228
 
1211 1229
 void microstep_init()

Loading…
Cancel
Save