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.03k stars 19.13k forks source link

[BUG] Marlin on BigTreeTech SKR PRO can't be configured to use the onboard SD-card #14684

Closed eightheads closed 4 years ago

eightheads commented 4 years ago

Description

Bigtreetech SKR Pro control board(STM32F4) does not seem to hold SD-based EEPROM to the on-board card.

Steps to Reproduce

  1. Load lastest Marlin 2.0 to SKR Pro
  2. Make change via LCD to z-offset, etc, and Save to EEPROM
  3. Power cycle board. Settings have now reverted to initial(firmware) values

Expected behavior: Settings to EEPROM should save between power cycles

Actual behavior: Settings revert to initial firmware values after power cycle Configs.zip

tpruvot commented 4 years ago

if your sdcard is empty (no gcode file) it may cause an issue to save/load the eeprom.dat

tpruvot commented 4 years ago

But im not sure the F4/F7 can emulate that on the sdcard, seems a F1 feature

eightheads commented 4 years ago

if your sdcard is empty (no gcode file) it may cause an issue to save/load the eeprom.dat

The onboard SD card just has the boards firmware on it. I do not currently have an external SD in my LCD currently.

tpruvot commented 4 years ago

on the F4.. its emulated in the SoC flash, not on the SD

dch1921 commented 4 years ago

I'm seeing the same issue with the SKR Pro 1.1 Does not save changes to eeprom with M500

LinoBarreca commented 4 years ago

why don't you just take the Marlin/Marlin/src/HAL/HAL_STM32F1/persistent_store_sdcard.cpp which is a F1 platform feature and put it "a level UP" in the /shared features among the SpiEeprom.cpp and I2CEeprom.cpp defining it as VirtualSDEeprom.cpp?

This way you could #define VIRTUAL_SD_EEPROM 8 (where 8 = 8*512bytes = 4kb user defined eeprom file) in Configuration.h and use the sdcard instead of a real EEPROM chip on ANY platform/controller which has limited writes before you have to replace the whole board For platforms which have a real EEPROM chip you can use that OR the virtual eeprom on the SD (user preference). For platforms which don't have a real EEPROM you would force the define in the platform HAL layer.

And everyone would be happy.

Also...this could allow easy "eeprom" backup/restore from the sdcard: if your printer controller suddenly fails (I.E. a voltage regulator or a burnt IO port on the cpu) or you simply want to do an upgrade of your controller you can replace the board and have the same settings you had before the replacement (z-probe offset, bed mesh, speeds, steps, jerks and so on)

Considering this all, the only reason the user could still choose the "internal eeprom" is if he frequently swaps sd cards.

LinoBarreca commented 4 years ago

Apparently someone has done it at the "platform" level. https://github.com/bigtreetech/BIGTREETECH-SKR-PRO-V1.1/pull/21/files I wouldn't still merge this into marlin because I still think that EEPROM emulation should be handled at a global level and not at a platform level.

TheWeakBerlin commented 4 years ago

Any news on that Topic?

i just bought the SKR PRO Board and it runs well with Marlin 2.0.x i can store Data with M500 on a SD-Card but after shut down the Printer it will not load the Data (Mesh Data for example) but on the SD the eeprom.dat file is still there.

Do i need to implement the "platform level" solution into my version or is there something i missed?

in Configuration.h i set EEPROM_SETTINGS and at pins_BIGTREE_SKR_PRO_V1.1.h i tried both SRAM_EEPROM_EMULATION and FLASH_EEPROM_EMULATION, with no difference in behavior.

Greetings from Germany :D

EDIT: i just saw the "Platform Level" solution is allready there

tpruvot commented 4 years ago

There was a config storage version change last week end.. to V69. When that happens, the SD or FLASH (or whatever) cant be loaded... need a reset

boelle commented 4 years ago

@eightheads still having problems?

eightheads commented 4 years ago

@eightheads still having problems?

As far as I know this is still an issue in the main Marlin branch.

boelle commented 4 years ago

@eightheads have you tested it?

reloxx13 commented 4 years ago

still wont load config after restart.

TheWeakBerlin commented 4 years ago

I still have Problems too, if i use SRAM_EEPROM_EMULATION i get the version error with V69 of the EEPROM and if i use the FLASH_EEPROM_EMULATION it only loads old data but dont want to store new data.

Evg33 commented 4 years ago
#define EEPROM_SETTINGS
#define EEPROM_CHITCHAT       // Give feedback on EEPROM commands. Disable to save PROGMEM.
#define FLASH_EEPROM_EMULATION  // Use Flash-based EEPROM emulation

no problems

dineshvyas commented 4 years ago

PINS CONFIG THIS SHOULD WORK

eightheads commented 4 years ago

THIS SHOULD WORK

This would enable Flash based EEPROM emulation, not SD card EEPROM emulation though, correct?

dineshvyas commented 4 years ago

THIS SHOULD WORK

This would enable Flash based EEPROM emulation, not SD card EEPROM emulation though, correct?

Correct.

dineshvyas commented 4 years ago

I still have Problems too, if i use SRAM_EEPROM_EMULATION i get the version error with V69 of the EEPROM and if i use the FLASH_EEPROM_EMULATION it only loads old data but dont want to store new data.

FLASH_EEPROM_EMULATION is working fine for me, stores new data too.

AnHardt commented 4 years ago

The last time i tried EEPROM from SD-card worked. But only from the external card-reader on the display panel - not from the on-board-slot. But that's not a fault of the SD-EEPROM emulation but a more general on-board SD problem.

tpruvot commented 4 years ago

There was a lot of changes recently on the data storage, we are at v70, but there was other changes in the structure since... each time its reset... Are you sure its not your problem ?

dineshvyas commented 4 years ago

SD EEPROM is not supported on STM32F4. it is only supported on STM32F1, so not on SKR PRO V1.1

tpruvot commented 4 years ago

some F4 seems to have it, but maybe not the SKR... due to framework differences cf #14808 & #14844

AnHardt commented 4 years ago

@dineshvyas Don't be ridicules. It works on the external SD at SKR PRO 1.1!

dineshvyas commented 4 years ago

@dineshvyas Don't be ridicules. It works on the external SD at SKR PRO 1.1!

I have no such intention to ridicule. i just stated what I read. it was about on board sd card. I am not an expert, I am just looking for a solution. I apologize if by any mean I made you feel bad.

AnHardt commented 4 years ago

The problem with "fake news" is - it spreads faster than the truth. In a short while we will not believe in anything we read - only in our own experience.

boelle commented 4 years ago

@eightheads still having issues?

boelle commented 4 years ago

This would enable Flash based EEPROM emulation, not SD card EEPROM emulation though, correct?

correct

dineshvyas commented 4 years ago

Did anyone try SPI SDCARD or SPI EEPROM? SPI PINS are shared for TMC Stepper Motor Drivers, I2C EEPROM can be hooked?

rflulling commented 4 years ago

Just jumping in here. New addition to owners of one of these cards. The card has a bootloader.

My perception is that this is THEIR firmware that we cannot change. It managed your new firmware.bin file and changes the name of that file to FIRMWARE.CUR after it's been loaded. This bootloader also denies any direct access to the MCU. I have tried an STM programmer that should have been able to see the bootloader. No game, cant see a thing. 'It's the useless machine where when you press the switch to open the door a hand comes and flips the switch back.' I am sure there are more reasons why the bootloader is needed and or useful. For the moment I can only describe what I see. I have aksed for this booloader to be altered slightly so we can flash the Firmware or at least have access to the SD card in some way on the PC so we do not have to remove it at every tweak to the firmware. So far all contact has been ignored. So far while some user want this fix, many seem content to defend having to pull the card out without giving reason why its better.

I have read that on user was able to upload with BFU. But I was not able t confirm this. Attempts to use resulted in a port not found error.

The PlatformIO.ini spells out contact with the card as being CDC, and this is reflected in windows devices. Though so far it only accepts commands from the Slicer and nothing more.

Also keep in mind that BIQU says that their SKR PRO branch is not yet merged. While I have seen evidence that this is happening or looks like it. Certainly many changes have happened that seem to support the SKR PRO. I am not sure what all is done and how far that merger has progressed.

rflulling commented 4 years ago

In this case you are placing the firmware on the External SD card (SD1), by activating Marlin support for USB transfer to the external card, correct? You are not talking directly to the onchip flash or the built in SD card slot (SD0)? Once you have transferred to SD1 then by use of command M997, it is looking for the Firmware on your SD1 rather than SD0 where the bootloader looks for it, correct?

On Fri, Oct 18, 2019 at 8:42 AM reloxx13 notifications@github.com wrote:

@rflulling https://github.com/rflulling its working fine to mount the usb with usb_composite on.

i have it mounted on my pi with octoprint and update it with the octoprint firmware flasher plugin. it copies the firmware to the mounted sd card and triggers a M997 update firmware command. it will reboot and flash.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/MarlinFirmware/Marlin/issues/14684?email_source=notifications&email_token=AI2WIQXDUPOU324725MX7MTQPG4L3A5CNFSM4IFLWW6KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBUQH2Q#issuecomment-543753194, or unsubscribe https://github.com/notifications/unsubscribe-auth/AI2WIQTDCDRUYYLHC2SV34DQPG4L3ANCNFSM4IFLWW6A .

AnHardt commented 4 years ago

No. Drawing conclusions from already deleted messages, (likely because of dealing with an other board) does not make any sense.

The BTT SKR PRO bootloder can only deal with the onboard SD. It can update the firmware for the board and the WiFi board from the onboard SD. Nothing else.

Marlin (currently) can not deal with the onboard SD. (Currently) there is no way to access the onboard SD from Marlin. There is no way to place the firmware.bin on the onboard SD other than copy the files via a PC cardreader. Neither the BTT SKR PRO bootloader nor Marlin (currently) can flash from the extarnal SD. Since some days Marlin (on the BTT SKR PRO) can reset it selfes by M997. That's a first step to conveniently flash Marlin without pressing the reset button or drawing/resetting the power plug.

To conveniently transfer any file to a accessible SDcard a USB disk device must be added to the existing USB serial device in Marlin. For the used STM core not even a example composite device exist - so it will take a while to realize this.

The fix, builtin all STM32 processors bootloader, can not flash from any SD, but from USB and one serial, but needs to previously set BOOT0 and BOOT1 pins to a patter to do anything but calling the user program (here the BTT bootloader). Only flashing via a ST-Link adapter is accepted without a special pattern on these pins.


Once the boot process has left both of the bootloaders the processor has the total freedom to set about any bit any where. Writing to read only memory (ROM) is still impossible (ST bootloader). Writing to flash is always a bit more complicated but possible as long the target addresses are not write protected via a register in the processor. Non of the involved bootloaders alters one of this protection bits (even if protecting the BTT bootloader would make sense when playing with a ST-Link or the ST bootloader.).


Back to the title of this issue.

[BUG] SD-EEPROM not with Bigtreetech SKR Pro(STM32F4) on-board SD card?

Yes there is a problem. But its likely to be not the fault of EEPROM code but Marlins current inability to access the onboard SD-card at all.

This issues title should be: "[BUG] Marlin on BigTreeTech SKR PRO can't be configured to use the onboard SD-card"

When that problem is solved, likely the onboard SD-EEPROM problem is also solved.

boelle commented 4 years ago

@AnHardt thanks for the suggestion of a better title. Do you know what is wrong so it can be fixed?

rflulling commented 4 years ago

@AnHardt I think if this were entirely a Marlin code fault, then a person would be able to use standard ST STM32 utilities to access the chip. But we cannot. "It is locked." The bootloader placed by BTT in factory ONLY talks to the onboard SD card (SD0). I have been asking that the bootloader be modified in some way to allow the SD card to be seen externally, even of as a stand in for the onchip flash. Something, anything, so that the card does not have to be removed each and every time.

Some have reported using DFU and getting an upload, and I have seen a developer with SMSIS-DAP. -I have not gotten DFU to work yet. I have not tested SMSIS. However I did notice that a file in a recent nightly built now included a dependency for a SMSIS as part of the serial communications. So I will be tinkering soon.

"frameworks": [ "arduino", "cmsis", "stm32cube"], "protocols": [ "stlink", "dfu", "jlink"],

I have also read that users have been able to enable the SD card (SD1) on LCD or some other, as I have, the send the firmware file over as any uploaded G-Code. Then use the command to instruct a firmware update from SDCard.

If I can find a way to do this. All of you Devs reading can be 100% certain I will report it. I do not like to pull the SD card every time. I know I am not alone. Although I feel often that as I am posting, most are resigned to giving up, and so I simply cannot drum up the support that I feel should be out there. The kind of noise that would get BTT to take notice and either give an explanation for the lock, or make a fix.

Patag commented 4 years ago

Same here 👍 @rflulling

rflulling commented 4 years ago

Another user/dev pointed me at this today. https://github.com/stm32duino/Arduino_Core_STM32/pull/586?fbclid=IwAR1GvDz5HiDAWuQtkBA7rNXwxFFljfxs5uniqTEglpkzOGKOIOf2dSfIKCY

carl1961 commented 4 years ago

your link is not working as is, so here it is. and Thanks for your work at pushing this. https://github.com/stm32duino/Arduino_Core_STM32/pull/586?fbclid=IwAR1GvDz5HiDAWuQtkBA7rNXwxFFljfxs5uniqTEglpkzOGKOIOf2dSfIKCY

On Sun, Oct 27, 2019 at 4:40 PM rflulling notifications@github.com wrote:

Another user/dev pointed me at this today.

https://github.com/stm32duino/Arduino_Core_STM32/pull/586?fbclid=IwAR1GvDz5HiDAWuQtkBA7rNXwxFFljfxs5uniqTEglpkzOGKOIOf2dSfIKCY http://url

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/MarlinFirmware/Marlin/issues/14684?email_source=notifications&email_token=AAXKJNNEWSOHBPVSSH3IFD3QQYDDZA5CNFSM4IFLWW6KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECLIZTQ#issuecomment-546737358, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAXKJNN2F2F57IKQTL4B27LQQYDDZANCNFSM4IFLWW6A .

xC0000005 commented 4 years ago

Does someone have the SKR bootloader? I'll look and see how it accesses the SD card and what state it leaves it in.

Evg33 commented 4 years ago

Does someone have the SKR bootloader

fw_stlink.zip My dump via st-link SKR Pro 1.1 Marln from 08000h

rflulling commented 4 years ago

observation seems to indicate that the boot loader only looks at the onboard SD card at reset. It looks for specific files. If they are not found it disconnects the card and continues with startup. If the files are found they are installed. The previous copy is replaced, and the new one is renamed from firmware.bin to FIRMWARE.CUR. After this is done the card is disconnected.

dineshvyas commented 4 years ago

BTT SKR_PRO is hardwired to drive developers/users crazy. My on board card reader is broken due to repeated injecting and inserting. @bigtreetech if you are reading this. Do something about it.

Evg33 commented 4 years ago

@dineshvyas Thanks for the information ! I urgently need to add this: image

LinoBarreca commented 4 years ago

@Evg33 it should come bundled with the board. LOL

Evg33 commented 4 years ago

@xC0000005 https://github.com/bigtreetech/BIGTREETECH-SKR-PRO-V1.1/issues/25

Evg33 commented 4 years ago

The bootloader also updates the ESP-01S with the esp3d.bin file. This can be ignored.

xC0000005 commented 4 years ago

I think the onboard SD card is attached to SPI and that PA4 is the CS pin for it, but I don’t have one of these, so I can’t modify the pins to set SS to PA4 and enable SD support (not SDIO).

On Oct 28, 2019, at 8:31 PM, DPrime notifications@github.com wrote:

BTT SKR_PRO is hardware to drive developers/users crazy. My on board card reader is broken due to repeated injecting and inserting. @bigtreetech https://github.com/bigtreetech if you are reading this. Do something about it.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/MarlinFirmware/Marlin/issues/14684?email_source=notifications&email_token=AHVGS4MDTIYE67X4UR25E7LQQ6VC5A5CNFSM4IFLWW6KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECPDWZY#issuecomment-547240807, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHVGS4NNWJCD3JOFSKRJFQLQQ6VC5ANCNFSM4IFLWW6A.

Evg33 commented 4 years ago

@xC0000005

https://github.com/bigtreetech/BIGTREETECH-SKR-PRO-V1.1/blob/master/Schematic/SKR-PRO-V1.1%EF%BC%88SCH%EF%BC%89.pdf

image

image

image

xC0000005 commented 4 years ago

Has anyone actually tried setting the SS/SPI pins right and just using the onboard SD? We’d still need composite for access to multiple cards (or something similar to the SERIAL macros with instances of the card reader) but this kind of SD access is one of the oldest working ones on STM32.

On Oct 29, 2019, at 10:52 AM, Evgeny Zyatkov notifications@github.com wrote:

https://user-images.githubusercontent.com/7160738/67794328-87f7af80-fa8d-11e9-9f6d-4aed67ce2350.png https://user-images.githubusercontent.com/7160738/67794465-be352f00-fa8d-11e9-977f-9cc0f32f2c31.png https://user-images.githubusercontent.com/7160738/67794532-dad16700-fa8d-11e9-91d5-f97029951c09.png — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/MarlinFirmware/Marlin/issues/14684?email_source=notifications&email_token=AHVGS4IN2JOIUI2KLEKXNLDQRBZ6PA5CNFSM4IFLWW6KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECRPFOA#issuecomment-547549880, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHVGS4I2DBHUKAHOZB5HCS3QRBZ6PANCNFSM4IFLWW6A.

boelle commented 4 years ago

@eightheads many updates have passed since your last reply, please retest with latest 2.0.x

eightheads commented 4 years ago

@eightheads many updates have passed since your last reply, please retest with latest 2.0.x

@boelle I am not currently running the SKR Pro on a printer so cannot test at the moment. However, as you can see multiple others have been having this issue still.