-
-
Notifications
You must be signed in to change notification settings - Fork 19.2k
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
[WIP] Allow Host Access any Marlin attached SD #19939
[WIP] Allow Host Access any Marlin attached SD #19939
Conversation
Does this still require mounting/unmounting to decide whether the device is used over USB or by Marlin? |
No, but yes. As the all writes call being in marlin side, we can put a lock to avoid a parallel write call coming from the USB IRQ. It will avoid two concurrent writes messing each other. The problem is that a file save call multiples writes. And we can't mix the write calls from different files. So we need a lock in a high layer: the point where the file begin/end to be saved. But, I didn't look after it yet, if we have this place to put the lock. |
It probably makes sense to just require mount/unmount for now. It would be nice if any solution can (eventually) behave the same with STM32. |
Looks like it's easy to implement msc for stm32duino using marlin sd2card. We just need to implement this callbacks:
But we will need to send a PR to stm32duino, like I did with the thumb driver, to setup this api. |
Please enable SD logging with |
At the moment we are conflicting with |
@thinkyhead I sent a PR to lpc framework here, that will allow overwrite those functions p3p/pio-framework-arduino-lpc176x#45 As soon as it get merged I will update the code in marlin side accordingly. |
@rhapsodyv I tested this fix locally including the lpc framework PR to see if my problem in #19750 is solved.
I don't know if this is expected or not, i kinda wished i would be able to use the sdcard on both the host and the printer simultaneously. Regards |
That's great!! I'm happy that you tested it and solves your issue! Yes, you can't use the media in the host while it's attached to marlin. The reason is to avoid SD corruption: we can't do any time of locking, so if the host and the marlin start to write at same time, it will corrupt the SD. Because of that, only one can access at time. It always worked this way. We talked a lot for alternatives, but none is safe enough. Thanks! |
4274255
to
a97a1ae
Compare
d814f97
to
fcfe64b
Compare
I want to work a bit on Multiple Media support, before this get merged. |
83cc0bc
to
73f6426
Compare
Any idea when will this get merged? |
27b6361
to
6076e60
Compare
@rhapsodyv Will this feature work on an MKS Robin Lite v1.1? |
No. It is only for LPC-based boards. |
80cd234
to
3d2b2ca
Compare
627f8ef
to
20dea22
Compare
97117d0
to
5979aab
Compare
43e0584
to
6ad5711
Compare
52a9e5e
to
7e60d15
Compare
a71a62c
to
250fd60
Compare
40e1292
to
339773d
Compare
Description
LPC framework have a few requirements for the board work with MSC (exclusive access to SPI 1 and some defaults settings). Not all boards support it. Ex: MKS SGEN L V2.
I sent a PR to LPR Framework to allow the DiskIO functions been overwritten (p3p/pio-framework-arduino-lpc176x#45), so we can use the Marlin Sd2Card API (SPI, SDIO and even flash drive) to share the disc with the host.
This PR does the Marlin part. It will allow the disc being accessed by marlin using the correct board settings. But, it goes beyond: it will allow share with the host any media that marlin can read, even a LCD SD card!
I will take a look if we can do it for others HAL too.
Benefits
Fix #19917
Allow LCD SD to be shared with the host PC
Related Issues
p3p/pio-framework-arduino-lpc176x#45
#19917
#19932