Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Ender 3 v2 does not boot when E0_DRIVER_TYPE is TMC2208 with pin PA3 on 2.0.9.2+ versions #22905

Closed
TOTA42 opened this issue Oct 7, 2021 · 26 comments

Comments

@TOTA42
Copy link

TOTA42 commented Oct 7, 2021

Did you test the latest bugfix-2.0.x code?

Yes, and the problem still exists.

Bug Description

I have done a board modification on the stock Ender 3 v2 mainboard (4.2.2 with TMC2208 steppers) that would enable me to use the UART on the TMC2208. This was done by adding a blue wire on PA3 to the E stepper driver's UART pin. This works on 2.0.8, but on 2.0.9.2 versions, it appears that Marlin fails to boot, or at least the LCD stays black until I flash a firmware that will boot. I either have to switch the E0 back to TMC2208_STANDALONE for 2.0.9.2 versions or revert back to 2.0.8 if I wanted to keep E0 as TMC2208.

There seems to be some consensus with the oddity with PA3 pin particularly. There is some discussion in Jyers#1346 where it seems to work again if it's PA13 instead of PA3 if using post 2.0.8 versions.

Note: I have only tried this on 2.0.8 (working), 2.0.9.2 (does not boot), and 2.x.x SHA 1f41437 (does not boot). I have not attempted a git bisect to narrow down the commit, but I can do so if you think it would help.

Bug Timeline

2.0.9.2

Expected behavior

Expected Marlin to boot or at least the LCD to display something

Actual behavior

Marlin appears to fail to boot, LCD screen is black and must either set E0 driver back to TMC2208_STANDALONE or revert to 2.0.8 with E0 set to TMC2208.

Steps to Reproduce

  1. Compile Marlin (used 2.0.9.2 and 2.x.x fix 1f41437 with changes noted in patch_UART_enable.txt)
  2. Place in SD card and turn on printer

Version of Marlin Firmware

2.0.9.2

Printer model

Creality Ender 3 v2

Electronics

Stock electronics with blue wire from PA3 pin to E stepper driver's UART pin

Add-ons

N/A

Bed Leveling

MBL Manual Bed Leveling

Your Slicer

Cura

Host Software

SD Card (headless)

Additional information & file uploads

Configuration files used

Patch to apply on clean Marlin with Ender-3 V2 MarlinUI configuration copied

Discussion in Jyers with blackscreen with Pin PA3 specifically

@TOTA42 TOTA42 changed the title [BUG] Ender 3 v2 does not boot when E0_DRIVER_TYPE is TMC2208 with pin PA3 on 2.0.9.1+ versions [BUG] Ender 3 v2 does not boot when E0_DRIVER_TYPE is TMC2208 with pin PA3 on 2.0.9.2+ versions Oct 7, 2021
@TOTA42
Copy link
Author

TOTA42 commented Oct 8, 2021

Ran a git bisect between 2.0.8 and 2.0.9.1 (git bisect log in link below) and traced it down to the failing commit: d13ffa0, which happens to be:

🔨 Creality v4 with STM32 HAL (#21999)

- New STM32 env for Creality V4 boards.
- Separate Libmaple targets into their own `ini` file.
- Temporarily remove unusable targets from `pins.h`.

git_bisect_log.txt

@ellensp
Copy link
Contributor

ellensp commented Oct 8, 2021

so does environment STM32F103RET6_creality_maple work as expected then?
Sadly this is a bit like saying It worked under Windows XP, but it doesn't work under Windows 10... but is a start

@TOTA42
Copy link
Author

TOTA42 commented Oct 8, 2021

Did a quick build on 2.0.9.2 with the STM32F103RET6_creality_maple instead of the STM32F103RET6_creality and it does seem to boot with the E0_DRIVER_TYPE as TMC2208. I haven't checked any other functionality besides that it boots.

@TOTA42
Copy link
Author

TOTA42 commented Oct 12, 2021

I was able to run the M122 command and received the expected register responses from the TMC2208 with the STM32F103RET6_creality_maple environment. Any ideas/tests I can run to trace down the boot issue with the STM32F103RET6_creality environment?

@masterxq
Copy link

Can confirm, not booting. Does with libmaple.
Could be nice to have this fixed or find out what we are doing wrong :/

@stikzoo
Copy link

stikzoo commented Mar 13, 2022

Hello, I have same issue. Someone find this problem?

@EntasDisk
Copy link

Hello, do you have working firmware? BLTouch
No matter what I do, I always get an error. I don't have any in my code info.

@ellensp ellensp reopened this Jul 28, 2022
@ellensp
Copy link
Contributor

ellensp commented Jul 28, 2022

This is still an issue

@MarlinFirmware MarlinFirmware deleted a comment from github-actions bot Aug 6, 2022
@MarlinFirmware MarlinFirmware deleted a comment from github-actions bot Aug 6, 2022
@thinkyhead thinkyhead added the Needs: More Data We need more data in order to proceed label Aug 6, 2022
@thinkyhead
Copy link
Member

thinkyhead commented Aug 6, 2022

How's it going? So let's see what we can see, here…

According to the datasheet pin PA3 is connected to TIM5_CH4. In Marlin the STM32F103RE_creality environment used to build this board has the build argument -DTIMER_SERVO=TIM5 to use timer 5 as the timer for servos. If you want to use PA3 for your own purposes, and there is a BLTouch, servo, or even potential servo use in Marlin, then you'll need to change that TIM5 to some other free timer. Or, you can try defining SERVO0_PIN as -1 in your configuration, and this should prevent Marlin from trying to do anything servo-related.

@EntasDisk
Copy link

SERVO0_PIN

Which file will we set this "SERVO0_PIN" exactly. I don't know about it. I'm trying to learn.

@ellensp
Copy link
Contributor

ellensp commented Aug 17, 2022

add #define SERVO0_PIN -1 to your Configuration.h

This overrides the one set in your boards pin.h file.

@EntasDisk
Copy link

Such an error occurs.

Marlin\src\HAL\STM32../../inc/SanityCheck.h:1523:8: error: #error "SERVO0_PIN must be defined for your servo or BLTOUCH probe."
1523 | #error "SERVO0_PIN must be defined for your servo or BLTOUCH probe."

@DragRedSim
Copy link
Contributor

Hmm, looks like a conundrum here. My setup has a BLTouch (and uses it for Z-homing, so disabling it is not an option). But I can't really see any timers that don't conflict...
I'm trying to set up a SoftwareSerial on PA7 (the Z-endstop) to one driver only. I'm having the printer hang before loading as well (screen powers up, but nothing is drawn; serial through the CH340 chip is never initialised; but if I set the driver back to standalone configuration, and attempt to SD flash again, it comes back to life).

TIM1: default uses PB12 through PB15 and PA8 through PA12; these pins are used for the screen encoder and beeper, along with serial communication to the CH340 and EEPROM access.
TIM2: default uses PA0 through PA3, which are used to control the MOSFETs for heating elements and cooling fans, and wouldn't work anyway for PA3, since we are trying to free that one up!
TIM3: default uses PA6 and PA7, as well as PB0 and PB1; connected to Y- and Z- endstops, and to the BLTouch.
TIM4: defaults to PB6 through PB9; Y and Z stepper driver control.
TIM5: what we already have: see TIM2, it is tied to the same four pins
TIM6, TIM7: both basic timers, unsure if suitable for handling servos.
TIM8: see TIM3, shared pins; also uses PC6-PC9, 7-9 are used for SD card interface.

@d-rez
Copy link

d-rez commented Sep 28, 2022

add #define SERVO0_PIN -1 to your Configuration.h

This overrides the one set in your boards pin.h file.

This results in multiple errors as below:

Marlin\src\HAL\STM32\tft\../../../inc/SanityCheck.h:1700:8: error: #error "SERVO0_PIN must be defined for your servo or BLTOUCH probe."
 1700 |       #error "SERVO0_PIN must be defined for your servo or BLTOUCH probe."

If I comment out the SERVO0_PIN check from SanityCheck.h it compiles fine, however the firmware still gets stuck at a blank screen.

I've finally caved in today and modded my Ender 3 with the link for UART today and now I'm learning I can't use linear advance with the current firmware, rip :(

EDIT: compiling maple makes the LCD intiialize and get to home screen and update values, however pressing the rotary encoder results in a printer reset (fw reboots) making it unusable :(

@ellensp
Copy link
Contributor

ellensp commented Sep 28, 2022

#define SERVO0_PIN -1 breaks a bltouch which thinks its a servo to deploy and retract the probe.

@d-rez
Copy link

d-rez commented Sep 28, 2022

I guess my question is what has changed since 2.0.8 (in regard to timers) if the older version had no issues working with PA3? What's the root cause and would it be possible to work around this?

I'll look at soldering to PA13 in the meantime

EDIT: PA13 works fine (at least based on initial limited tests, it's technically easier to use since it's the SWDIO pin of ICSP pin header solderpoints).

@EntasDisk
Copy link

Did you solve the problem with the Pa 13?
Is it true that you did it as pa13 and R19?
Do you have the settings files and output sample you made?

@d-rez
Copy link

d-rez commented Sep 29, 2022

@EntasDisk yes linear advance seems to operate on PA13 although results don't look very satisfying.

And no, I didn't use R19, my board is a v4.2.7 with TMC2225's so I used a different one that goes to uart pin of the extruder driver. Which is R52 on my board.

Schematics for both boards here:

https://klipper.discourse.group/t/creality-board-4-2-2-and-4-2-7-schematics/3104

As for settings I can make a patch sometime later based off my config.

@thisiskeithb
Copy link
Member

I’m not sure if you saw the latest release, but as of Marlin 2.1.1, Linear Advance works on 2208s/2225s now, including non-modded Creality boards.

@d-rez
Copy link

d-rez commented Sep 29, 2022

@thisiskeithb interesting, I definitely didn't go through the whole changelog as I was updating from mid-2021 build of 2.0.x bugfix to most recent 2.1.x bugfix

So LA should work without UART access? Did I just waste time modding my board? 😂

Also hmm is there even any advantage to using uart now? I wonder. I'll try to find some info/discussions on this. Thanks.

EDIT: #24533 is the PR for this fix

@Emerica
Copy link

Emerica commented Jan 20, 2023

Looking for 1 more working PIn I guess to make things work non-maple with a BLtouch in it's stock port.
Been toying with this the past few days on a board with 2209's (B) on the SD card slot.

PA13, PA14 , PA15 (chip soldered).
PA3 and PA4 only seem to work in the Maple env due to the Timer issues,
It does work with maple on PA4 here, would hang boot with oem.

>>> M122
SENDING:M122
		X	Y	Z	E
Address		3	3	3	3
Enabled		false	false	false	false
Set current	800	800	800	800
RMS current	795	795	795	795
MAX current	1121	1121	1121	1121
Run current	25/31	25/31	25/31	25/31
Hold current	12/31	12/31	12/31	12/31
CS actual	12/31	12/31	12/31	12/31
PWM scale
vsense		1=.18	1=.18	1=.18	1=.18
stealthChop	false	false	true	false
msteps		16	16	16	16
interp		true	true	true	true
tstep		max	max	max	max
PWM thresh.
[mm/s]
OT prewarn	false	false	false	false
pwm scale sum	14	14	14	14
pwm scale auto	0	0	0	0
pwm offset auto	36	36	36	36
pwm grad auto	14	14	14	14
off time	4	4	4	4
blank time	24	24	24	24
hysteresis
 -end		2	2	2	2
 -start		1	1	1	1
Stallguard thrs	0	0	0	0
uStep count	24	24	8	24
DRVSTATUS	X	Y	Z	E
sg_result	0	0	0	0
stst
olb		*	*		*
ola		*	*		*
s2gb
s2ga
otpw
ot
157C
150C
143C
120C
s2vsa
s2vsb
Driver registers:
		X	0x80:0C:00:C0
		Y	0x80:0C:00:C0
		Z	0xC0:0C:00:00
		E	0x80:0C:00:C0
Testing X connection... OK
Testing Y connection... OK
Testing Z connection... OK
Testing E connection... OK

I tried TIM6 and TIM3 , it compiles, but fails to boot. Lack of TMC coms I guess. It's also somewhat odd that it's not catching this state with the TMC COMM ERROR?
Tried 7 and it fails to compile with timer conflicts.

Looks like PC0, PC1, PC13, PC14, PC15 are all NC and might be potentially useable like PA15, but will have to tinker more to make that happen.
If building against maple is fine, it might not really be worth it to be mucking around with more mod wire?
Should I be trying to make this work non-maple on another un-used pin?
I haven't connected the board to a printer yet, so I've been mostly unable to test if it's actually broken in some other way.
Why does maple not have this Servo/Timer conflict? Like asked above, can the root cause be corrected, or is maple flawed/sharing a line in some way and it just appears to work fine?

Trying to judge if it's worth the risk to stay out of deprecation?

@phantum29
Copy link

Does any one have any updates? Well, after finding a guide for putting all my 2225's (Creality 4.2.7) into uart mode, I guess it's not entirely needed anymore since LA is working? I wanted uart for vref and I could only presume it would work better for some of these 'new' features. I have BLT, and used PA4, PA7, PA13 and PA14. I was having compile issues with commenting out z_stop_pin, so I set that to PC0. Same problem, blank LCD screen, no serial > USB comms come up. Flash with only Z and E as 2208 (non-stand alone mode) it boots up at least, add in X or Y and same results - blank screen no D4 LED activity. All my testing has been just board, and LCD (E3V2 Display), nothing else, so firmware with Z, E, might still fail when I go to attempt a print.

@Emerica
Copy link

Emerica commented Aug 16, 2023

I converted that machine to Switchwire, so it's running klipper now.

@thisiskeithb thisiskeithb removed the Needs: More Data We need more data in order to proceed label Apr 16, 2024
@pedrofabian
Copy link

pedrofabian commented Jun 23, 2024

I'm having a very similar issue.
UART mod on 4.2.7 Creality Board with TMC2225 on Marlin 2.1.2.2
X uart connected to PA3
Y uart connected to PC1
Z uart connected to PC0
E uart connected to PA15

I also did a mod to have the hotend fan controlled by PWM connected to PC15.

Marlin has blank screen on boot unless I use TMC2208_STANDALONE with X, Y, and Z stepper drivers.
E works with just TMC2208 and extruder autofan with PC15 works too.


edit 1: to say that I have built marlin with maple and was able to boot. Using the knob seems to restart the printer though. But I am able to communicate via USB and confirm the UART mod was successful on all stepper motor drivers.


edit 2: For anyone looking for an immediate solution, I was able to finally proceed with the following pinout on a non-maple build
X - PA13 // SWDIO Unused Pin
Y - PB2 // Display Port Unused Pin
Z - PA14 // SWCLK Unused Pin
E - PA15

Noting

  • I tried connecting Y to PA7 which is my unused Z endstop pin, but I ran into the same issue.
  • I suspect PC6 might also work, which is the other unused display port pin if you don't want to do any micro soldering

Copy link

Greetings from the Marlin AutoBot!
This issue has had no activity for the last 90 days.
Do you still see this issue with the latest bugfix-2.1.x code?
Please add a reply within 14 days or this issue will be automatically closed.
To keep a confirmed issue open we can also add a "Bug: Confirmed" tag.

Disclaimer: This is an open community project with lots of activity and limited
resources. The main project contributors will do a bug sweep ahead of the next
release, but any skilled member of the community may jump in at any time to fix
this issue. That can take a while depending on our busy lives so please be patient,
and take advantage of other resources such as the MarlinFirmware Discord to help
solve the issue.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Oct 7, 2024
Copy link

github-actions bot commented Dec 6, 2024

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.

@github-actions github-actions bot locked and limited conversation to collaborators Dec 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests