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.22k stars 19.22k forks source link

[BUG] STM32F103RE (BTT_SKR_E3_DIP) - composite USB fails when SDSUPPORT enabled #18097

Closed Bob-the-Kuhn closed 4 years ago

Bob-the-Kuhn commented 4 years ago

The replaces issue #18073. I stated the wrong motherboard in that one.


Enabling USB and SDSUPPORT on a BTT_SKR_E3_DIP does not result in a useable virtual drive on the PC.

If SDSUPPORT is not enabled then the virtual drive appears on the PC.

PR #17400 enabled the composite USB option for the STM32F103RE.

SETUP: BTT_SKR_E3_DIP motherboard (STM32F103RE with 512K FLASH) Today's Bugfix-2.0.x PlatformIO in Atom Configuration.h changes:

Auto Build PIO Upload used to build the firmware.bin file

Copied firmware.bin to SD card Inserted SD card into motherboard Attached USB cable to motherboard

RESULT: Firmware is updated. A window pops up on the PC saying the disk needs to be formatted.
Host USB link is up while this window is up. Host shows proper SD card contents Clicked on FORMAT.
PC said it was unable to format the disk. Clicked OK and then cancelled all PC windows concerning formatting the drive. Host USB link stays up. Host shows proper SD card contents. A mapped/virtual drive is not present.

THINGS I'VE TRIED: Different size SD cards (128MB & 16GB) - format window shows correct disk size. Formatted SD card on PC with exFAT & NTFS - now get different errors.


I'm not familiar with the Maple environment but it appears to me that the composite USB software wants to use the SD card in SDIO mode (MSC read & write) while the Marlin host interfacing software wants to use the SD card in SPI mode.//github.com/MarlinFirmware/Marlin/issues/new/choose

sl1pkn07 commented 4 years ago

same as #18073. works with RC chips? (DIP with RCT6)

E3 and DIP uses the same pins

Screenshot_20200525_012738 Screenshot_20200525_013307

Screenshot_20200525_012836 Screenshot_20200525_013243

Screenshot_20200525_013000 Screenshot_20200525_013144

Bob-the-Kuhn commented 4 years ago

What is really strange is I get a useable mapped virtual drive if SDSUPPORT is not enabled.

When SDSUPPORT is enabled and the SD card is in the controller's socket and the controller is reset (or powered up) then Windows pops up the error message and says the drive needs to be formatted.

sjasonsmith commented 4 years ago

What is really strange is I get a useable mapped virtual drive if SDSUPPORT is not enabled.

With LPC you have to unmount the drive in Marlin before it is usable in the host. Are you perhaps encountering the same thing for STM32?

Bob-the-Kuhn commented 4 years ago

Turns out the problem only occurs when SD_CHECK_AND_RETRY is enabled.

With it disabled the virtual drive is always available and works as expected. The host also has access to the SD card and can mount and unmount it. The mount and unmount operations do not affect the availability of the virtual drive.

Bob-the-Kuhn commented 4 years ago

I've created PR #18108 to keep this from happening to others.

github-actions[bot] commented 4 years ago

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.