STEPPER_TMC5160_HW_SPI con dev2

Buongiorno a tutti

Non riesco a compilare con il driver STEPPER_TMC5160_HW_SPI

Configuration_io.h
/*

This file defines io solutions used. This is the lowest level and is the base
for all higher level functions using io operations. At several places we need
subsets of these list of operations. To make configuration easy and easy to
understand, we use a technique called "x macros". This requires that only
predefined macro names for IO are used here. Do NOT add anything else here
or compilation/functionality will break.

Rules:
1. Each definition will create a class that is named like the first parameter.
This class is later used as input to templates building higher functions. By
convention the names should start with IO followed by something that helps you
identify the function.
2. Do not use a semicolon at the end. Macro definition gets different meanings
and will add the semicolon if required.

*/

/* Define motor pins here. Each motor needs a setp, dir and enable pin. */

ENDSTOP_NONE(endstopNone)
// For use when no output is wanted, but possible
IO_OUTPUT_FAKE(fakeOut)
IO_PWM_FAKE(PWMfakeOut)

// X Motor

IO_OUTPUT(IOX1Step, ORIG_X_STEP_PIN)
IO_OUTPUT(IOX1Dir, ORIG_X_DIR_PIN)
IO_OUTPUT(IOX1Enable, ORIG_X_ENABLE_PIN)

// Y Motor

IO_OUTPUT(IOY1Step, ORIG_Y_STEP_PIN)
IO_OUTPUT_INVERTED(IOY1Dir, ORIG_Y_DIR_PIN)
IO_OUTPUT(IOY1Enable, ORIG_Y_ENABLE_PIN)

// Z Motor

IO_OUTPUT(IOZ1Step, ORIG_Z_STEP_PIN)
IO_OUTPUT(IOZ1Dir, ORIG_Z_DIR_PIN)
IO_OUTPUT(IOZ1Enable, ORIG_Z_ENABLE_PIN)
IO_OUTPUT(IOZ1cs, ORIG_Z_CS_PIN)

// E0 Motor

IO_OUTPUT(IOE1Step, ORIG_E0_STEP_PIN)
IO_OUTPUT_INVERTED(IOE1Dir, ORIG_E0_DIR_PIN)
IO_OUTPUT_INVERTED(IOE1Enable, ORIG_E0_ENABLE_PIN)

// E1 Motor

IO_OUTPUT(IOE2Step, ORIG_E1_STEP_PIN)
IO_OUTPUT(IOE2Dir, ORIG_E1_DIR_PIN)
IO_OUTPUT_INVERTED(IOE2Enable, ORIG_E1_ENABLE_PIN)

// E2 Motor

IO_OUTPUT(IOE3Step, ORIG_E2_STEP_PIN)
IO_OUTPUT(IOE3Dir, ORIG_E2_DIR_PIN)
IO_OUTPUT(IOE3Enable, ORIG_E2_ENABLE_PIN)


// Autolevel Motor 1

//IO_OUTPUT(IOAL1Step, 51)
//IO_OUTPUT(IOAL1Dir, 53)
//IO_OUTPUT_INVERTED(IOAL1Enable, 49)

// Autolevel Motor 1

//IO_OUTPUT(IOAL2Step, 39)
//IO_OUTPUT(IOAL2Dir, 13)
//IO_OUTPUT_INVERTED(IOAL2Enable, 40)

// Servo output

//IO_OUTPUT(Servo1Pin, 5)

// Define your endstops inputs

IO_INPUT(IOEndstopXMin, ORIG_X_MIN_PIN)
IO_INPUT(IOEndstopXMax, ORIG_X_MAX_PIN)
IO_INPUT(IOEndstopYMin, ORIG_Y_MIN_PIN)
IO_INPUT(IOEndstopYMax, ORIG_Y_MAX_PIN)
IO_INPUT(IOEndstopZMin, ORIG_Z_MIN_PIN)
IO_INPUT(IOEndstopZMax, ORIG_Z_MAX_PIN)

