MarlinFirmware / Marlin

Marlin is an optimized firmware for RepRap 3D printers based on the Arduino platform. Many commercial 3D printers come with Marlin installed. Check with your vendor if you need source code for your specific machine.
https://marlinfw.org
GNU General Public License v3.0
16.28k stars 19.24k forks source link

[2.0.x] Stm32f1 have a Compile error in HAL while useing STM32F10/Configuration.h #9242

Closed skylli closed 6 years ago

skylli commented 6 years ago

Compile Error

when I compile for STM32f103ve with default example STM32F10/Configuration.h the compilation failt, while my Compile platform is Arduino IDE 1.8.4 base on windows 10. Arduino_STM32 lib : https://github.com/rogerclarkmelbourne/Arduino_STM32.git on master #421

Arduino:1.8.4 Hourly Build 2017/08/01 12:33 (Windows 10), 开发板:"Generic STM32F103V series, STM32F103VE, STM32duino bootloader, 72Mhz (Normal), Smallest (default)"

. . .

"C:\Users\showhome004\AppData\Local\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1/bin/arm-none-eabi-g++" -c -g -Os -w -DDEBUG_LEVEL=DEBUG_NONE -std=gnu++11 -MMD -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -DBOARD_generic_stm32f103v -DVECT_TAB_ADDR=0x8002000 -DERROR_LED_PORT=GPIOE -DERROR_LED_PIN=6 -mcpu=cortex-m3 -DF_CPU=72000000L -DARDUINO=10804 -DARDUINO_GENERIC_STM32F103V -DARDUINO_ARCH_STM32F1  -DSERIAL_USB -DGENERIC_BOOTLOADER -DMCU_STM32F103VE  -mthumb  -march=armv7-m -D__STM32F1__ -DMCU_STM32F103VE  -mthumb  -march=armv7-m -D__STM32F1__ "-ID:\wind32_softworld\arduino-nightly\hardware\Arduino_STM32\STM32F1\system/libmaple" "-ID:\wind32_softworld\arduino-nightly\hardware\Arduino_STM32\STM32F1\system/libmaple/include" "-ID:\wind32_softworld\arduino-nightly\hardware\Arduino_STM32\STM32F1\system/libmaple/stm32f1/include"                                                           "-ID:\wind32_softworld\arduino-nightly\hardware\Arduino_STM32\STM32F1\system/libmaple/usb/stm32f1" "-ID:\wind32_softworld\arduino-nightly\hardware\Arduino_STM32\STM32F1\system/libmaple/usb/usb_lib" "-ID:\wind32_softworld\arduino-nightly\hardware\Arduino_STM32\STM32F1\cores\maple" "-ID:\wind32_softworld\arduino-nightly\hardware\Arduino_STM32\STM32F1\variants\generic_stm32f103v" "-ID:\wind32_softworld\arduino-nightly\hardware\Arduino_STM32\STM32F1\libraries\STM32ADC\src" "-ID:\wind32_softworld\arduino-nightly\hardware\Arduino_STM32\STM32F1\libraries\SPI\src" "C:\Users\SHOWHO~1\AppData\Local\Temp\arduino_build_520123\sketch\src\HAL\HAL_STM32F1\HAL_timers_Stm32f1.cpp" -o "C:\Users\SHOWHO~1\AppData\Local\Temp\arduino_build_520123\sketch\src\HAL\HAL_STM32F1\HAL_timers_Stm32f1.cpp.o"
C:\Users\SHOWHO~1\AppData\Local\Temp\arduino_build_520123\sketch\src\HAL\HAL_STM32F1\HAL_timers_Stm32f1.cpp: In function 'bool HAL_timer_interrupt_enabled(uint8_t)':

C:\Users\SHOWHO~1\AppData\Local\Temp\arduino_build_520123\sketch\src\HAL\HAL_STM32F1\HAL_timers_Stm32f1.cpp:166:61: error: 'TIM_DIER' was not declared in this scope

     case STEP_TIMER_NUM: return bool(TIM_DIER(STEP_TIMER_DEV) & STEP_TIMER_CHAN);

                                                             ^

