TMC serial multiplexer, FYSETC AIO-II (#18080)

This commit is contained in:
George Fu 2020-05-26 04:48:33 +08:00 committed by GitHub
parent 8c0c8e4046
commit fe7452c5cb
Signed by: GitHub
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 36 additions and 42 deletions

View file

@ -149,9 +149,13 @@ class TMCMarlin<TMC2208Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> : public TMC220
TMCMarlin(Stream * SerialPort, const float RS, const uint8_t) :
TMC2208Stepper(SerialPort, RS)
{}
TMCMarlin(Stream * SerialPort, const float RS, uint8_t addr, const uint16_t mul_pin1, const uint16_t mul_pin2) :
TMC2208Stepper(SerialPort, RS, addr, mul_pin1, mul_pin2)
{}
TMCMarlin(const uint16_t RX, const uint16_t TX, const float RS, const uint8_t, const bool has_rx=true) :
TMC2208Stepper(RX, TX, RS, has_rx)
{}
uint16_t rms_current() { return TMC2208Stepper::rms_current(); }
inline void rms_current(const uint16_t mA) {
this->val_mA = mA;

View file

@ -49,7 +49,11 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E };
#define __TMC_SPI_DEFINE(IC, ST, L, AI) TMCMarlin<IC##Stepper, L, AI> stepper##ST(ST##_CS_PIN, float(ST##_RSENSE), ST##_CHAIN_POS)
#endif
#if ENABLED(TMC_SERIAL_MULTIPLEXER)
#define TMC_UART_HW_DEFINE(IC, ST, L, AI) TMCMarlin<IC##Stepper, L, AI> stepper##ST(&ST##_HARDWARE_SERIAL, float(ST##_RSENSE), ST##_SLAVE_ADDRESS, SERIAL_MUL_PIN1, SERIAL_MUL_PIN2)
#else
#define TMC_UART_HW_DEFINE(IC, ST, L, AI) TMCMarlin<IC##Stepper, L, AI> stepper##ST(&ST##_HARDWARE_SERIAL, float(ST##_RSENSE), ST##_SLAVE_ADDRESS)
#endif
#define TMC_UART_SW_DEFINE(IC, ST, L, AI) TMCMarlin<IC##Stepper, L, AI> stepper##ST(ST##_SERIAL_RX_PIN, ST##_SERIAL_TX_PIN, float(ST##_RSENSE), ST##_SLAVE_ADDRESS, ST##_SERIAL_RX_PIN > -1)
#define _TMC_SPI_DEFINE(IC, ST, AI) __TMC_SPI_DEFINE(IC, ST, TMC_##ST##_LABEL, AI)

View file

@ -30,7 +30,7 @@
#define DISABLE_JTAG
#define pins_v2_20190128 // geo-f:add for new pins define
#define pins_v2_20190128 // new pins define
// Ignore temp readings during development.
//#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000
@ -84,32 +84,32 @@
#define E0_DIR_PIN PC14
#define E0_ENABLE_PIN PC13
#if HAS_TMC220x
/**
* TMC2208/TMC2209 stepper drivers
*/
//
// Hardware serial with switch
//
#define X_HARDWARE_SERIAL Serial1
#define Y_HARDWARE_SERIAL Serial1
#define Z_HARDWARE_SERIAL Serial1
#define E0_HARDWARE_SERIAL Serial1
#define TMC_SERIAL_MULTIPLEXER
#define SERIAL_MUL_PIN1 PB13
#define SERIAL_MUL_PIN2 PB12
#endif
//
// Stepper current PWM
//
// X:PA2 Y:PA3 Z:PB12 E:PB13 // changed for test
//#define MOTOR_CURRENT_PWM_XY_PIN PA3
//#define MOTOR_CURRENT_PWM_Z_PIN PA2 // PB12
//#define MOTOR_CURRENT_PWM_XY_PIN PB6
//#define MOTOR_CURRENT_PWM_Z_PIN PB7 // PB12
//#define MOTOR_CURRENT_PWM_E_PIN -1 // PB13
// Motor current PWM conversion, PWM value = MotorCurrentSetting * 255 / range
#ifndef MOTOR_CURRENT_PWM_RANGE
#define MOTOR_CURRENT_PWM_RANGE 1500 // geo-f:old 2000
#define MOTOR_CURRENT_PWM_RANGE 1500 // origin:2000
#endif
#define DEFAULT_PWM_MOTOR_CURRENT {500, 500, 400} // geo-f:old 1300 1300 1250
// 采用 SDIO PCB从左到右数
// 1:PC10 - SDIO_D2
// 2:PC11 - SDIO_D3
// 3:PD2 - SDIO_CMD
// 4:VCC
// 5:PC12 - SDIO_CK
// 6:VDD
// 7:PC8 - SDIO_D0
// 8:PC9 - SDIO_D1
// 9:PA15 - SD_DETECT_PIN
#define DEFAULT_PWM_MOTOR_CURRENT { 500, 500, 400 } // origin: {1300,1300,1250}
//
// Heaters / Fans

View file

@ -393,7 +393,7 @@ void CardReader::manage_media() {
if (stat) { // Media Inserted
safe_delay(500); // Some boards need a delay to get settled
mount(); // Try to mount the media
#if MB(FYSETC_CHEETAH)
#if MB(FYSETC_CHEETAH, FYSETC_AIO_II)
reset_stepper_drivers(); // Workaround for Cheetah bug
#endif
if (!isMounted()) stat = 0; // Not mounted?

View file

@ -2,7 +2,10 @@ from os.path import join
from os.path import expandvars
Import("env", "projenv")
# Relocate firmware from 0x08000000 to 0x08002000
# Relocate firmware from 0x08000000 to 0x08010000
# for define in env['CPPDEFINES']:
# if define[0] == "VECT_TAB_ADDR":
# env['CPPDEFINES'].remove(define)
#env['CPPDEFINES'].remove(("VECT_TAB_ADDR", 134217728))
#env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x08010000"))
@ -14,14 +17,6 @@ env.AddPostAction(
"\"" + join("$BUILD_DIR","${PROGNAME}.hex") + "\"", # Note: $BUILD_DIR is a full path
]), "Building $TARGET"))
# please keep $SOURCE variable, it will be replaced with a path to firmware
# Generic
#env.Replace(
# UPLOADER="serial_upload.bat"
# UPLOADCMD="$UPLOADER stm32loader.py $SOURCE"
#)
# In-line command with arguments
UPLOAD_TOOL="stm32flash"
platform = env.PioPlatform()
@ -32,12 +27,3 @@ env.Replace(
UPLOADER=UPLOAD_TOOL,
UPLOADCMD=expandvars(UPLOAD_TOOL + " -v -i rts,-dtr,dtr -R -b 115200 -g 0x8000000 -w \"" + join("$BUILD_DIR","${PROGNAME}.hex")+"\"" + " $UPLOAD_PORT")
)
# Python callback
#def on_upload(source, target, env):
# print source, target
# firmware_path = str(source[0])
# # do something
# env.Execute(".\serial_upload.bat")
#env.Replace(UPLOADCMD=on_upload)