PDA

View Full Version : Winbond W25X80 SPI flash object posted with easy to understand commented SPI co



Bill Henning
03-25-2009, 03:25 AM
Hi guys,

I've cleaned up my Spin driver for the flash chip I've been using for extended data storage and posted a brief article on my blog on how to use it - and you can download it there too.

I am working on a PASM version, however this version is already quite useful not only for storage, but as an easy to understand example of SPI code.

mikronauts.com/2009/03/24/winbond-w25x80-flash-chip-spin-object/ (http://mikronauts.com/2009/03/24/winbond-w25x80-flash-chip-spin-object/)

I know the code is not very optimized, it was written for small code size and clarity.

Enjoy!

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.mikronauts.com (http://www.mikronauts.com) - a new blog about microcontrollers

Cluso99
03-25-2009, 10:06 AM
Excellent Bill - Just what I need for my TriBladeProp pcb. I haven't looked at your code yet. I presume you didn't use the double bit read feature?
There are also pin compatible (but more $) versions W25X32 (4MByte) and W25X64 (8MByte) versions available also.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Links to other interesting threads:

· Home of the MultiBladeProps: TriBladeProp (http://forums.parallax.com/showthread.php?p=786418), SixBladeProp (http://forums.parallax.com/showthread.php?p=780033), website (Multiple propeller pcbs) (http://bluemagic.biz/cluso.htm)
· Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator) (http://forums.parallax.com/showthread.php?p=790917)
· Prop Tools under Development or Completed (Index) (http://forums.parallax.com/showthread.php?p=753439)
· Emulators: Micros eg Altair, and Terminals eg VT100 (Index (http://forums.parallax.com/showthread.php?p=778427))
· Search the Propeller forums (via Google) (http://search.parallax.com/search?site=parallax&client=parallax&output=xml_no_dtd&proxystylesheet=parallax&proxycustom=<HOME/>&ie=&oe=&lr=)
My cruising website is: ·www.bluemagic.biz (http://www.bluemagic.biz)·· MultiBladeProp is: www.bluemagic.biz/cluso.htm (http://www.bluemagic.biz/cluso.htm)

Bill Henning
03-25-2009, 09:58 PM
I'm glad it will help http://forums.parallax.com/images/smilies/smile.gif

No double bit read yet, I was going to explore that later - initially I just wanted some easy to read (and therefore easy to understand and debug) spin code that did not require dedicating a cog. I am working on a pasm version, and once the single bit read version is finished, I will add double bit read.

The 2Mx8 is also available in DIP, but I have not found anyone who has the 4Mx8 and 8Mx8 in DIP :-(

I have some SOIC-16 8Mx8's on the way that appear to be fully compatible http://forums.parallax.com/images/smilies/smile.gif


Cluso99 said...
Excellent Bill - Just what I need for my TriBladeProp pcb. I haven't looked at your code yet. I presume you didn't use the double bit read feature?
There are also pin compatible (but more $) versions W25X32 (4MByte) and W25X64 (8MByte) versions available also.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.mikronauts.com (http://www.mikronauts.com) - a new blog about microcontrollers

virtuPIC
03-26-2009, 03:08 AM
Yeah, this is the kind of software we need - the kind which everyone needs! Thank you!

Oh, and I received a W25X16 today. 2M x 8 bit. Will look at the data sheets and test it with your driver. And yes, it's in DIP package. (Digi-Key)

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Airspace V - international hangar flying!
www.airspace-v.com/ggadgets (http://www.airspace-v.com/ggadgets) for tools & toys

Post Edited (virtuPIC) : 3/25/2009 8:18:38 PM GMT

Bill Henning
03-26-2009, 03:19 AM
You are most welcome, and it should just work - the only difference is the capacity of the devices, they use exactly the same protocol.

Unfortunately the 2Mx8 is the largest capacity DIP that is readily available, but I have some larger SOIC-16's on the way (8Mx8) which should also work.


virtuPIC said...
Yeah, this is the kind of software we need - the kind which everyone needs! Thank you!

Oh, and I received a W25X16 today. 2M x 8 bit. Will look at the data sheets and test it with your driver. And yes, it's in DIP package. (Digi-Key)

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.mikronauts.com (http://www.mikronauts.com) - a new blog about microcontrollers

virtuPIC
03-26-2009, 04:11 AM
I am still wondering if such an SPI ROM can be used for standard bootloading. Commands are rather different, but maybe the prop is clever enough. Any experience out there?

Yes, I know That SPI normally needs one more line than I2C, but I remember that you can merge data lines.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Airspace V - international hangar flying!
www.airspace-v.com/ggadgets (http://www.airspace-v.com/ggadgets) for tools & toys

Bill Henning
03-26-2009, 04:38 AM
Unfortunately not, as the protocols are too different. A fast enough microcontroller could be used to "translate" by placing it between the SPI flash and the propeller, so that it presents an I2C eeprom interface to the propeller, while reading the data from the flash.

Personally I will keep an eeprom for loading an initial boot image that can select roms to load from the flash.


virtuPIC said...
I am still wondering if such an SPI ROM can be used for standard bootloading. Commands are rather different, but maybe the prop is clever enough. Any experience out there?

Yes, I know That SPI normally needs one more line than I2C, but I remember that you can merge data lines.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.mikronauts.com (http://www.mikronauts.com) - a new blog about microcontrollers

virtuPIC
03-26-2009, 05:04 AM
Yes Bill, I also had this idea. The fast coprocessor could even have a small cache and parallel to SPI interface for faster access... But it's more complicated and more expensive than a separate boot-Flash. It's easy to write protect this boot Flash and I am still thinking of a time switch that switches access from small boot ROM to large application Flash a short time after booting to safe pins. No, not suited for development where you want to write the boot image...

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Airspace V - international hangar flying!
www.airspace-v.com/ggadgets (http://www.airspace-v.com/ggadgets) for tools & toys

Cluso99
03-26-2009, 10:39 AM
Bill, Great work. I created my test program to test the SRAM initially in spin, then rewrote in pasm. While I am much more comfortable with pasm, spin makes it easy to get running first and provides an insight for others to understand what is going on at a simpler level.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Links to other interesting threads:

· Home of the MultiBladeProps: TriBladeProp (http://forums.parallax.com/showthread.php?p=786418), SixBladeProp (http://forums.parallax.com/showthread.php?p=780033), website (Multiple propeller pcbs) (http://bluemagic.biz/cluso.htm)
· Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator) (http://forums.parallax.com/showthread.php?p=790917)
· Prop Tools under Development or Completed (Index) (http://forums.parallax.com/showthread.php?p=753439)
· Emulators: Micros eg Altair, and Terminals eg VT100 (Index (http://forums.parallax.com/showthread.php?p=778427))
· Search the Propeller forums (via Google) (http://search.parallax.com/search?site=parallax&client=parallax&output=xml_no_dtd&proxystylesheet=parallax&proxycustom=<HOME/>&ie=&oe=&lr=)
My cruising website is: ·www.bluemagic.biz (http://www.bluemagic.biz)·· MultiBladeProp is: www.bluemagic.biz/cluso.htm (http://www.bluemagic.biz/cluso.htm)

Bill Henning
03-26-2009, 11:24 PM
Thank you. That was the idea - to have an easy to understand version that only takes 136 longs (or 123 without jdec_id and get_size) and does not require a dedicated cog!


Cluso99 said...
Bill, Great work. I created my test program to test the SRAM initially in spin, then rewrote in pasm. While I am much more comfortable with pasm, spin makes it easy to get running first and provides an insight for others to understand what is going on at a simpler level.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.mikronauts.com (http://www.mikronauts.com) - a new blog about microcontrollers