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.34k stars 19.26k forks source link

Ramps 1.7 and DUE #11655

Closed boelle closed 6 years ago

boelle commented 6 years ago

Hi all

@MrAlvin havde made the next version of the Ramps board, but I have some issues getting it to work. Just reading temps and getting a response from M119 is royal pain in the rear.

He made a test program which is here: https://github.com/MrAlvin/RAMPS_1.7/tree/master/Arduino%20test%20sketches/test%20everything/ee_ana_blink_end_step

Everything works fine with that

He also for dev purpose made a fork with settings ready to go:

https://github.com/MrAlvin/Marlin/tree/bgfx-20x-R17-dev

That one does not work. No temps and no response from M119, M502 does not give a response either.

We have tried both arduino ide 1.8.6 and 1.9 and platform io

Anyone that can help us spot what is going wrong for us?

boelle commented 6 years ago

@kabelfrikkler

got an email that you had made an reply but its gone... did you regret?

workheart commented 6 years ago

change line nr 24 env_default = megamega2560 in platformio.ini toenv_default = DUE it compiled without error in platformio :-) @boelle, i was to fast but now it worked

boelle commented 6 years ago

its not compile errors that are the problem

and yes i did change that line in platformio.ini

the problem is when the code is uploaded to the board.... nothing works

boelle commented 6 years ago

btw... i understand both english and german (and danish) if that helps

not sure about @MrAlvin but he understands English and danish :-)

workheart commented 6 years ago

hard to find without the board, guess you have to wait for someone with more DUE expertise, what does Work on the new board? how many did you make?

boelle commented 6 years ago

we just have a few prototypes

everything works with the test program, but not with marlin

is it @Bob-the-Kuhn that does a lot of 32 bit stuff? or maybe @Wurstnase ?

boelle commented 6 years ago

i know that @MagoKimbra did some due stuff once but not sure if he is still active and throw some light on it

MrAlvin commented 6 years ago

As I have more test tools and options available, I did further testing, and I got the bed and hot-end temperatures to work, by switching bed pin from (analog) pin 5 to pin 7. Pin 7 is marked T3 on the PCB. Pin 5 is marked Bed on the PCB.

While things were running (meaning; hot-end and bed were being heated), I also tested the volt reading (using a multimeter) for analog pins 5, 6 and 7. And with Marlin running, analog pin 5 was stuck at the same voltage, despite physical temperatures were changing.

When running my test programs (as linked to above by Boelle), analog pins 5, 6 and 7 all works, and the multimeter shows voltage changes for all three pins. With my simple test programs running, analog pin 5 is NOT stuck, and the voltage changes, when the physical temperatures change.

So a work-around has been identified, but it would still be nice if analog pin 5 could be used as; an analog pin.

Wurstnase commented 6 years ago

It's probably a year ago that I've compiled the latest Marlin with PlatformIO on my Due. I had no issues. I need to remove some libs that time, because that didn't worked in the past with the Due.

On the SAM3X is pretty simple to use the analog inputs programmatically. You don't need any DMA or other things. I didn't check the Marlin code, but probably the analog pin 5 is used also somewhere as digital pin? Please check the numbers. Digital pins and analog pins have different numbers but could share the same one.

boelle commented 6 years ago

but would using analog pin and same number digital (analog 5 and digital 5) explain why it does not respond to commands? ie sending M119 returns no reply, its like marlin is dead :-)

MrAlvin commented 6 years ago

@Wurstnase Ah, yes. That was indeed the problem. I had not connected the dots: A5 =D59. And D59 had been typed, where it should have been D58. Typo is now fixed, and analog 5 (bed) is reporting temperatures. Thank you :-)

boelle commented 6 years ago

i will have a go too then :-D

boelle commented 6 years ago

@MrAlvin do you also get a response when you send M119

me still unzipping

MrAlvin commented 6 years ago

hmmm.... M119 is on a different issue. But I will do some testing, and let you know. Ok?

MrAlvin commented 6 years ago

