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

BigTreeTech Smart Filament Detection Module not triggering on when connected to PT-DET #144

Open
TerawattX opened this issue Dec 5, 2019 · 13 comments

Comments

@TerawattX
Copy link

I have configured by board and connected the Smart Filament Detection Module per the provided instructions in the Github repository, however as soon as the first layer has started it will indicate there is no filament in the machine and launch the M600 command.

This issue was also reported by another user on the Filament Detection Module repo:(bigtreetech/smart-filament-detection-module#1)

They were able to confirm signaling from the module, but the board was not sensing it.

@pa0los
Copy link

pa0los commented Dec 6, 2019

PT-DET is meant for switching the power supply.
For filament runout you should use E0-STOP connector (see the pin defines file in Marlin for SKR mini E3).

@TerawattX
Copy link
Author

That certainly explains the issue, though I could have sworn I read you could change the pins in the config to use PC12 vs PC15.

Question: The detection module ships with a 3 to 4 pin cable, E0-Stop is a 2 pin connector. Will the Filament Detection module still operate properly on 2 pins vs 3? I know this is a different product from the SKR board, but since both are BigTreeTech products I figured it wouldn't hurt to ask.

@TerawattX
Copy link
Author

So I'm going to reopen this because the documentation isn't very clear on the issue. The PDF for the module simply states to use "any extended interface." I took this to indicate that PT-DET would work as long as you set the interface accordingly in the pins_BTT_SKR_MINI_E3.h file.

There is also a comment by another user that they were able to get theirs working on PT-DET by setting FIL_RUNOUT_INVERTING to true, however when I do this it simply is always open and never triggers when it runs out of filament.

Is there a clearly defined list of which interfaces are valid? As I stated earlier, I don't think E0-Stop would work because the module requires a SIN, VDD, and GND wire, and I'd use the Servos interface, but that's where my BLTouch is hooked up. Any alternatives or confirmation one way or another about PT-DET?

@TerawattX TerawattX reopened this Dec 20, 2019
@btsubjectdata
Copy link

Mine doesn't work either. Same exact issue. Please advise.

@usk-johnny-s
Copy link

usk-johnny-s commented Feb 25, 2020

I found root of this issue.

At following line will change a PortC-12 to Output-LOW. (C-12 is connected PT-DET.)

For resolv this issue, modify maple configuration.
Modify at L.102 -103 in "STM32F1/variants/generic_stm32f103r/board/board.h"

#define BOARD_USB_DISC_DEV NULL
#define BOARD_USB_DISC_BIT NULL

If modify maple is difficult, quick workaround is re-initialize PortC-12 after "MYSERIAL1.begin(BAUDRATE);".
Insert these lines at L.873 in Marlin.cpp

#if HAS_FILAMENT_SENSOR
runout.setup();
#endif

But this has PortC-12 Output LOW while very short time. it will cause level conflict If external device outputs high logic level.


In Detail...
"MYSERIAL1" is defined as USBSerial of maple framework.
This BIGTREETECH-SKR-mini-E3 is chose generic_stm32f103r as maple framework configuration.

"BOARD_USB_DISC" is defined as PortC-12 at
https://github.com/rogerclarkmelbourne/Arduino_STM32/blob/0383384f4cc91aadee1501e11bf08dd3e62d9fb9/STM32F1/variants/generic_stm32f103r/board/board.h#L102

Followings are indicate to set a PortC-12 to Output and LOW. https://github.com/rogerclarkmelbourne/Arduino_STM32/blob/0383384f4cc91aadee1501e11bf08dd3e62d9fb9/STM32F1/cores/maple/usb_serial.cpp#L75
and
https://github.com/rogerclarkmelbourne/Arduino_STM32/blob/0383384f4cc91aadee1501e11bf08dd3e62d9fb9/STM32F1/cores/maple/libmaple/usb/stm32f1/usb_cdcacm.c#L387


I requested modify maple framework.
rogerclarkmelbourne/Arduino_STM32#759

@qwewer0
Copy link

qwewer0 commented May 19, 2020

@usk-johnny-s Can't find any that you mentioned. If this is still a thing, then could you point me to the right direction?
What should I download/change?

@usk-johnny-s
Copy link

usk-johnny-s commented May 20, 2020

Unfortunately, Following issue close but nothing fixed.
rogerclarkmelbourne/Arduino_STM32#759

In my build environment, It's on Windows 10 and based on SKR's how to.
First time build Marlin on VS code, platformio downloads related packages.
"STM32F1/variants/generic_stm32f103r/board/board.h" that is mentioned previous my post, is located "%USERPROFILE%.platformio\packages\framework-arduinoststm32-maple\STM32F1\variants\generic_stm32f103r\board\board.h".
I directly edited it and then re-build Marlin on VS code.

@qwewer0
Copy link

qwewer0 commented May 20, 2020

Thanks for the detailed explanation, got it now.
Do you think that it can have a side effect?

@usk-johnny-s
Copy link

usk-johnny-s commented May 21, 2020

At L.102 -103 in "STM32F1/variants/generic_stm32f103r/board/board.h",
To modify to NULL is no side effect on SKR-mini-E3, I think.
Because, at SKR-mini-E3, pin "GPIOC-12" it previous definition, is just connected to PT-DET only, not assigned any function at normal.

At original maple, USB_DISC signal cause to drives USB-DP to low forcely, it cause force disconnect USB interface from host.
"maple" is "https://www.leaflabs.com/maple", and schematics is in "https://github.com/leaflabs/maple".

USB_DISC is described in Maple framework README.
https://github.com/rogerclarkmelbourne/Arduino_STM32/blob/9d46a1c27d4dc9dd4df06b76a1d81684519d8acc/STM32F1/cores/maple/libmaple/usb/README#L49-L51

https://github.com/rogerclarkmelbourne/Arduino_STM32/blob/9270ebe4081ce357fe4e8e19edaf1aa87052a25d/STM32F1/cores/maple/libmaple/usb/stm32f1/usb_cdcacm.c#L387-L392

https://github.com/rogerclarkmelbourne/Arduino_STM32/blob/9270ebe4081ce357fe4e8e19edaf1aa87052a25d/STM32F1/cores/maple/libmaple/usb/stm32f1/usb_cdcacm.c#L403-L406

@Cheule
Copy link

Cheule commented Jun 27, 2020

TL;DR PT-DET port is not recommended for 3 wire filament sensors.

Using a TH3D 3 wire filament sensor, I found that the PT-DET port was very flaky on my board. When the filament sensor would close (filament out) the LCD display (stock 12864) would blank/glitch/freeze.

I ordered another e3 Mini v1.2 board and it had the same problems. Finally I found out that using the PC12 pin for filament sensors on the PT-DET port is not wise on this board. Instead using PC15 on the E0-STOP port is recommended. I could have just wired the Black wire (GND) and white wire (S) from my sensor to the E0-STOP port, and ignored the red wire (5v) but I didn’t want to lose my LED confirmation of inserted filament. So I attached the red filament sensor wire to the 5v of PT-DET port.

Picture of red/white/black wire placement on the BTT SKR e3 mini v1.2 board

In Marlin, don’t forget to #define FIL_RUNOUT_PIN PC15

@usk-johnny-s
Copy link

PC12 is 5V tollerant, but some one is not.
Check out connecting sensor output level comply with MCU pin, if you wish to use other pin.

PC12:I/O Level is indicated "FT". ( Five Volts Tollerant)
https://www.st.com/resource/en/datasheet/stm32f103rc.pdf#page=35

PC15:I/O Level is nothing indicated. (NOT Five Volts Tollerant)
https://www.st.com/resource/en/datasheet/stm32f103rc.pdf#page=31

@Cheule
Copy link

Cheule commented Jul 3, 2020

PC12 is 5V tollerant, but some one is not.
Check out connecting sensor output level comply with MCU pin, if you wish to use other pin.

PC12:I/O Level is indicated "FT". ( Five Volts Tollerant)
https://www.st.com/resource/en/datasheet/stm32f103rc.pdf#page=35

PC15:I/O Level is nothing indicated. (NOT Five Volts Tollerant)
https://www.st.com/resource/en/datasheet/stm32f103rc.pdf#page=31

Wait, so you are saying the PT-DET port (PC12) is 5v tolerant and the PC15 is not? On the two boards I have to test, both PT-DET ports didn’t like 5v, and PC15 was fine.

Let me clear; I’m believe you that the documentation says what you say. However I’m saying in practice the LCD display would corrupt when PC12 was given 5v (I even did a test with a DuPont cable) and PC15 has been fine.

@usk-johnny-s
Copy link

Watch out difference between I/O Level "FT" or not, about "Vin" of "Absolute maximum ratings".
https://www.st.com/resource/en/datasheet/stm32f103rc.pdf#page=43

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants