inib / Marlin

This marlin fork is used to keep track of the configs of my printers - use at own risk and check the wiki - if you have questions feel free to use the Issues tab
https://github.com/inib/Marlin/wiki
GNU General Public License v3.0
44 stars 18 forks source link

Eeprom in external SPI flash #7

Closed sobieh closed 4 years ago

sobieh commented 4 years ago

This allows to use MKS Robin Nano external flash over SPI2 to read/write data like EEPROM. There is 8MB of storage there and the area 0x700000 - 0x800000 is not used by the original stock firmware.

I could use the dedicated EEPROM chip but I2C on STM32F1 is a real PITA and requires lots of fixes to work (bugs at chip level) so there was no point in playing with it. Flash memory is far better :D

This PR should work on any Robin Nano board like Sapphire Pro out of the box just after flashing firmware.

inib commented 4 years ago

Thank you very much, I'll give it a try as soon as I can. Had already tried some stuff, but failed to get it to work parallel to the touch interface.

sobieh commented 4 years ago

It's because the XPT library was trying to configure SPI2 pins exclusively for Touch use via SoftSPI ... (that code sucks). I changed it to begin() / end() which configures and deconfigures the pins and allowing the real hardware SPI2 to work (actually the opposite :D).

berghauz commented 4 years ago

There is no actual bug with i2c and stm32, there is a bug in mks bootloader (PB7 pin share FSMC_NADV and I2C1_SDA simultaneously). It initialize fsmc bus and leave it active before run firmware and more over - you need to disable fsmc every time you access i2c bus xD MKS Robin series is a real junk. This little piece of code in HAL init (and eeprom access) fixes this rcc_clk_disable(RCC_FSMC); but there is another approach - marlin haven't support AT24C16N eeprom, so you need to handle this too. I have made this changes for my robin mini board, check AT24C16.zip.

GeraltR commented 4 years ago

Thank you for your help. I copy one file in the HAL_STM32F1 folder and then in the shared folder. In persistent_store_eeprom.cpp I need to change the motherboard and name tft as I have it in config.h. I2cEeprom.cpp I need to change the name to eeprom_i2c.cpp because this is the main one. But it doesn't work :(

W dniu 2020-01-12 20:07, Alexey Polyakov napisał(a):

There is no actual bug with i2c and stm32, there is a bug in mks bootloader. It initialize fsmc bus and leave it in that state before run firmware and more over - you need to disable fsmc every time you access i2c bus xD MSK Robin series is a real junk. This little piece of code in HAL init (and eeprom access) fixes this rcc_clk_disable(RCC_FSMC); but there is another approach - marlin haven't support AT24C16N eeprom, so you need to handle too. I made this changes for my robin mini board, check AT24C16.zip [1].

-- You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub [2], or unsubscribe [3].

Links:

[1] https://github.com/inib/Marlin/files/4051114/AT24C16.zip [2] https://github.com/inib/Marlin/pull/7?email_source=notifications&email_token=AKT3MSBFCTKB7XSSPOS6UHLQ5NTAXA5CNFSM4JLUS37KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIXBUWY#issuecomment-573446747 [3] https://github.com/notifications/unsubscribe-auth/AKT3MSFMUVRPB3RYJDQCD4TQ5NTAXANCNFSM4JLUS37A

berghauz commented 4 years ago

This will not work with just copying files and there is more - this files from bugfix marlin half an year old :D If this feature so crucial, i can find some spare time and make a PR into this repo (i really dunno how much reasonable it is as this repo outdated from marlin head too)

GeraltR commented 4 years ago

I think maybe I will write a notification in git.

Edit: Sorry, that's my mistake. It works, I look at the result of two problems and I got the wrong solution.

W dniu 2020-01-12 23:04, Alexey Polyakov napisał(a):

This will not work with just copying files and there is more - this files from bugfix marlin half an year old :D If this feature so crucial, i can find some spare time and make a PR into this repo (i really dunno how much reasonable it is as this repo outdated from marlin head too)

-- You are receiving this because you commented. Reply to this email directly, view it on GitHub [1], or unsubscribe [2].

Links:

[1] https://github.com/inib/Marlin/pull/7?email_source=notifications&email_token=AKT3MSAQLGUTDSEJ7ETNCGLQ5OHW3A5CNFSM4JLUS37KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIXFO3Y#issuecomment-573462383 [2] https://github.com/notifications/unsubscribe-auth/AKT3MSDD427FFINYEYS7F7DQ5OHW3ANCNFSM4JLUS37A