This is what I have found: With standard setting in configuration.h, you need to use NC (normal close) end-stops, to get a "trigger response" on M119. Otherwise set end-stops to true, like: "X_MIN_ENDSTOP_INVERTING true", when using NO (normal open) end-stops. I have now changed my configuration.h to use NO end-stops.

boelle commented 6 years ago

hehe, the reason why i asked is that before i could not get any response from anything :-)

ie M119 would not reply if endstops was triggered or not

M114 shoould tell you where the board thinks the nozzle is, always 0,0,0 after reset

boelle commented 6 years ago

yaaa :-D

i get response from both M119 and M114

and i can control bed heating and nozzle heating

big thanks to @Wurstnase so far

boelle commented 6 years ago

The only thing i have not been able to test with success are:

Fan on with M106 and off with M107, there is no response on serial output and no reaction on board

the board has an extra fan connector on digital 8, no reaction with M42 P8 S255 or M42 P8 S0, not on board or serial

X max does not change status

my printer is the only one that has drivers that run on 3.3V logic and that one is doing a print so will have to wait testing the steppers

workheart commented 6 years ago

I recommend the m m43 t option to triger pins for dwbuging purpose. it has the possibility to test lets say 10 pins and check with a multimeter if the pin: 5 is wher you think it is it tells you what is the internal and the analog and the external pin name etc. Verry handy on board dev.http://marlinfw.org/docs/gcode/M043-T.html

boelle commented 6 years ago

i will try that

how to debug output? also with M43?

workheart commented 6 years ago

Yes its easy follow the marlin docu, http://marlinfw.org/docs/gcode/M043-T.html set the time to .. 15seconds that you have terminal output what pin gets triggerd (it switches high low high low...) And informatin on the pins, I do disconect my drivers etc so i can probe eerything else if it is not where or what i expected. If i than dont find it i run the code without the shield, .... On step at a time :) its time consuming but it helps trouble Shooting Ther is no debuging information per se in the output,

MrAlvin commented 6 years ago

Hi boelle,

I am today working to get the standard (5V) LCD displays up and running with the 3V Due. I have made a universal bi-directional adapter board, so all pins on aux3 and aux4 are level shifted between 3V and 5V. This should allow for any existing display to be able to be used with this RAMPS 1.7 + Due.

When this is done (or when I take a break from the LCD stuff) , I will look into the other issues you mention, like:

boelle commented 6 years ago

strange... i use M43 W to tell me if a pin changes state

nothing happens when i short the X max connector, and as i understand things it should at least tell me a pin number that changes state

will try M43 I to get state of all pins and see if one of them changes

boelle commented 6 years ago

only pin 54 changed

