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.36k stars 19.26k forks source link

[FR] Marlin firmware option or downloadable utility to completely erase the EEPROM #25883

Closed trengtor closed 1 year ago

trengtor commented 1 year ago

Is your feature request related to a problem? Please describe.

Sometimes situations arise when it is necessary to completely reset (erase) an external EEPROM CHIP. I guess this is not too big a request to the developers: to provide such an opportunity, preferably without being tied to any version or branch of Marlin. You can, of course, say that this can be done by soldering and erasing the EEPROM using a programmer, but such an action is always associated with a risk for the control board.

Are you looking for hardware support?

No response

Describe the feature you want

Marlin firmware option or downloadable utility to completely erase the EEPROM

Additional context

No response

EvilGremlin commented 1 year ago

What is exact usecase? I can't imagine anything that require complete erase.

trengtor commented 1 year ago

What is exact usecase? I can't imagine anything that require complete erase.

For example: after rolling back from 2.1.2 to 2.0.8.2, it turned out that it was impossible to correctly initialize EEPROM.

ellensp commented 1 year ago

M502 then M500 always resets eeprom back to defaults for the firmware As does EEPROM_INIT_NOW If the firmware has it

EvilGremlin commented 1 year ago

I think some odd omission bug in some old version is not a valid reason to add new feature.

trengtor commented 1 year ago

M502 then M500 always resets eeprom back to defaults for the firmware As does EEPROM_INIT_NOW If the firmware has it

Not for this case

EvilGremlin commented 1 year ago

And i doubt it'll help anyway. If 2.0.8.2 have no code to write some value tio EEPROM - full erase can't possibly fix that.

trengtor commented 1 year ago

And i doubt it'll help anyway. If 2.0.8.2 have no code to write some value tio EEPROM - full erase can't possibly fix that.

Думаю, что проблема здесь в том, как было изменено хранение (разметка и форматы) в ветке 2.1. И в том, что никто и никогда не думает об обратной совместимости. На твой вопрос, кстати, есть банальный ответ другим вопросом: а как, по-твоему, 2.0.8.2 накатывается на свежекупленные платы с девственно чистым EEPROM?

ellensp commented 1 year ago

