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] emergency parser not working for STM32F1 (BTT SKR E3 mini v2.0) #19623

Closed
coudu opened this issue Oct 5, 2020 · 39 comments
Closed

[BUG] emergency parser not working for STM32F1 (BTT SKR E3 mini v2.0) #19623

coudu opened this issue Oct 5, 2020 · 39 comments

Comments

@coudu
Copy link

coudu commented Oct 5, 2020

Bug Description

Emergency parser does not work for my STM32F1 board (BTT SKR E3 mini v2.0).
Emergency commands are not jumping the queue and are executed "in normal queue order".

My Configurations

configs.zip

Steps to Reproduce

  1. compile latest bugfix-2.0.x for BTT SKR E3 mini v2.0 with emergency parser enabled
  2. send normal commands to the printer
  3. then send an emergency command (M112, M108 or M876)

Expected behavior: [What you expect to happen]
Emergency command should jump the queue and be executed asap

Actual behavior: [What actually happens]
Emergency command is executed after/at the end of other commands

@coudu
Copy link
Author

coudu commented Oct 6, 2020

might be related to #19567 as I see the same behavior when sending M108 after filament load...

@boelle
Copy link
Contributor

boelle commented Oct 13, 2020

Please test the bugfix-2.0.x branch to see where it stands. If the problem has been resolved then we can close this issue. If the issue isn't resolved yet, then we should investigate further.

@coudu
Copy link
Author

coudu commented Oct 14, 2020

Was already on latest bugfix, I just retested yesterday with latest commits and results are the same. I'am running the same config on a LPC1769 board and there is no issue with emergency parser.

@rhapsodyv
Copy link
Sponsor Member

None of the emergency parser commands work? or only M108?

@coudu
Copy link
Author

coudu commented Oct 14, 2020

unfortunately none... M108, M112, M876 to answer an host prompt, etc... everything is treated in queue order as if there were no emergency parser.

@rhapsodyv
Copy link
Sponsor Member

which env are you using?

@coudu
Copy link
Author

coudu commented Oct 14, 2020

I normally use STM32F103RC_btt_512K but I also tested STM32F103RC_btt_512K_USB and results are the same.

@rhapsodyv
Copy link
Sponsor Member

STM32F103RC_btt_512K with SERIAL_PORT -1 is not currently handled.

But STM32F103RC_btt_512K_USB must work... Can you try again?

@coudu
Copy link
Author

coudu commented Oct 14, 2020

not currently (LPC board in the printer) but i'll drop the STM32F1 in the printer to retest over the week-end.

@github-actions
Copy link

This issue has had no activity in the last 30 days. Please add a reply if you want to keep this issue active, otherwise it will be automatically closed within 7 days.

@sjasonsmith
Copy link
Contributor

I'm replying to keep this open. The correct solution is probably to move boards to the STM32 HAL.

@coudu
Copy link
Author

coudu commented Nov 15, 2020

sorry but with lockdown back here in France and me not being locked and hard at work, I didn't have any time to put the board back in the printer to test. This SMT32F1 board will eventually go in a printer at work or a friend's one so I'll be able to test sooner or later...
Thanks!

@rhapsodyv
Copy link
Sponsor Member

There're 3 types of usb/serial in STM32F1:

  1. Hardware Serial - Support Emergency Parser
    Using SERIAL_PORT != -1
  2. Usb Serial - DON'T Support Emergency Parser
    Using SERIAL_PORT == -1
  3. Usb Serial + Usb Composite (to use mass storage) - Support Emergency Parser
    Using SERIAL_PORT == -1 + USE_USB_COMPOSITE is defined (envs with _USB)

The reason is that lib maple don't give us a way to intercept usb data when using only UsbSerial. To do that, we would need to copy too much code from lib maple, and don't worth it in the current state of STM32F1.

I suspect that this issue is because the user are using (2).

@Sebazzz
Copy link
Contributor

Sebazzz commented Dec 3, 2020

I use SERIAL_PORT=-1 with USE_USB_COMPOSITE and it is also not working. To make it worse, understandably, EMERGENCY_PARSER commands are skipped during normal processing, so M112 does not work at all (gcode.cpp):

#if DISABLED(EMERGENCY_PARSER)
case 108: M108(); break; // M108: Cancel Waiting
case 112: M112(); break; // M112: Full Shutdown
case 410: M410(); break; // M410: Quickstop - Abort all the planned moves.
TERN_(HOST_PROMPT_SUPPORT, case 876:) // M876: Handle Host prompt responses
#else
case 108: case 112: case 410:
TERN_(HOST_PROMPT_SUPPORT, case 876:)
break;
#endif

@rhapsodyv
Copy link
Sponsor Member

Very weird. From where are you sending the M112? Computer serial or TFT Serial?

@Sebazzz
Copy link
Contributor

Sebazzz commented Dec 3, 2020

Host, Octoprint. From TFT it does work, but that isn't using maple of course.

@rhapsodyv
Copy link
Sponsor Member

I was looking at the code, and it seems exactly the same as the original PR, that @thisiskeithb tested: #19281

@Sebazzz
Copy link
Contributor

Sebazzz commented Dec 3, 2020

Sorry - my fault - 9a5fae4 isn't in the source I'm building

@rhapsodyv
Copy link
Sponsor Member

It's already merged on bugfix since Sep 6.