PIN: 00        RXD                                    Input  = 1
PIN: 01        TXD                                    Input  = 1
PIN: 02        E_MUX0_PIN                             Input  = 1
.              X_MAX_PIN                              Input  = 1
PIN: 03        X_MIN_PIN                              Input  = 1
PIN: 04        SERVO0_PIN                             Input  = 1
PIN: 05        SERVO1_PIN                             Input  = 1
PIN: 06        E1_CS_PIN                              Input  = 1
.              FIL_RUNOUT_PIN                         Input  = 1
.              SERVO2_PIN                             Input  = 1
.              Z2_CS_PIN                              Input  = 1
PIN: 07        SERVO3_PIN                             Input  = 1
PIN: 08        E0_AUTO_FAN_PIN                        PWM = 0
PIN: 09        FAN_PIN                                PWM = 0
.              RAMPS_D9_PIN
PIN: 10        HEATER_BED_PIN                         Output = 0
.              RAMPS_D8_PIN                           Output = 0
PIN: 11        HEATER_0_PIN                           Output = 0
.              RAMPS_D10_PIN                          Output = 0
PIN: 12        PS_ON_PIN                              Output = 0
PIN: 13        LED_PIN                                Input  = 0
PIN: 14        <unused/unknown>                       Input  = 1
PIN: 15        E_MUX1_PIN                             Input  = 1
.              Y_MAX_PIN                              Input  = 1
PIN: 16        LCD_PINS_RS                            Output = 0
PIN: 17        LCD_PINS_ENABLE                        Output = 0
PIN: 18        <unused/unknown>                       Input  = 1
PIN: 19        E_MUX2_PIN                             Input  = 1
.              Z_MAX_PIN                              Input  = 1
PIN: 20        <unused/unknown>                       Input  = 1
PIN: 21        <unused/unknown>                       Input  = 1
PIN: 22        E1_ENABLE_PIN                          Output = 0
.              Z2_ENABLE_PIN                          Output = 0
PIN: 23        LCD_PINS_D4                            Output = 0
PIN: 24        E1_STEP_PIN                            Output = 0
.              Z2_STEP_PIN                            Output = 0
PIN: 25        LCD_PINS_D5                            Input  = 1
PIN: 26        E1_DIR_PIN                             Output = 0
.              Z2_DIR_PIN                             Output = 0
PIN: 27        LCD_PINS_D6                            Input  = 1
PIN: 28        <unused/unknown>                       Input  = 1
PIN: 29        LCD_PINS_D7                            Input  = 1
PIN: 30        E0_ENABLE_PIN                          Output = 0
PIN: 31        BTN_EN1                                Input  = 1
PIN: 32        <unused/unknown>                       Input  = 1
PIN: 33        BTN_EN2                                Input  = 1
PIN: 34        E0_STEP_PIN                            Output = 0
PIN: 35        BTN_ENC                                Input  = 1
PIN: 36        E0_DIR_PIN                             Output = 0
PIN: 37        BEEPER_PIN                             Output = 0
PIN: 38        E0_CS_PIN                              Input  = 1
PIN: 39        <unused/unknown>                       Input  = 1
PIN: 40        MAX6675_SS                             Input  = 1
PIN: 41        KILL_PIN                               Input  = 1
PIN: 42        Y_CS_PIN                               Input  = 1
PIN: 43        <unused/unknown>                       Input  = 1
PIN: 44        <unused/unknown>                       Input  = 1
PIN: 45        <unused/unknown>                       Input  = 1
PIN: 46        X_CS_PIN                               Input  = 1
PIN: 47        <unused/unknown>                       Input  = 1
PIN: 48        Z_CS_PIN                               Analog in =     0
PIN: 49        SD_DETECT_PIN                          Input  = 1
PIN: 50        MISO_PIN                               Input  = 1
PIN: 51        MOSI_PIN                               Input  = 1
PIN: 52        SCK_PIN                                Input  = 1
PIN: 53        SDSS                                   Output = 0
.              SS_PIN                                 Output = 0
PIN: 54 (A 0)  <unused/unknown>   Analog in =   939   Input  = 1
PIN: 55 (A 1)  X_ENABLE_PIN                           Output = 0
PIN: 56 (A 2)  X_STEP_PIN                             Output = 0
PIN: 57 (A 3)  X_DIR_PIN                              Output = 0
PIN: 58 (A 4)  Y_ENABLE_PIN                           Output = 0
PIN: 59 (A 5)  TEMP_BED_PIN                           Input  = 1
PIN: 60 (A 6)  TEMP_0_PIN                             Input  = 1
PIN: 61 (A 7)  TEMP_1_PIN                             Input  = 1
PIN: 62 (A 8)  Y_STEP_PIN                             Output = 0
PIN: 63 (A 9)  Y_DIR_PIN                              Output = 0
PIN: 64 (A10)  Z_MIN_PROBE_PIN                        Input  = 1
PIN: 65 (A11)  <unused/unknown>   Analog in =  1023   Input  = 1
PIN: 66        <unused/unknown>                       Input  = 1
PIN: 67        Z_ENABLE_PIN                           Output = 0
PIN: 68        Z_STEP_PIN                             Output = 0
PIN: 69        Z_DIR_PIN                              Analog in =     0
PIN: 70        <unused/unknown>                       Input  = 1
PIN: 71        <unused/unknown>                       Input  = 1
PIN: 72        <unused/unknown>                       Input  = 1
PIN: 73        <unused/unknown>                       Input  = 1
PIN: 74        <unused/unknown>                       Input  = 1
PIN: 75        <unused/unknown>                       Input  = 1
PIN: 76        <unused/unknown>                       Input  = 1
PIN: 77        <unused/unknown>                       Input  = 0
PIN: 78        <unused/unknown>                       Input  = 1