使用 1.0  版本的库 STM32ADC 在文件夹: D:\wind32_softworld\arduino-nightly\hardware\Arduino_STM32\STM32F1\libraries\STM32ADC 
使用 1.0  版本的库 SPI 在文件夹: D:\wind32_softworld\arduino-nightly\hardware\Arduino_STM32\STM32F1\libraries\SPI 
exit status 1
为开发板 Generic STM32F103V series 编译时出错。
Bob-the-Kuhn commented 6 years ago

I tried following the README file but also couldn't get it to compile. I used the instructions at https://github.com/rogerclarkmelbourne/Arduino_STM32/wiki/Installation

@victorpv will probably need to steer us in the correct direction.

victorpv commented 6 years ago

There was a change in the Arduino_STM32 board files to use C11, and that broke ADC. Right after a PR was sent to correct that by someone else, and I tested it works, but not sure it has been merged yet. I will have a look. On a side note, for platformio I submitted a PR to them to add the generic103V board support, which is the one I use, but not sure that has been merged yet, but seems like Skylli is having problems with the ADC one.

EDIT: The ADC PR is not merged yet, you have to modify your local copy. This is the PR: https://github.com/rogerclarkmelbourne/Arduino_STM32/pull/407

Also the PR I sent to add support for VCT/VET boards to platformio has not been merged either: https://github.com/platformio/platform-ststm32/pull/80

victorpv commented 6 years ago

@Bob-the-Kuhn do you think the best would be to update the readme whitin the F1 HAL with links to those PRs for people to manually fix their local copies, or any better way? Roger is pretty busy with personal stuff and may take a while to merge the ADC fix, and about Platformio I do not know the reasons, but I see there are PRs that are not merged or commented on for a very long time.

victorpv commented 6 years ago

@Bob-the-Kuhn one other thing, could you paste your version of the pins_debug.h that you posted for me a while back? I didn't save it at the time and now I can't remember in which thread it is. I'll save it to my hdd until I have a bit of time to work on it.

skylli commented 6 years ago

@victorpv I have download the ADC PR,but still the same Compile Error. According to the debug log, ide can't find the implementation of the function - 'TIM_DIER',whitch judge to steper or temperature timer ISP is disable. If disable indicates buffer_segment wants to add a split block.

  // Initialize block entry speed. Compute based on deceleration to user-defined MINIMUM_PLANNER_SPEED.
  const float v_allowable = max_allowable_speed(-block->acceleration, MINIMUM_PLANNER_SPEED, block->millimeters);
  // If stepper ISR is disabled, this indicates buffer_segment wants to add a split block.
  // In this case start with the max. allowed speed to avoid an interrupted first move.
  block->entry_speed = STEPPER_ISR_ENABLED() ? MINIMUM_PLANNER_SPEED : min(vmax_junction, v_allowable);
skylli commented 6 years ago

After modify a couple of places, it compiles. The changes are as follows: I have disable the 'TIM_DIER'

bool HAL_timer_interrupt_enabled(const uint8_t timer_num) {
  switch (timer_num) {
#if 0
  //  todo by sky .
    case STEP_TIMER_NUM: return bool(TIM_DIER(STEP_TIMER_DEV) & STEP_TIMER_CHAN); 
    case TEMP_TIMER_NUM: return bool(TIM_DIER(TEMP_TIMER_DEV) & TEMP_TIMER_CHAN);
#else
    case STEP_TIMER_NUM: return 0; 
    case TEMP_TIMER_NUM: return 0;
#endif

  }
  return false;
}

Then came up IDE can't the implementation function of card.read/card.write. I disable it as above.

I will update the code and test on my stmboard. And i will fix these problem above.

thinkyhead commented 6 years ago

See if this works:

static inline bool timer_irq_enabled(const timer_dev * const dev, const uint8 interrupt) {
  return bool(*bb_perip(&(dev->regs).adv->DIER, interrupt));
}