This is already in marlin MARLIN_DEV_MODE enables d-codes D1 is Zero or pattern-fill the EEPROM data

    case 1: {
      // Zero or pattern-fill the EEPROM data
      #if ENABLED(EEPROM_SETTINGS)
        persistentStore.access_start();
        size_t total = persistentStore.capacity();
        int pos = 0;
        const uint8_t value = 0x0;
        while (total--) persistentStore.write_data(pos, &value, 1);
        persistentStore.access_finish();
      #else
        settings.reset();
        settings.save();
      #endif
      hal.reboot();
EvilGremlin commented 1 year ago

It's really bad manners to switch language... Formatting should be irrelevant. EEPROM write is complete write of all values from RAM, it's not "read, edit if found and write back" And there was an issue where sometimes you had to reset 2-3 times to actually write everything.

ellensp commented 1 year ago

And there is void GcodeSuite::M504() in MARLIN_DEV_MODE That lets you save any byte to any address in eeprom. So a simple gcode script can be used to erase eeprom this way too

trengtor commented 1 year ago

And there is void GcodeSuite::M504() in MARLIN_DEV_MODE That lets you save any byte to any address in eeprom. So a simple gcode script can be used to erase eeprom this way too

Thanks alot!

thisiskeithb commented 1 year ago

This is already in marlin MARLIN_DEV_MODE enables d-codes D1 is Zero or pattern-fill the EEPROM data

Closing since this already exists.

trengtor commented 1 year ago

Well, I made dev-version of 2.0.8.2 & tryed to use D1. But it useless: I see figures in printer statistics before D1 & I see the same figures after D1 (board making selfrebooot after that command).

trengtor commented 1 year ago

This is already in marlin MARLIN_DEV_MODE enables d-codes D1 is Zero or pattern-fill the EEPROM data

Closing since this already exists.

You closed this issue too soon. I need some more help.

EvilGremlin commented 1 year ago

Then it looks like general issue with i2c eeprom handling in 2.0.8.2, there were some eeprom-related changes/improvements around that time. Only thing you can do is to try cherypicking some later related commits i guess. Anyway, talking about what happened in old version is useless, this issue was fixed long time ago.

trengtor commented 1 year ago

I would like to see examples of using D-codes D3. These are not the most common methods.

thisiskeithb commented 1 year ago

I would like to see examples of using D-codes D3. These are not the most common methods.

This Issue Queue is for Marlin bug reports and development-related issues, and we prefer not to handle user-support questions here. (As noted on this page.) For best results getting help with configuration and troubleshooting, please use the following resources:

trengtor commented 1 year ago

This is already in marlin MARLIN_DEV_MODE enables d-codes D1 is Zero or pattern-fill the EEPROM data

    case 1: {
      // Zero or pattern-fill the EEPROM data
      #if ENABLED(EEPROM_SETTINGS)
        persistentStore.access_start();
        size_t total = persistentStore.capacity();
        int pos = 0;
        const uint8_t value = 0x0;
        while (total--) persistentStore.write_data(pos, &value, 1);
        persistentStore.access_finish();
      #else
        settings.reset();
        settings.save();
      #endif
      hal.reboot();

I tried to do it, but it doesnt working. 'It's so esy', yes. Bot no.

2023-05-27_16-36-23

2023-05-27_16-53-35

2023-05-27_16-50-48

2023-05-27_16-52-50

EvilGremlin commented 1 year ago

Check if your chip is actually good, with a programmer. At least 10 cycles of write&verify on random data (new and unique each time), full chip size.

trengtor commented 1 year ago

Check if your chip is actually good, with a programmer. At least 10 cycles of write&verify on random data (new and unique each time), full chip size.

Come on, you'd better describe to me in detail the D-commands D1 and D3 with their syntax. But only with the syntax that will actually work. Or do you not see what Marlin said to the D1 command?

EvilGremlin commented 1 year ago

"unknown syntax" message is from pronterface. Disable filtering (if it can do that) or use different terminal. https://reprap.org/wiki/G-code#D:_Debug_codes is correct

trengtor commented 1 year ago

"unknown syntax" message is from pronterface. Disable filtering (if it can do that) or use different terminal.

Ok, thanks. But it doesn't work in another terminal too. Code D1 seems to be running, the board is rebooting. But it doesn't erase anything. But at the same time, saving the parameters works, statistics are also accumulated. What could be the problem? Maybe something in the method/object itself?

I repeat: it started after the rollback of the firmware from the 2.1 branch to the 2.0 branch.

EvilGremlin commented 1 year ago

Could be. Could be partially dead chip that could behave in any bizarre manner.

Well, I made dev-version of 2.0.8.2 & tryed to use D1.

Again, 2.0.8.2 wont receive any fixes, it's completely useless to talk about it's bugs. 2.0.9.6 might, so use at least that (for D-commands). Or 2.1.x.

trengtor commented 1 year ago

Could be. Could be partially dead chip that could behave in any bizarre manner.

Well, I made dev-version of 2.0.8.2 & tryed to use D1.

Again, 2.0.8.2 wont receive any fixes, it's completely useless to talk about it's bugs. 2.0.9.6 might, so use at least that (for D-commands). Or 2.1.x.

With 2.0.9.6 all the same

trengtor commented 1 year ago

Boards, supported in gcode_d.cpp (Marlin\src\gcode): 5 from 332 (1.5%). I know that EEPROM is not available on all 332 boards, but in this context it does not matter. Support for only 1.5% of the boards, that is, it is statistically negligible. In fact, we can say that this function (D1 and D3) is not in Marlin. And you still have this situation, including in bugfix 2.1. It is enough to look at the source code of this module to understand this.

r06kpCOO9TL6h2tgRTZQwcPbqFDA4CQiyY7dKnEUzXPDBna7B7

github-actions[bot] commented 1 year 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.