//IO_INPUT(IOJam1, 35)
//IO_INPUT(IOJam2, 33)


IO_INPUT (SCK_SPI1, SCK_PIN)
IO_INPUT (MISO_SPI1, MISO_PIN)
IO_INPUT (MOSI_SPI1 ,MOSI_PIN)


// Controller input pins

#if defined(UI_ENCODER_CLICK) && UI_ENCODER_CLICK >= 0
IO_INPUT_INVERTED_PULLUP(ControllerClick, UI_ENCODER_CLICK)
IO_INPUT_DUMMY(ControllerClick, false)
#if defined(UI_ENCODER_A) && UI_ENCODER_A >= 0
IO_INPUT_INVERTED_PULLUP(ControllerEncA, UI_ENCODER_A)
IO_INPUT_DUMMY(ControllerEncA, false)
#if defined(UI_ENCODER_B) && UI_ENCODER_B >= 0
IO_INPUT_INVERTED_PULLUP(ControllerEncB, UI_ENCODER_B)
IO_INPUT_DUMMY(ControllerEncB, false)
#if defined(UI_BACK_PIN) && UI_BACK_PIN >= 0
IO_INPUT_PULLUP(ControllerBack, UI_BACK_PIN)
IO_INPUT_DUMMY(ControllerBack, false)
#if defined(UI_RESET_PIN) && UI_RESET_PIN >= 0
IO_INPUT_PULLUP(ControllerReset, UI_RESET_PIN)
IO_INPUT_DUMMY(ControllerReset, false)

// Define our endstops solutions
// You need to define all min and max endstops for all
// axes except E even if you have none!

ENDSTOP_SWITCH_HW(endstopXMin, IOEndstopXMin, X_AXIS, false)
ENDSTOP_SWITCH_HW(endstopXMax, IOEndstopXMax, X_AXIS, true)
ENDSTOP_SWITCH_HW(endstopYMin, IOEndstopYMin, Y_AXIS, false)
ENDSTOP_SWITCH_HW(endstopYMax, IOEndstopYMax, Y_AXIS, true)
ENDSTOP_SWITCH_HW(endstopZMin, IOEndstopZMin, Z_AXIS, false)
ENDSTOP_SWITCH_HW(endstopZMax, IOEndstopZMax, Z_AXIS, true)

// Define fans
IO_PWM_HARDWARE(Fan1PWM, ORIG_FAN_PIN, 10)
IO_PWM_HARDWARE(Fan2PWM, ORIG_FAN2_PIN, 10)


//IO_OUTPUT(IOFan1, ORIG_FAN_PIN)
//IO_PWM_SOFTWARE(Fan1NoKSPWM, IOFan1, 0)
// IO_PWM_HARDWARE(Fan1PWM, 37,5000)
// IO_PDM_SOFTWARE(Fan1NoKSPWM, IOFan1) // alternative to PWM signals
//IO_PWM_KICKSTART(Fan1PWM, Fan1NoKSPWM, 20, 85)
// For debugging - reports new values and then calls real pwm
// IO_PWM_REPORT(Fan1Report, Fan1PWM)
// Define temperature sensors

// Typically they require an analog input (12 bit) so define
// them first.

IO_ANALOG_INPUT(IOAnalogBed1, TEMP_1_PIN, 7)
IO_ANALOG_INPUT(IOAnalogExt1, TEMP_0_PIN, 7)
//IO_ANALOG_INPUT(IOAnalogExt2, TEMP_2_PIN, 5)

// Need a conversion table for epcos NTC
IO_TEMP_TABLE_NTC(TempTableEpcos, Epcos_B57560G0107F000)

// Now create the temperature inputs

IO_TEMPERATURE_TABLE(TempBed1, IOAnalogBed1, TempTableEpcos)
IO_TEMPERATURE_TABLE(TempExt1, IOAnalogExt1, TempTableEpcos)
//IO_TEMPERATURE_TABLE(TempExt2, IOAnalogExt2, TempTableEpcos)