with x max shorted it changes to

PIN: 54 (A 0)  <unused/unknown>   Analog in =   942   Input  = 1
boelle commented 6 years ago

With M43 I T S8 R5 W1000 i can get the extra fan connector make my voltmeter go from 0 to 12 and back

so it its on D8 but strange is that i cant change state with M42 P8 S255

boelle commented 6 years ago

ahh protected pin

SENDING:M42 P8 S255 Error:Protected Pin [ERROR] Error:Protected Pin

now where is that set i dont know

boelle commented 6 years ago

the part cooling fan on D9 have a LEd and it blinks only very shortly and voltmeter is not fast enough

but if i put the voltmeter on the pin from the DUE is changes from 3.3V to 0V and back

D11 which is the nozzle/extruder heater does not react when i try to pulse it Same for D10 which is the bed heater

Solved the mystery on X max for now... it does only pulse to 3.3V if i put voltmeter directly to pin on due, so there is a missing connection between due and shield on that pin

boelle commented 6 years ago

so i reheated the pin for D2 and now i cant get a response from M502 or M43 I T S2 R5 W1000. M119 and M114 is also non responsive

will take shield of and check pins ( again :-) )

MrAlvin commented 6 years ago

I have got M106 and M107 working now. For both P0 and P1 (Fan0-D10 and Fan1-D8) To get it to work, a FAN_1_PIN definition was in need of being added to the pins_RAMPS_17.h file

I also corrected something about Bed pin assignment, that would otherwise have Bed pin as Fan0 pin.

I hope this helps.

boelle commented 6 years ago

oki... will upload the test sketch to confirm everything still works

then i will download the new pins file and see if that solved it

boelle commented 6 years ago

M106 P0 works but not M106 P1

M42 P8 S255 does not work either

boelle commented 6 years ago

tried With M43 I T S8 R5 W1000 and it can pulse the output

the strange thing is that it can stop repsonding to the command

normally when the command is issued serial output says its pulsing and what the pin is used for, but that can stop and then not even a reset will help

somethings is very fishy :-D

AnHardt commented 6 years ago

pin_is_protected() #define SENSITIVE_PINS

AnHardt commented 6 years ago

M42 Have a look at the special handling for the fans. If a soft PWM is running at that pin the just written value is overwritten by that a moment later. Could (should?) be similar for the heaters. (Then potentially DANGEROUS! - but not more than with a hardware PWM)

AnHardt commented 6 years ago

Setting the PWM for the heaters to a value that will stay, is much more complex. The PWM value is permanently set by the heater PDI. Bang bang and limit switching would also overwrite the pin state immediately.

AnHardt commented 6 years ago

For a test of the heater pins better just use the heater commands. Maybe we can add a warning to M42.

AnHardt commented 6 years ago

The heaters are never really OFF - except after a kill. If the environment temperature would be below zero, the heaters would try to heat to zero - provided MINTEMP is not biting before.

boelle commented 6 years ago

Sorry old man here felt asleep in front of pc

have 2 due's from arduino.cc and one was still in box so took that one and flashed marlin to it

even M502 gets no response so something is wrong

boelle commented 6 years ago

now trying to download again from https://github.com/MrAlvin/Marlin/tree/bgfx-20x-R17-dev and this time make no changes to config to see if something changes

if it works it must be my config that is screwed up somehow, even thou i doubt it since it worked a few hours ago

AnHardt commented 6 years ago

A naked DUE has no EEPROM - just an emulation (that must be activated?)

boelle commented 6 years ago

there is an eeprom on the shield/board :-)

boelle commented 6 years ago

but that is the only thing i will do, put on the shield and upload code as it is on github

boelle commented 6 years ago

a strange thing, when i upload from platform io i get this

