|
|
@ -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
|
|
|
|