// Use PWM outputs to heat. If using hardware PWM make sure
// that the selected pin can be used as hardware pwm otherwise
// select a software pwm model whcih works on all pins.

#if MOTHERBOARD == 405
IO_PWM_HARDWARE(PWMExtruder1, HEATER_0_PIN, 1000)
IO_PWM_HARDWARE(PWMExtruder2, HEATER_2_PIN, 1000)
IO_PWM_HARDWARE(PWMBed1, HEATER_1_PIN, 1000)
IO_PWM_HARDWARE(PWMExtruder1_ridotto, HEATER_0_PIN, 10)
IO_PWM_SCALEDOWN (PWMExtruder1, PWMExtruder1_ridotto, 125)
IO_PWM_HARDWARE(PWMExtruder2, HEATER_2_PIN, 10)
IO_PWM_HARDWARE(PWMBed1, HEATER_1_PIN, 10)
IO_PWM_HARDWARE(PWM_Ventilazione_Driver_Motori, HEATER_3_PIN, 10)

// IO_OUTPUT(IOCooler1, FAN2_PIN)
// IO_PWM_SOFTWARE(PWMCoolerExt1, FAN2_PIN, 0)

// Define all stepper motors used
STEPPER_SIMPLE(XMotor, IOX1Step, IOX1Dir, IOX1Enable, endstopNone, endstopNone)
STEPPER_SIMPLE(YMotor, IOY1Step, IOY1Dir, IOY1Enable, endstopNone, endstopNone)
//STEPPER_SIMPLE(Z1Motor, IOZ1Step, IOZ1Dir, IOZ1Enable, endstopNone, endstopNone)
//STEPPER_SIMPLE(E3Motor, IOE3Step, IOE3Dir, IOE3Enable, endstopNone, endstopNone)
//STEPPER_MIRROR2(ZMotor, Z1Motor, E3Motor, endstopNone, endstopNone)
STEPPER_TMC5160_HW_SPI(ZMotor, IOZ1Step, IOZ1Dir, IOZ1Enable, ORIG_Z_CS_PIN, 0.075, 1, 16, 3000, false, 0, -128, 12500000, endstopNone, endstopNone)
STEPPER_SIMPLE(E1Motor, IOE1Step, IOE1Dir, IOE1Enable, endstopNone, endstopNone)

//STEPPER_SIMPLE(AL1Motor, IOAL1Step, IOAL1Dir, IOAL1Enable, endstopNone, endstopNone)
//STEPPER_SIMPLE(AL2Motor, IOAL2Step, IOAL2Dir, IOAL2Enable, endstopNone, endstopNone)

// Servos
//SERVO_ANALOG(Servo1, 0, Servo1Pin, 500, 2500, 1050)

// Heat manages are used for every component that needs to
// control temperature. Higher level classes take these as input
// and simple heater like a heated bed use it directly.

HEAT_MANAGER_PID(HeatedBed1, 'B', 0, TempBed1, PWMBed1, 120, 255, 1000, 5, 30000, 60, 1.6, 560, 0, 255, true)
HEAT_MANAGER_PID(HeaterExtruder1, 'E', 0, TempExt1, PWMExtruder1, 280, 255, 1000, 10, 20000, 40.0, 1, 50.0, 0, 255, false)
//HEAT_MANAGER_PID(HeaterExtruder2, 'E', 1, TempExt2, PWMExtruder2, 260, 255, 1000, 10, 20000, 20.0, 0.6, 65.0, 40, 220, false)

// HEAT_MANAGER_DYN_DEAD_TIME(HeaterExtruder1, 'E', 0, TempExt1, PWMExtruder1, 260, 255, 100, 10, 20000, 150, 7, 7, 200, 7, 7, false)
// HEAT_MANAGER_DYN_DEAD_TIME(HeaterExtruder2, 'E', 1, TempExt2, PWMExtruder2, 260, 255, 100, 10, 20000, 150, 7, 7, 200, 7, 7, false)

