@@ -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
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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
|
||||
@@ -1,43 +1,37 @@
|
||||
#ifndef LOG_H
|
||||
#define LOG_H
|
||||
#include "SEGGER_RTT.h"
|
||||
#include "../../module/mks_wifi/debug_to_uart.h"
|
||||
|
||||
//#define DEBUG_MSG
|
||||
//#define INFO_MSG
|
||||
//#define WARNING_MSG
|
||||
//#define ERROR_MSG
|
||||
|
||||
//#define COLOR_LOG_RTT
|
||||
|
||||
//#define DEBUG_TO_UART
|
||||
#define DEBUG_TO_SEGGER_RTT
|
||||
//#define DEBUG_TO_SEGGER_RTT
|
||||
|
||||
#ifdef COLOR_LOG_RTT
|
||||
#ifdef DEBUG_TO_UART
|
||||
#include <stdarg.h>
|
||||
#include "../../module/mks_wifi/debug_to_uart.h"
|
||||
#define DEBUG_MSG
|
||||
#define INFO_MSG
|
||||
#define WARNING_MSG
|
||||
#define ERROR_MSG
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_MSG
|
||||
#define DEBUG(fmt, args...) SEGGER_RTT_printf(0,"%sDEBUG %-20s:%-4d [%d]:" fmt "%s\r\n",RTT_CTRL_TEXT_BLUE, __func__, __LINE__,dwt_get_tick_in_sec(), ## args, RTT_CTRL_RESET)
|
||||
#else
|
||||
#ifdef DEBUG_TO_SEGGER_RTT
|
||||
#include "SEGGER_RTT.h"
|
||||
#define DEBUG_MSG
|
||||
#define INFO_MSG
|
||||
#define WARNING_MSG
|
||||
#define ERROR_MSG
|
||||
#endif
|
||||
|
||||
#ifndef DEBUG_TO_SEGGER_RTT
|
||||
#ifndef DEBUG_TO_UART
|
||||
#include <stdarg.h>
|
||||
#define DEBUG(fmt, args...)
|
||||
#endif
|
||||
#ifdef INFO_MSG
|
||||
#define INFO(fmt, args...) SEGGER_RTT_printf(0,"%s[I] %-20s:%-4d [%d]:" fmt "%s\r\n",RTT_CTRL_TEXT_WHITE, __func__, __LINE__,dwt_get_tick_in_sec(), ## args,RTT_CTRL_RESET)
|
||||
#else
|
||||
#define INFO(fmt, args...)
|
||||
#endif
|
||||
#ifdef WARNING_MSG
|
||||
#define WARNING(fmt, args...) SEGGER_RTT_printf(0,"%s[W] %-20s:%-4d [%d]:" fmt "%s\r\n",RTT_CTRL_TEXT_BRIGHT_YELLOW, __func__, __LINE__,dwt_get_tick_in_sec(), ## args,RTT_CTRL_RESET)
|
||||
#else
|
||||
#define WARNING(fmt, args...)
|
||||
#endif
|
||||
#ifdef ERROR_MSG
|
||||
#define ERROR(fmt, args...) SEGGER_RTT_printf(0,"%s[E] %-20s:%-4d [%d]:" fmt "%s\r\n",RTT_CTRL_TEXT_RED, __func__, __LINE__,dwt_get_tick_in_sec(),## args,RTT_CTRL_RESET)
|
||||
#else
|
||||
#define ERROR(fmt, args...)
|
||||
#endif
|
||||
#else
|
||||
#ifdef DEBUG_TO_UART
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_TO_UART
|
||||
#ifdef DEBUG_MSG
|
||||
#define DEBUG(fmt, args...) debug_to_uart((char*)"[D] %-20s:%-4d :" fmt "\n", __func__, __LINE__, ## args)
|
||||
#else
|
||||
@@ -59,9 +53,9 @@
|
||||
#define ERROR(fmt, args...)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_TO_SEGGER_RTT
|
||||
#ifdef DEBUG_TO_SEGGER_RTT
|
||||
|
||||
#ifdef DEBUG_MSG
|
||||
#define DEBUG(fmt, args...) SEGGER_RTT_printf(0,"[D] %-20s:%-4d :" fmt "\r\n", __func__, __LINE__, ## args)
|
||||
@@ -88,4 +82,3 @@
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -25,7 +25,5 @@ void debug_to_uart(char *fmt,...){
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#ifndef DEBUG_UART_H
|
||||
#define DEBUG_UART_H
|
||||
|
||||
#ifdef DEBUG_TO_UART
|
||||
|
||||
#include "../../MarlinCore.h"
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
#ifdef DEBUG_TO_UART
|
||||
|
||||
void debug_to_uart(char *fmt,...);
|
||||
|
||||
#endif
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user