Browse Source

Fix store eeprom

pull/24/head
Sergey 4 years ago
parent
commit
0d8bbec997
  1. 44
      Marlin/src/HAL/STM32F1/eeprom_spi_w25q.cpp
  2. 7
      Marlin/src/HAL/STM32F1/eeprom_wired.cpp
  3. 4
      Marlin/src/HAL/shared/eeprom_if.h
  4. BIN
      firmware/all_drv_2208/Robin_nano35.bin
  5. BIN
      firmware/fb_4s/Robin_nano35.bin
  6. BIN
      firmware/fb_5/Robin_nano35.bin

44
Marlin/src/HAL/STM32F1/eeprom_spi_w25q.cpp

@ -12,10 +12,12 @@ U5 W25Q64BV, 16K SERIAL EEPROM:
//W25QXXFlash W25QXX;
uint8_t spi_eeprom[MARLIN_EEPROM_SIZE];
void eeprom_test(void);
void eeprom_init(void){
DEBUG("Start EEPROM");
W25QXX.init(SPI_QUARTER_SPEED);
//eeprom_test();
W25QXX.SPI_FLASH_BufferRead((uint8_t *)spi_eeprom,SPI_EEPROM_OFFSET,MARLIN_EEPROM_SIZE);
}
@ -56,4 +58,46 @@ void eeprom_update_block(const void *__src, void *__dst, size_t __n){
ERROR("Call to missing function");
};
void eeprom_test(void){
uint16_t chip_id=0;
chip_id=W25QXX.W25QXX_ReadID();
DEBUG("SPI Flash ID %0X",chip_id);
DEBUG("Read FLASH:");
for(uint32_t i=0; i < 50 ; ){
memset(spi_eeprom,0,10);
W25QXX.SPI_FLASH_BufferRead((uint8_t *)spi_eeprom,SPI_EEPROM_OFFSET+i,10);
DEBUG("%d %0X %0X %0X %0X %0X %0X %0X %0X %0X %0X",i,spi_eeprom[0],spi_eeprom[1],spi_eeprom[2],spi_eeprom[3],spi_eeprom[4],spi_eeprom[5],spi_eeprom[6],spi_eeprom[7],spi_eeprom[8],spi_eeprom[9]);
i=i+10;
}
DEBUG("Erase flash");
W25QXX.SPI_FLASH_WriteEnable();
W25QXX.SPI_FLASH_SectorErase(SPI_EEPROM_OFFSET);
DEBUG("Read FLASH:");
for(uint32_t i=0; i < 50 ; ){
memset(spi_eeprom,0,10);
W25QXX.SPI_FLASH_BufferRead((uint8_t *)spi_eeprom,SPI_EEPROM_OFFSET+i,10);
DEBUG("%d %0X %0X %0X %0X %0X %0X %0X %0X %0X %0X",i,spi_eeprom[0],spi_eeprom[1],spi_eeprom[2],spi_eeprom[3],spi_eeprom[4],spi_eeprom[5],spi_eeprom[6],spi_eeprom[7],spi_eeprom[8],spi_eeprom[9]);
i=i+10;
}
DEBUG("Read/write FLASH:");
for(uint32_t i=0; i < 50 ; ){
memset(spi_eeprom,0x0B,10);
W25QXX.SPI_FLASH_WriteEnable();
W25QXX.SPI_FLASH_BufferWrite((uint8_t *)spi_eeprom,SPI_EEPROM_OFFSET+i,10);
W25QXX.SPI_FLASH_BufferRead((uint8_t *)spi_eeprom,SPI_EEPROM_OFFSET+i,10);
DEBUG("%d %0X %0X %0X %0X %0X %0X %0X %0X %0X %0X",i,spi_eeprom[0],spi_eeprom[1],spi_eeprom[2],spi_eeprom[3],spi_eeprom[4],spi_eeprom[5],spi_eeprom[6],spi_eeprom[7],spi_eeprom[8],spi_eeprom[9]);
i=i+10;
}
}
#endif // SPI_EEPROM_W25Q

7
Marlin/src/HAL/STM32F1/eeprom_wired.cpp

@ -36,7 +36,12 @@
#endif
size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; }
bool PersistentStore::access_finish() { return true; }
bool PersistentStore::access_finish() {
#if ENABLED(EEPROM_W25Q)
eeprom_hw_deinit();
#endif
return true;
}
bool PersistentStore::access_start() {
eeprom_init();

4
Marlin/src/HAL/shared/eeprom_if.h

@ -27,3 +27,7 @@
void eeprom_init();
void eeprom_write_byte(uint8_t *pos, unsigned char value);
uint8_t eeprom_read_byte(uint8_t *pos);
#if ENABLED(EEPROM_W25Q)
void eeprom_hw_deinit(void);
#endif

BIN
firmware/all_drv_2208/Robin_nano35.bin

Binary file not shown.

BIN
firmware/fb_4s/Robin_nano35.bin

Binary file not shown.

BIN
firmware/fb_5/Robin_nano35.bin

Binary file not shown.
Loading…
Cancel
Save