// Coolers are stand alone functions that allow it to control
// a fan with external sensors. Many extruders require a cooling
// fan pointer to the extruder to prevent heat rising up.
// These can be controlled by the cooler. Since it is
// independent you just tell what part needs cooling.
// Other use cases are board cooling and heated chambers.

COOLER_MANAGER_HEATER(Ventilazione_Estrusore, HeaterExtruder1, Fan2PWM, 50, 50, 255, 255)
COOLER_MANAGER_MOTORS(Ventilazione_Driver_Motori, PWM_Ventilazione_Driver_Motori, 100, 255, 60)

// Define tools. They get inserted into a tool array in configuration.h
// Typical tools are:
// TOOL_EXTRUDER(name, offx, offy, offz, heater, stepper, resolution, yank, maxSpeed, acceleration, advance, startScript, endScript)

TOOL_EXTRUDER(ToolExtruder1, 0, 0, -1.670, HeaterExtruder1, /*AL1Motor */ E1Motor, 1.75, 200.0, 5, 30, 5000, 40, "M117 Extruder 1", "", &PWMfakeOut)
//TOOL_EXTRUDER(ToolExtruder2, 0, 0, 0, HeaterExtruder2, /*AL2Motor */ E2Motor, 1.75, 147.0, 5, 30, 5000, 40, "M117 Extruder 2\nM400\nM340 P0 S1500 R600\nG4 P300", "M340 P0 S800 R600\nG4 P300", &Fan1PWM)
//TOOL_LASER(Laser3, 0, 0, 0, Fan1NoKSPWM, fakeOut, fakeOut, 3000, 1, 100, 150.0, 1.5, "", "")
//TOOL_CNC(CNC4, 0, 0, 0, Fan1NoKSPWM, fakeOut, fakeOut, fakeOut, 7000, 3000, "", "")

// Use a signal that changes while extruder moves
//JAM_DETECTOR_HW(JamExtruder1, E1Motor, IOJam1, ToolExtruder1, 220, 10, 500)
//JAM_DETECTOR_HW(JamExtruder2, E2Motor, IOJam2, ToolExtruder2, 220, 10, 500)

// Use a signal that is high, when filament is loaded
//FILAMENT_DETECTOR(FilamentDetector1, IOJam1, ToolExtruder1)
//FILAMENT_DETECTOR(FilamentDetector2, IOJam2, ToolExtruder2)




Terminale
> Executing task: C:\Users\mauro\.platformio\penv\Scripts\platformio.exe run <

Processing RUMBA32 (board: RUMBA32_F446VE; platform: ststm32@14.1.0; framework: arduino)
-----------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
PLATFORM: ST STM32 (14.1.0) > 3D Printer control board
HARDWARE: STM32F446RET6 180MHz, 128KB RAM, 512KB Flash
DEBUG: Current (blackmagic) External (blackmagic, cmsis-dap, jlink, stlink)
PACKAGES:
 - framework-arduinoststm32 4.20000.210603 (2.0.0)
 - framework-cmsis 2.50700.210515 (5.7.0)
 - tool-dfuutil 1.9.200310
 - toolchain-gccarmnoneeabi 1.90201.191206 (9.2.1)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 11 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <SPI> 1.0
