Skip to main content
Topic: SPIFlash instead of EEPROM -> 4MB storage without µSD (Read 4702 times) previous topic - next topic

SPIFlash instead of EEPROM -> 4MB storage without µSD

Hi,

Just wanted to share my experience with replacing the EEPROM with an SPIFlash from SST (now Microchip).

I used the SST25VF032B (which you can sample ;)) and these are my changes to the sourcecode:

In main.c replace "XEEInit();" with "SPIFlashInit();"

In CustomHTTPApp.c search for "NVM_VALIDATION_STRUCT" and comment out the whole line.

In HardwareProfile.h at EEPROM setup, comment out the EEPROM defines and put this in:
Code: [Select]
#define SPIFLASH_CS_TRIS		(TRISCbits.TRISC7)
#define SPIFLASH_CS_IO (PORTCbits.RC7)
#define SPIFLASH_SCK_TRIS (TRISCbits.TRISC6)
#define SPIFLASH_SDI_TRIS (TRISBbits.TRISB9)
#define SPIFLASH_SDI_IO (PORTBbits.RB9)
#define SPIFLASH_SDO_TRIS (TRISCbits.TRISC8)
#define SPIFLASH_SPI_IF (IFS2bits.SPI2IF)
#define SPIFLASH_SSPBUF (SPI2BUF)
#define SPIFLASH_SPICON1 (SPI2CON1)
#define SPIFLASH_SPICON1bits (SPI2CON1bits)
#define SPIFLASH_SPICON2 (SPI2CON2)
#define SPIFLASH_SPISTAT (SPI2STAT)
#define SPIFLASH_SPISTATbits (SPI2STATbits)

Thats it.

I prefer using the Flash so I don't need to have a couple of µSD (and I always end up killing them somehow) and now I have enough storage. ;) Don't really need 2GB or so. Hopefully this helps somebody.
Web platform todo: bluetooth firmware update, some kind of database, GLCD.
Working: RS485 connection, NTP RTC time sync, I2C for portexpanders, Software PWM with timer interrupt, SPI flash(32mbit)

Re: SPIFlash instead of EEPROM -> 4MB storage without µSD

Reply #1
Nice. I remember when Microchip added this feature to the stack.
Got a question? Please ask in the forum for the fastest answers.

Re: SPIFlash instead of EEPROM -> 4MB storage without µSD

Reply #2
hi megabug,

which dev board are you using? web platform? is the code is also possible to implement to other dev board wish to use the sst25vf032b?

thanks,
hector

Re: SPIFlash instead of EEPROM -> 4MB storage without µSD

Reply #3
I am using my own board, but changed the code to fit the webplatform!

My board is based on an old board from Iam, which was posted on hackaday.com but now with SMD Ethernet jack, dsPIC33FJ and other changes. ;)

Hope it's okay that I used it, Ian. ;)

If someone is interested, board and schematic:

Eagle files: Download

There is a Wifi version coming soon. But it needs to be tested and then I can post it. ;)

There are also some information on my website: http://megabug.de

best regards
Web platform todo: bluetooth firmware update, some kind of database, GLCD.
Working: RS485 connection, NTP RTC time sync, I2C for portexpanders, Software PWM with timer interrupt, SPI flash(32mbit)

Re: SPIFlash instead of EEPROM -> 4MB storage without µSD

Reply #4
Quote
Hope it's okay that I used it, Ian. ;)

That's why I do it :)
Got a question? Please ask in the forum for the fastest answers.