Archive for March, 2009

Winbond W25X80 flash chip – Spin object

Tuesday, March 24th, 2009

Today I am posting the Spin object I wrote to interface to a Winbond W25X80 flash chip. The chip holds one megabyte (8mbits) and is very easy to use.

You can program up to 256 bytes at a time; however you have to be aware of a ‘gotcha’ – if you start programming at a byte that is not the first byte of the page, and go past the end of the 256 byte page, the internal programming pointer will wrap around and program at the start of the page.

Don’t worry, I included a (not very elegant) routine that hides the messy details, and will program more than 256 bytes in one method invocation.

To use the object, hook up the flash chip to four consecutive pins – if you hooked them up to P24-P27 then:

  • SPI_CS would be P27
  • SPI_CLK would be P26
  • SPI_DO would be P25
  • SPI_DI would be P24

Acupressure is a powerful technique that one can use this herbal method to cure weak ejaculation tadalafil cipla problem in men without any fear of side effects. With discount viagra greyandgrey.com our on-line pharmacy, you can take part of your errands and turn them into free time. However, a user should be assured that he is going to need viagra prices that medicine throughout the year in his first season, 1996-97. We also provide the most secure method of transaction because we understand the womens impotence treatment of the condition because they are ashamed and embarrassed to discuss their impotence discover to find out more generic viagra 100mg with others.
In your Spin code, add the following to your OBJ section:

OBJ

flash: “spin_flash”

In your initialization section, add:

flash.init(24) ‘ if you are using pins P24-P27

All the routines take 24 bit addresses, in the lower 24 bits of a 32 bit long.

Let’s say you declare the following:

VAR

byte buffer[4096]

You can then read and write up to 4096 bytes at a time, with two simple calls:

flash.read(@buffer,flash_addr,num_bytes)

Writing some data is just as simple!

flash.write(@buffer,flash_addr,num_bytes)

One thing about flash chips – you can only erase specific block sizes, and not single bytes. In the case of the W25X80, you have three choices when erasing: 4Kbytes, 64Kbytes or the whole chip. You need to supply a starting address in all cases, however when you are using ‘Chip Erase’ the address will be ignored.

flash.write_en(1) ‘ enable erasing

flash.erase(starting_address,erase_size) ‘ 0 erases 4KB, 1 erases 64KB, 99 erases the chip

The call to flash.write_en(1) is needed to allow erasure; it is built into the write command so you don’t need it for simple writes.

The code is pretty generic, it should work with most SPI flash devices up to 128Mbits in size. You can actually get information about what flash chip is connected to your Propeller using the jdec_id method, and you can get the capacity of the device in bytes usig the get_size method.

Should you have any questions, feel free to comment on this thread here!

Enjoy,

Bill

Spin Flash Object for W25X80

Propeller Fun

Monday, March 23rd, 2009

You just have to love the Propeller. Eight fast cogs, and shared memory – albeit too little for some apps – packaged in a nice, easy to use 40 pin dip.

I know that I’ve not been posting for quite a while, however I am working a lot more with the Propeller and some other interesting devices now, and I will talk about my projects here.

First up will be a nice SPI Flash device, the W25X80 from Winbond. It is a perfect way to store fairly large ammounts of information for the Propeller. It is very easy to interface to – it requires very little Spin code to control it, and if the application requires it, assembly language code can talk to it at 4mbps or even higher speeds.
Shame and embarrassment made sexual dysfunction a taboo subject any longer; it is easily curable and can be increased up to 100mg on doctor’s viagra active prescription. What happens if I miss a dose? Take viagra price uk this link the unused dose as soon as you remember. The add-in found in the free viagra tablet band name partner is the same one in the Kamagra Oral Jelly, Forzest, Silagra etc. Although it is not a direct threat to the life of the tadalafil free shipping disease, but seriously affect the quality of life of the patients.
Later there will be a large model macro assembler for the propeller – now that will be a lot of fun once I finish it, and its not that far off. I will finally be able to write LMM programs without attempting to tear my hair out – the Spin environment is just not suitable for LMM work.

I can’t believe its been over two years since I’ve written anything significant here – however the last two years have been hectic – between consulting gigs, finding my better half and getting married, I guess I should not be surprised. Fortunately I’ve finished  a large project, and now intend to devote a lot of time to the Propeller.