|-- <IWatchdog> 1.0.0
|-- <Wire> 1.0
|-- <TMCStepper> 0.7.1
|   |-- <SoftwareSerial> 1.0
|   |-- <SPI> 1.0
Building in release mode
Compiling .pio\build\RUMBA32\src\Configuration.cpp.o
Compiling .pio\build\RUMBA32\src\PrinterTypes\Printer.cpp.o
Compiling .pio\build\RUMBA32\src\PrinterTypes\PrinterTypeCartesian.cpp.o
Compiling .pio\build\RUMBA32\src\PrinterTypes\PrinterTypeCoreXYZ.cpp.o
Compiling .pio\build\RUMBA32\src\PrinterTypes\PrinterTypeDelta.cpp.o
Compiling .pio\build\RUMBA32\src\PrinterTypes\PrinterTypeDualXAxis.cpp.o
Compiling .pio\build\RUMBA32\src\SdFat\src\ExFatLib\ExFatDbg.cpp.o
Compiling .pio\build\RUMBA32\src\SdFat\src\ExFatLib\ExFatFile.cpp.o
Compiling .pio\build\RUMBA32\src\SdFat\src\ExFatLib\ExFatFilePrint.cpp.o
Compiling .pio\build\RUMBA32\src\SdFat\src\ExFatLib\ExFatFileWrite.cpp.o
Compiling .pio\build\RUMBA32\src\SdFat\src\ExFatLib\ExFatFormatter.cpp.o
Compiling .pio\build\RUMBA32\src\SdFat\src\ExFatLib\ExFatPartition.cpp.o
Compiling .pio\build\RUMBA32\src\SdFat\src\ExFatLib\ExFatVolume.cpp.o
Compiling .pio\build\RUMBA32\src\SdFat\src\ExFatLib\upcase.cpp.o
Compiling .pio\build\RUMBA32\src\SdFat\src\FatLib\FatDbg.cpp.o
Compiling .pio\build\RUMBA32\src\SdFat\src\FatLib\FatFile.cpp.o
Compiling .pio\build\RUMBA32\src\SdFat\src\FatLib\FatFileLFN.cpp.o
Compiling .pio\build\RUMBA32\src\SdFat\src\FatLib\FatFilePrint.cpp.o
Compiling .pio\build\RUMBA32\src\SdFat\src\FatLib\FatFileSFN.cpp.o
Compiling .pio\build\RUMBA32\src\SdFat\src\FatLib\FatFormatter.cpp.o
Compiling .pio\build\RUMBA32\src\SdFat\src\FatLib\FatPartition.cpp.o
Compiling .pio\build\RUMBA32\src\SdFat\src\FatLib\FatVolume.cpp.o
Compiling .pio\build\RUMBA32\src\SdFat\src\FsLib\FsFile.cpp.o
Compiling .pio\build\RUMBA32\src\SdFat\src\FsLib\FsVolume.cpp.o
Compiling .pio\build\RUMBA32\src\SdFat\src\MinimumSerial.cpp.o
Compiling .pio\build\RUMBA32\src\SdFat\src\SdCard\SdCardInfo.cpp.o
Compiling .pio\build\RUMBA32\src\SdFat\src\SdCard\SdSpiCard.cpp.o
Compiling .pio\build\RUMBA32\src\SdFat\src\SpiDriver\SdSpiArtemis.cpp.o
Compiling .pio\build\RUMBA32\src\SdFat\src\SpiDriver\SdSpiChipSelect.cpp.o
Compiling .pio\build\RUMBA32\src\SdFat\src\SpiDriver\SdSpiDue.cpp.o
Compiling .pio\build\RUMBA32\src\SdFat\src\SpiDriver\SdSpiESP.cpp.o
Compiling .pio\build\RUMBA32\src\SdFat\src\SpiDriver\SdSpiParticle.cpp.o
Compiling .pio\build\RUMBA32\src\SdFat\src\SpiDriver\SdSpiSTM32.cpp.o
Compiling .pio\build\RUMBA32\src\SdFat\src\SpiDriver\SdSpiTeensy3.cpp.o
Compiling .pio\build\RUMBA32\src\SdFat\src\common\FsDateTime.cpp.o
Compiling .pio\build\RUMBA32\src\SdFat\src\common\SysCallBareUno.cpp.o
Compiling .pio\build\RUMBA32\src\SdFat\src\iostream\StdioStream.cpp.o
Compiling .pio\build\RUMBA32\src\SdFat\src\iostream\StreamBaseClass.cpp.o
Compiling .pio\build\RUMBA32\src\SdFat\src\iostream\istream.cpp.o
Compiling .pio\build\RUMBA32\src\SdFat\src\iostream\ostream.cpp.o
Compiling .pio\build\RUMBA32\src\boards\STM32F4\HAL.cpp.o
Compiling .pio\build\RUMBA32\src\boards\STM32F4\flashEEPROM.cpp.o
Compiling .pio\build\RUMBA32\src\communication\Commands.cpp.o
Compiling .pio\build\RUMBA32\src\communication\Communication.cpp.o
Compiling .pio\build\RUMBA32\src\communication\Eeprom.cpp.o
Compiling .pio\build\RUMBA32\src\communication\GCodes.cpp.o
Compiling .pio\build\RUMBA32\src\communication\MCodes.cpp.o
Compiling .pio\build\RUMBA32\src\communication\gcode.cpp.o
Compiling .pio\build\RUMBA32\src\controller\drivers\Display20x4.cpp.o
Compiling .pio\build\RUMBA32\src\controller\drivers\DisplayU8G2.cpp.o
Compiling .pio\build\RUMBA32\src\controller\gui.cpp.o
Compiling .pio\build\RUMBA32\src\controller\menu.cpp.o
Compiling .pio\build\RUMBA32\src\controller\u8g2\cppsrc\U8x8lib.cpp.o
Compiling .pio\build\RUMBA32\src\custom\customEvents.cpp.o
Compiling .pio\build\RUMBA32\src\drivers\coolerManager.cpp.o
Compiling .pio\build\RUMBA32\src\drivers\endstops.cpp.o
Compiling .pio\build\RUMBA32\src\drivers\heatManager.cpp.o
Compiling .pio\build\RUMBA32\src\drivers\stepper.cpp.o
Compiling .pio\build\RUMBA32\src\drivers\zprobe.cpp.o
src\drivers\stepper.cpp: In instantiation of 'void TMCStepper5160Driver<stepCls, dirCls, enableCls, fclk>::init() [with stepCls = IOZ1Step; dirCls = IOZ1Dir; enableCls = IOZ1Enable; long unsigned int fclk = 12500000]':
src/Configuration_io.h:193:1:   required from here
src\drivers\stepper.cpp:1067:28: error: 'void TMC2130Stepper::internal_Rsense(bool)' is inaccessible within this context
 1067 |     driver->internal_Rsense(TMC_INTERNAL_RSENSE);
      |     ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