bool HAL_timer_interrupt_enabled(const uint8_t timer_num) {
  switch (timer_num) {
    case STEP_TIMER_NUM: return timer_irq_enabled(STEP_TIMER_DEV, STEP_TIMER_CHAN);
    case TEMP_TIMER_NUM: return timer_irq_enabled(TEMP_TIMER_DEV, TEMP_TIMER_CHAN);
  }
  return false;
}
Bob-the-Kuhn commented 6 years ago

@victorpv - I finally tracked down the STM32 pinsdebug file.
HAL_pinsDebug_STM32.zip

The PlatformIO PR has been merged.

Yes, an improved readme file would help.

skylli commented 6 years ago

@thinkyhead Still the same compile error. Arduino ide can't find the implementation function of 'timer_irq_enabled'.

youprint commented 6 years ago

Hi everybody first i want to thanks Victor_pv and thinkyhead for this beatiful STM32 Hal I've some compile error too First issue was EEPROM read and write functions so i disabled it Now i've a second issue :

sketch/src/module/stepper.cpp:416:52: error: macro "TIMER_DEV" passed 2 arguments, but takes just 1
       HAL_timer_set_current_count(STEP_TIMER_NUM, 0);
                                                    ^
In file included from sketch/src/module/../inc/../HAL/HAL_STM32F1/HAL_Stm32f1.h:61:0,
                 from sketch/src/module/../inc/../HAL/HAL.h:50,
                 from sketch/src/module/../inc/MarlinConfig.h:28,
                 from sketch/src/module/stepper_indirection.h:47,
                 from sketch/src/module/stepper.h:46,
                 from sketch/src/module/stepper.cpp:47:
sketch/src/module/stepper.cpp: In static member function 'static void Stepper::isr()':
sketch/src/module/../inc/../HAL/HAL_STM32F1/HAL_timers_Stm32f1.h:87:71: error: 'TIMER_DEV' was not declared in this scope
 #define HAL_timer_set_current_count(timer_num, count) timer_set_count(TIMER_DEV(timer_num, (uint16)count))
                                                                       ^
sketch/src/module/stepper.cpp:416:7: note: in expansion of macro 'HAL_timer_set_current_count'
       HAL_timer_set_current_count(STEP_TIMER_NUM, 0);
       ^
exit status 1
thinkyhead commented 6 years ago

@youprint Re-Download the latest 2.0.x and see if you still get the same compile error. I'm unable to reproduce the error.

youprint commented 6 years ago

I have a new compilation error now :

sketch/src/HAL/HAL_STM32F1/HAL_spi_Stm32f1.cpp: In function 'void spiBeginTransaction(uint32_t, uint8_t, uint8_t)':
sketch/src/HAL/HAL_STM32F1/HAL_spi_Stm32f1.cpp:169:55: error: invalid conversion from 'uint8_t {aka unsigned char}' to 'BitOrder' [-fpermissive]
   spiConfig = SPISettings(spiClock, bitOrder, dataMode);
                                                       ^
In file included from sketch/src/HAL/HAL_STM32F1/HAL_spi_Stm32f1.cpp:40:0:
/home/younes/.arduino15/packages/stm32duino/hardware/STM32F1/2018.2.2/libraries/SPI/src/SPI.h:111:2: error:   initializing argument 2 of 'SPISettings::SPISettings(uint32_t, BitOrder, uint8_t)' [-fpermissive]
  SPISettings(uint32_t clock, BitOrder bitOrder, uint8_t dataMode) {
  ^
exit status 1
Erreur de compilation pour la carte Generic STM32F103R series

I'm using Arduino 1.8.6 with a fresh install of debian 9.3, using the STM32 bootloader on a STM32F103RE board. My libs are from STM32duino but i think this is an lib issue so i tried to install libs from Victor_PV fork (he modified the libs recently so i tried to have the same configuration as him since he is using the same board) Maybe i should try to compile with Sloeber, or platformio, because it seems that there is a lot of libraries conflicts with Arduino

victorpv commented 6 years ago

All, I have been pretty busy on some other stuff and haven't had any time to check on issues. Last thing I was doing was trying to get travis to work, which I don't even remember how far I got, but I remember I was getting close. I submitted a couple of PRs to pratformio and the stm32duino repos and those are merged now, so Travis should be closer to working. I'll download the latest 2.0 branch and test it out. My board works wonderful, so I can test functionality not just compilation, and will try to verify all the basic functions.

youprint commented 6 years ago

Thanks for your reply Victor I think i'm really close to compile it on my board and with Arduino 1.8.6 and standard STM32duino libs. My objective is to create several configs files for all STM32 series. I own many STM32 devs boards I started with a STM32F103RET6 since there is already an existing config file. it seems that i have a small pb wiith SPI syntax in HAL_spi_Stm32f1.cpp :

void spiBeginTransaction(uint32_t, uint8_t, uint8_t)
error: invalid conversion from 'uint8_t {aka unsigned char}' to 'BitOrder' [-fpermissive]
   spiConfig = SPISettings(spiClock, bitOrder, dataMode);

I own a MKS Robin and I already reverse engineered the pinout. It uses an STM32F103ZET6 with a FMSC 16 bits screen. I think marlin could work on it.

thinkyhead commented 6 years ago

@youprint Multi-line quotes start with three backticks. Readability improved. I have a feeling we'll be seeing you more.

skylli commented 6 years ago

@thinkyhead Thinks. After download the latest 2.0.x, it compiles. But I get another issus, the motor run very slow. It seems i cannot control the speed of the steper motor. I have a couple of tests with oscilloscopes probe connect to the x_step pin.

gcode:G1 X100 F50 gcode:G1 X100 F100 gcode:G1 X100 F1000 It seems the x_step pin High level duration time always 16ms when x motor was runing at different speeds, it never change!! I'm using stm32F103RBT6 with external 8M crystals. @victorpv Any suggestions?

English is my second language,Sorry guy.

victorpv commented 6 years ago

It seems like something worm with the isrs or the timer songs. There have been a bunch of changes since last time I looked at the code, so cant say for sure, but that's what I would suspect. Since you have an oscilloscope, can you pick a free pin amd set it up on the stepper isrs entry and low on exit, to see how frequently is being called? When there is no steps to run should be called at 1kHz rate, so 1ms between pulses.

victorpv commented 6 years ago

Sorry autocorrect changed a bunch of words I'll edit my message above when I'm at a computer

skylli commented 6 years ago

@victorpv I pick a free pin(PA6) according to your suggestion.Here's isr (in stepper.cpp file) code :

HAL_STEP_TIMER_ISR {

    //  todo test by sky 
    SET_OUTPUT(PA6);
    WRITE(PA6,HIGH); 

  HAL_timer_isr_prologue(STEP_TIMER_NUM);
  #if ENABLED(LIN_ADVANCE)
    Stepper::advance_isr_scheduler();
  #else
    Stepper::isr();
  #endif

  // todo test by sky .
  WRITE(PA6,LOW);  
}

PA6 waveform with no steps PA6 zoom in waveform with no steps PA6 waveform with steps gcode:G1 X100 F50

When there is no steps to run PA6 output 1KHZ rate. I guess the timer songs is ok,there's something worm with the isrs function. When x stepper runing the x_step pin High level duration time always 16ms(i think it should be 16us) !!! I will try to read isr function since i am not familiar with marlin stepper motor control. If anyone can give me advise, that will be very helpful.

victorpv commented 6 years ago

From the wave looks like either: A timer prescaler is not set correctly, so the timer period is too long Or a timer CC is not set correctly, loaded to a value too high, or something like it.

Marlin may use PWM for the Heater, Bed and Fan output pins, depending on your configuration file. If so, check what timer devices those pins use. Normally the HAL uses Timer channel 5 for the steppers, and timer channel 2 for heaters. If you use PWM anything, it may change the prescalaer or the timer CC registers, and mess up with the stepper ISR. You can find what timer device is in each pin in this table: https://github.com/rogerclarkmelbourne/Arduino_STM32/blob/master/STM32F1/variants/generic_stm32f103r/board.cpp#L83

If you have a conflict, you can either use a different pin, or modify the HAL to use a different time. They are defined in the file HAL_timers_Stm32f1.h I used 5 and 2 for convenience with the pins I was using. but you can use others as long as they exist in your MCU and are not a Basic timer. If you don't know which timer's are the basic/general/advanced, that's described in the MCU reference manual.

BTW I downloaded the latest code yesterday, and spent about 3 hours fighting with platformio, so sadly wasted all my spare time and didn't get to test the code in my printer that's what I wanted to do :( I hate platformio.

skylli commented 6 years ago

i use time 4 channel 1 for step,the time configration was as below:

#if defined MCU_STM32F103CB  || defined(MCU_STM32F103C8)|| defined(MCU_STM32F103RB)
  #define STEP_TIMER_NUM 4 // For C8/CB boards, use timer 4
#else
  #define STEP_TIMER_NUM 5 // for other boards, five is fine.
#endif

#define STEP_TIMER_CHAN 1 // Channel of the timer to use for compare and interrupts
#define TEMP_TIMER_NUM 2  // index of timer to use for temperature
#define TEMP_TIMER_CHAN 1 // Channel of the timer to use for compare and interrupts

#define CAT(a, ...) a ## __VA_ARGS__
#define TIMER_DEV(num) CAT (&timer, num)

#define STEP_TIMER_DEV TIMER_DEV(STEP_TIMER_NUM) // TIMER_DEV(5)-->&timer5
#define TEMP_TIMER_DEV TIMER_DEV(TEMP_TIMER_NUM)// TIMER_DEV(2) -->&timer2

//STM32_HAVE_TIMER(n);

#define HAL_TIMER_RATE         (F_CPU)  // frequency of timers peripherals

#define STEPPER_TIMER_PRESCALE 18             // prescaler for setting stepper timer, 4Mhz
#define HAL_STEPPER_TIMER_RATE (HAL_TIMER_RATE / STEPPER_TIMER_PRESCALE)   // frequency of stepper timer (HAL_TIMER_RATE / STEPPER_TIMER_PRESCALE)
#define HAL_TICKS_PER_US       ((HAL_STEPPER_TIMER_RATE) / 1000000) // stepper timer ticks per us

#define PULSE_TIMER_NUM STEP_TIMER_NUM
#define PULSE_TIMER_PRESCALE STEPPER_TIMER_PRESCALE

#define TEMP_TIMER_PRESCALE     1000 // prescaler for setting Temp timer, 72Khz
#define TEMP_TIMER_FREQUENCY    100 // temperature interrupt frequency

I only use HEATER_0_PIN and TEMP_0_PIN , The Bed and Fan output pins was set to -1.

#define HEATER_0_PIN       PA1   // EXTRUDER 1
  {&gpioa, &timer2, &adc1,  1, 2,    1}, /* PA1 */
#define TEMP_0_PIN         PA4   // ANALOG NUMBERING
{&gpioa,   NULL, &adc1,  4, 0,    4}, /* PA4 */ 
victorpv commented 6 years ago

I thought you were using an RET mcu.

The last defines, for pulse timer, have been added after I last looked at the code, so I have to check what they do. There are a few places in the stepper.cpp file where what I consider the wrong types are used, I corrected those in my local copy long time ago, and several have been corrected in the official repo, but there is still a couple of places left. Not sure if those may be causing a timer to end up loaded with the wrong values. I'm close to testing the latest version in my board, will post more when I can do the test.

skylli commented 6 years ago

I am using the MCU_STM32F103RB mcu. I am trying my best to read the stepper.cpp file.

skylli commented 6 years ago

I think i find the problem.

 // stepper.cpp
#define CYCLES_EATEN_XYZE _CYCLE_APPROX_7 // 20
#define EXTRA_CYCLES_XYZE (STEP_PULSE_CYCLES - (CYCLES_EATEN_XYZE)) // -20
// conditionals_post.h 
#define STEP_PULSE_CYCLES ((MINIMUM_STEPPER_PULSE) * CYCLES_PER_MICROSECOND)
// conditionals_adv.h  
#define MINIMUM_STEPPER_PULSE 0 // (µs) The smallest stepper pulse allowed
// stepper.cpp
while (EXTRA_CYCLES_XYZE > (uint32_t)(HAL_timer_get_current_count(PULSE_TIMER_NUM) - pulse_start) * (PULSE_TIMER_PRESCALE)) { /* nada */ }

EXTRA_CYCLES_XYZE was -20, when it transform to unsigned format,it will be an big number.So the x/y/z/e pulse width will be vary large. Set MINIMUM_STEPPER_PULSE to 10 will fix the issue.

// conditionals_adv.h  
#define MINIMUM_STEPPER_PULSE 10 // (µs) The smallest stepper pulse allowed  
victorpv commented 6 years ago

Oh I forgot about this, I saw it a while back too, I have the minimum stepper pulse set to 1or 2, which anyway a lot of steppers need. I wish I had remembered about this and told you. I thought this had been resolved some other way because I reported it in the main 2.0 thread, and I remember using it set 0 would just cause me some steps loss, but not the 16ms period you see. I have type changes in stepper.cpp that I think are the correct ones, perhaps that solves this bug for me.

victorpv commented 6 years ago

Can you change the (uint32) in the multiplication to int32 and test? That way it will compare 2 signed numbers.

skylli commented 6 years ago

@victorpv
I have been change the (uint32) in the multiplication to int32 and test, it don's work,still 16ms period. Is there any problem u across in seting MINIMUM_STEPPER_PULSE to nonzero.

victorpv commented 6 years ago

I haven't had any problem with setting MINIMUM_STEPPER_PULSE to nonzero, but if I remember right in the version I run in my printer (from december) that problem didn't happen (16mS cycles). Instead the DRV8825 driver I use need a pulse of at least 1.9uS, and when I had MINIMUM_STEPPER_PULSE as 0 I was missing some steps because some pulses would be too short. So I raised it to 2, and haven't touched it in my configuration since then. I was able to compile the current branch last weekend, but did not have time to flash it to my board and test. Check the specification of the minimum pulse lenght of the drivers you are using, and set MINIMUM_STEPPER_PULSE to that value, if it works fine, don't worry more about it, I'll try to find more when I get time. But really since the macro results in a negative value when using MINIMUM_STEPPER_PULSE = 0, I think the problem is not really in the HAL, but rather in the Marlin macros that allow that to happen. I don't think a negative pulse lenght makes any sense and no valid calculation should result in it.

skylli commented 6 years ago

Think victorpv. i vary close to my first printing. The only issue i across is i can't Precise control temperature. When i set target temperature to 200,it can be 205 some time. temperature fluctuation range = 10°C

victorpv commented 6 years ago

When if you tunr off the output, does the temperature still oscillates up and down? if so you may have too much noise in the analog inputs. Otherwise perhaps all you need to do is run pid tunning.

skylli commented 6 years ago

@victorpv
The temperature is better new, since i replace the heating rod. There is another issue, when i enable Z_MIN_PROBE_ENDSTOP, and add Z_MIN_PROBE_PIN, there is only z_probe state when i send gcode M119. X/Y/Z axis will keep hitting each endpoint without stop when printer beak home useing G28. I find Z_MIN_PROBE_PIN will equal to X_MIN_PIN/Y_MIN_PIN/Z_MIN_PIN, no matter what pin Z_MIN_PROBE_PIN define. Here is some debug code and log.

    Line 370: c:\users\sky\desktop\hex\sketch\src\pins\pins_STM32F1R.h:120:2: error: #error "Z_MIN_PROBE_PIN == Y_MIN_PIN "
    Line 370: c:\users\sky\desktop\hex\sketch\src\pins\pins_STM32F1R.h:120:2: error: #error "Z_MIN_PROBE_PIN == Y_MIN_PIN "
    Line 372:  #error "Z_MIN_PROBE_PIN == Y_MIN_PIN "

i use another pin rather than z_min pin.

// pins_STM32F1R.h
#define Z_MIN_PIN          PB14
#ifndef Z_MIN_PROBE_PIN
#define Z_MIN_PROBE_PIN  PA15

#endif // Z_MIN_PROBE_PIN

#if Z_MIN_PROBE_PIN == Y_MIN_PIN
 #error "Z_MIN_PROBE_PIN == Y_MIN_PIN "
#endif

i think there is something wrong in IS_Z2_OR_PROBE macro.

#define IS_Z2_OR_PROBE(A,M) ( \
     (ENABLED(Z_DUAL_ENDSTOPS) && Z2_USE_ENDSTOP == _##A##M##_) \
  || (ENABLED(Z_MIN_PROBE_ENDSTOP) && Z_MIN_PROBE_PIN == A##_##M##_PIN ) )
victorpv commented 6 years ago

It was mentioned in the main 2.0 thread, and then there is a thread in the stm32duino, but in short xC0005 found out a problem due to the Pins being defined in an ENUM in the stm32duino/libmaple core. Due to that, they all evaluate as 0 to the pre-processor Macros. Result: some Macros don't work right unless you modify the board.h file in your variant (STM32F1/variants/generic_stm32f103v/board in my case using a VET MCU). So comment out the enum there, and define all your pins with macros. They need to be in the same order as they are in the ENUM:

/*enum {
PA0,PA1,PA2,PA3,PA4,PA5,PA6,PA7,PA8,PA9,PA10,PA11,PA12,PA13,PA14,PA15,
PB0,PB1,PB2,PB3,PB4,PB5,PB6,PB7,PB8,PB9,PB10,PB11,PB12,PB13,PB14,PB15,
PC0,PC1,PC2,PC3,PC4,PC5,PC6,PC7,PC8,PC9,PC10,PC11,PC12,PC13,PC14,PC15,
PD0,PD1,PD2,PD3,PD4,PD5,PD6,PD7,PD8,PD9,PD10,PD11,PD12,PD13,PD14,PD15,
PE0,PE1,PE2,PE3,PE4,PE5,PE6,PE7,PE8,PE9,PE10,PE11,PE12,PE13,PE14,PE15,
};*/
/* Note PB2 is skipped as this is Boot1 and is not going to be much use as its likely to be pulled permanently low */

#define PA0 0
#define PA1 1
#define PA2 2
#define PA3 3
#define PA4 4
#define PA5 5
#define PA6 6
#define PA7 7
#define PA8 8
#define PA9 9
...
skylli commented 6 years ago

@victorpv
Thanks, my printer can print new .

skylli commented 6 years ago

My printer‘s heater temperature fluctuations within 10°C when printing. It's temperature fluctuations within 1°C,without printing,while i just set the target temperature in gcode. I think the stepper isrs have affect the temperature isrs. @victorpv any advice ??

victorpv commented 6 years ago

My started fluctuating when I changed my printing head, while it was not fluctuating before. Does't fluctuate that much, but more like 5-6 degress, so I think it may have to do with the thermistor or the heater. If you have another head to test, give it a shot just to confirm. But also I am running in a much older version for the 2.0 branch, from november-december, once I get to update to the latest it will be more comparable.

skylli commented 6 years ago

@victorpv I have using 2560 control board the temperature fluctuations within 2°C when printing. I also change the printing head,it fluctuate in 6~7°C. temperature curve According to the temperature curve the stepper isr have a very bed influence to the temperature isr. I have test the temperature isr using oscilloscope,the isr period volatility is very large when moving x/y/z in high speed. I think the is something wrong in temperature isr or stepper isr.

thinkyhead commented 6 years ago

the isr period volatility is very large when moving x/y/z in high speed

Indeed. The stepper ISR has a high priority over the temperature ISR, so you have to limit speeds to prevent the stepper ISR from monopolizing the processor. The alternative is for Marlin to constrain the top stepper speed to some hard limit so that the temperature ISR can get more time.

There are a couple of ways to free up more CPU. You can enable ENDSTOP_INTERRUPTS. If you're using 32x micro-stepping, you can reduce it to 16x micro-stepping. If the Z axis and extruder are using 16x micro-stepping they can both be reduced to 8x micro-stepping. &c.

skylli commented 6 years ago

@thinkyhead thanks. @victorpv I have enable ENDSTOP_INTERRUPTS, but my xyz-end state keep change all the time。 I have download the latest version,but i can't build it. I will update some log this weekend.

github-actions[bot] commented 3 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.