@thisiskeithb
Copy link
Member

Sorry - my fault - 9a5fae4 isn't in the source I'm building

Always test with the latest bugfix-2.0.x.

@Sebazzz
Copy link
Contributor

Sebazzz commented Dec 3, 2020

Sorry - my fault - 9a5fae4 isn't in the source I'm building

Always test with the latest bugfix-2.0.x.

Sorry I'm always confused with the branching here (vs develop/release branches). It is not in Marlin 2.0.7.2 which is what I was testing - sorry all.

@thisiskeithb
Copy link
Member

thisiskeithb commented Dec 3, 2020

Testing the latest bugfix-2.0.x (3eddbc7):

  • Board: SKR Mini E3 V2
  • Environment: STM32F103RC_btt_USB
  • Serial Ports: #define SERIAL_PORT 2 / #define SERIAL_PORT_2 -1:

Using OctoPrint: I sent M109 S210 to start a preheat & wait for hotend temp. Then I sent M112 and OctoPrint disconnected, but Marlin didn't halt.

Using a serial-connected BigTreeTech TFT: I sent M109 S210 to start a preheat & wait for hotend temp. Then I sent M112 and Marlin halted.

Unfortunately, there's something wrong with my board since it's causing the Z stepper motor to heat up hotter than the sun upon boot, so I won't be able to test further until I get a replacement in.

@rhapsodyv
Copy link
Sponsor Member

Anyone can test if this branch solves the issue?

https://github.com/rhapsodyv/Marlin/tree/fix-ep-usb-composite-stm32f1

Thanks

@Sebazzz
Copy link
Contributor

Sebazzz commented Dec 22, 2020

3\. Usb Serial + Usb Composite (to use mass storage) - Support Emergency Parser
    Using `SERIAL_PORT == -1` + `USE_USB_COMPOSITE` is defined (envs with `_USB`)

I can confirm what @thisiskeithb says. To BTW retry it your can also use other emergency gcodes like M410 quick stop so Octoprint doesn't try to be smart. This happens on latest bugfix-2.0.x.

@rhapsodyv Your branch appears to be deleted.

Sebazzz added a commit to CR6Community/Marlin that referenced this issue Dec 22, 2020
@rhapsodyv
Copy link
Sponsor Member

@Sebazzz my bad. I just fixed the branch. Can you test again?

@Sebazzz
Copy link
Contributor

Sebazzz commented Dec 23, 2020

@Sebazzz my bad. I just fixed the branch. Can you test again?

@rhapsodyv No, sorry, doesn't work. All EMERGENCY_PARSER commands get ignored.

Is this bug a regression btw or has it never worked?

@rhapsodyv
Copy link
Sponsor Member

Is this bug a regression btw or has it never worked?

It's hard to say. I don't have a F1 with UsbSerial/CDC to test. When I did the development, @thisiskeithb tested it. But as we have some many serial options, could be a wrong test. But the code changed a bit over the months too...

Can you confirm that my_rx_callback is called?

@Sebazzz
Copy link
Contributor

Sebazzz commented Jan 3, 2021

Is this bug a regression btw or has it never worked?

It's hard to say. I don't have a F1 with UsbSerial/CDC to test. When I did the development, @thisiskeithb tested it. But as we have some many serial options, could be a wrong test. But the code changed a bit over the months too...

Can you confirm that my_rx_callback is called?

No, it doesn't appear to be. I've put a while(true) in my_rx_callback and the printer keeps responding just fine.

@FirewinX
Copy link

FirewinX commented Jan 17, 2021

i have the same Problem on a Ender 5 with a BIGTREETECH SKR MINI E3 V2.0 with stock Config Creality/Ender-5/BigTreeTech SKR Mini E3 2.0 on build STM32F103RC_btt_512K unload per btt tft35 is possible, but on octoprint shows permanently "paused for user" and cannot resume the print.

  • no feedback about filament changes on the tft35
  • after unloading, printing is simply continued without filament
  • loading afterwards is not possible

@Sebazzz
Copy link
Contributor

Sebazzz commented Jan 17, 2021

@thisiskeithb @rhapsodyv Any pointers where I should look and try to debug it?

@FirewinX
Copy link

what should the line with while (true) look like in msc_sd.cpp @Sebazzz

@rhapsodyv
Copy link
Sponsor Member

Author here. Sadly I don't have such boards to test. If anyone that can test it the code for me, reach on discord, I can fix the issue. Same username.

@FirewinX
Copy link

i have the board for testing available

@Sebazzz
Copy link
Contributor

Sebazzz commented Jan 18, 2021

@rhapsodyv I contacted you on discord, my handle is the same

@FirewinX
Copy link

i write you on discord on private message @rhapsodyv

@arjanmels
Copy link
Contributor

I also had problems on my SKR Mini-E3 v1.2 board. I submitted following fix: #21011, maybe this helps for v2.0 as well?

@Sebazzz
Copy link
Contributor

Sebazzz commented Feb 8, 2021

Confirmed @arjanmels - your fix works on the BTT SKR CR6 board. Thank you.

Sebazzz added a commit to CR6Community/Marlin that referenced this issue Feb 8, 2021
@thisiskeithb
Copy link
Member

Closing since #21011 was merged.

@github-actions
Copy link

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 Apr 10, 2021
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

8 participants