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

A small embedded server. Get one for $40, including worldwide shipping.

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

Postby megabug » Sun May 22, 2011 11:56 am

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 all
#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)
megabug
Newbie
Newbie
 
Posts: 33
Joined: Tue Mar 22, 2011 4:31 pm
Location: Germany

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

Postby ian » Tue May 24, 2011 12:37 pm

Nice. I remember when Microchip added this feature to the stack.
User avatar
ian
Crew
Crew
 
Posts: 10803
Joined: Mon Jul 06, 2009 6:14 am

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

Postby rotceh » Fri May 27, 2011 7:22 am

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
rotceh
Newbie
Newbie
 
Posts: 2
Joined: Sun May 15, 2011 10:39 pm

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

Postby megabug » Fri May 27, 2011 2:04 pm

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:
Image Image
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)
megabug
Newbie
Newbie
 
Posts: 33
Joined: Tue Mar 22, 2011 4:31 pm
Location: Germany

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

Postby ian » Sat May 28, 2011 4:32 am

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


That's why I do it :)
User avatar
ian
Crew
Crew
 
Posts: 10803
Joined: Mon Jul 06, 2009 6:14 am


Return to Web platform