Forcing reset using 1200bps open/close on port COM13 Uploading .pioenvs\DUE\firmware.bin No device found on COM13 *** [upload] Error 1

but windows can see the board fine

will try a few times

boelle commented 6 years ago

managed to upload the code

still no response from M502, not from M119 or M114 either

using pronterface and the temp does not update

will try the test program again

boelle commented 6 years ago

yep, test program confirms everything working

hmm... maybe its best to get some good sleep

boelle commented 6 years ago

yep time for some sleep to me

managed to flash the copy of marlin linked in first post and for some reason that does not work for me

boelle commented 6 years ago

output from serial:

Connecting...
start
Printer is now online.
echo:PowerUp
Marlin bugfix-2.0.x
echo: Last Updated: 2018-01-20 | Author: (none, default config)
echo:Compiled: Aug 29 2018
echo: Free Memory: 86628  PlannerBufferBytes: 1408
echo:Hardcoded Default Settings Loaded
echo:  G21    ; Units in mm (mm)
echo:  M149 C ; Units in Celsius
echo:Filament settings: Disabled
echo:  M200 D3.00
echo:  M200 D0
echo:Steps per unit:
echo:  M92 X80.00 Y80.00 Z4000.00 E500.00
echo:Maximum feedrates (units/s):
echo:  M203 X300.00 Y300.00 Z5.00 E25.00
echo:Maximum Acceleration (units/s2):
echo:  M201 X3000 Y3000 Z100 E10000
echo:Acceleration (units/s2): P<print_accel> R<retract_accel> T<travel_accel>
echo:  M204 P3000.00 R3000.00 T3000.00
echo:Advanced: B<min_segment_time_us> S<min_feedrate> T<min_travel_feedrate> X<max_x_jerk> Y<max_y_jerk> Z<max_z_jerk> E<max_e_jerk>
echo:  M205 B20000 S0.00 T0.00 X10.00 Y10.00 Z0.30 E5.00
echo:Home offset:
echo:  M206 X0.00 Y0.00 Z0.00
echo:Material heatup parameters:
echo:  M145 S0 H180 B70 F0
echo:  M145 S1 H240 B110 F0

what i note is that it loads hard coded default so it has no contact with eeprom on shield

also temp graphs does not update and it does not repond to commands

https://i.imgur.com/cVMkbQO.png

MrAlvin commented 6 years ago

There is indeed an eeprom on the board, but to use it, it must first be activated.

If you look at the top of the configuration.h file on https://github.com/MrAlvin/Marlin/tree/bgfx-20x-R17-dev you will see a list of notes and comments about what has been done, and what needs to be done/tested, in order to get the correct settings in Marlin activated, so all things on the board will eventually end up working.

On the ToDo list/"changes that needs to be done", is: eeprom, SDcard, LCD displays. But more details will also need to be tested. And I will say that you are doing a great job testing, and discovering which commands needs attention, and adjustments in various files of the settings in Marlin, so the hardware and the firmware will eventually come together. So please keep up the good work. It might however help to lower your level of frustration, to remember that right now is a phase of prototype and discovery. Okay?

But still, please keep up the good work, with the testing of gcodes. The testing is greatly appreciated. Okay?

MrAlvin commented 6 years ago

I have now activated eeprom in configuration.h, and tested that it works.

I used M503 to see all active settings, then M500 to store in eeprom. Then tested by changing M204 to different numbers, M503 to verify. Then M500 to store in eeprom.
Then reset button, to restart Due. Then M503 to see that eeprom values were used at boot. Then M502 to reset to hardcoded defaults, and M503 to verify that M204 changed back to hardcoded default. Then M501 to read from eeprom, and M503 to verify that M204 had changed.

And it worked.

boelle commented 6 years ago

morning

yep i know its still prototype, what made me maybe just a little frustrated is that due to double checking i started to think that my DUE's was bad

but then again why should 2 be bad at the same time

so i will try and relax more :-D

it was very late before i got to sleep so it will be a few hours yet until i can test the latest changes, still feel lile a zombie after only 5 hours of sleep