In file included from src\drivers\../drivers/stepper.h:1,
                 from src\drivers\../drivers/drivers.h:41,
                 from src\drivers\../Configuration.h:176,
                 from src\drivers\../Repetier.h:302,
                 from src\drivers\stepper.cpp:1:
lib\TMCStepper\src/TMCStepper.h:162:8: note: declared here
  162 |   void internal_Rsense(   bool B);
      |        ^~~~~~~~~~~~~~~
Compiling .pio\build\RUMBA32\src\io\io_beeper.cpp.o
*** [.pio\build\RUMBA32\src\drivers\stepper.cpp.o] Error 1
========================================================= [FAILED] Took 53.17 seconds =========================================================
Environment    Status    Duration
-------------  --------  ------------
RUMBA32        FAILED    00:00:53.174
==================================================== 1 failed, 0 succeeded in 00:00:53.174 ====================================================Il processo del terminale "C:\Users\mauro\.platformio\penv\Scripts\platformio.exe 'run'" è stato terminato. Codice di uscita: 1.

Terminale verrà riutilizzato dalle attività, premere un tasto qualsiasi per chiuderlo.


Comments

  • Ok checked it and looks like driver library made that function protected, so we can not set it. Have uncommented that line now. Should compile now with latest commit. Alternatively delete line 1067 in stepper.cpp.
  • Grazie. Adesso il firmware si compila correttamente.
    Non riesco a far funzionare in mio TMC5160, ho controllato con oscilloscopio i segnali di RUMBA 32 e mi sembrano OK. Credo a questo punto che sia guasto.
  • At which point do you think they are wrong? Translation made not much sense at specifying this.
  • The firmware compiles and works perfectly.
    The TMC5160 driver is not working, but I believe it is dead.
    Thank you
Sign In or Register to comment.