Ramtron FRAM with the SX
Keith M
Posts: 102
Hi,
I'm going to be using some Ramtron serial fram with my SX28.· I've never used any type of external memory, but I've read the datasheet carefully.· It looks pretty straight forward.· The datasheet was a pretty easy read, and for someone with limited exposure to this stuff, that's saying something.
Are there particular gotchas or things to look out for?· I'll be bit-banging the various leads(CS, SCK, SI/SO, and HOLD) and won't be using interrupts to talk to it.· My ISR is busy with some other tasks, and although I could combine them, it might get ugly.
I plan on writing to it at approximately 7.14 mhz, using an asymmetrical clock.· I think my HIGH time is 100ns, and my low time is 40ns.· Anyone see any trouble doing this?· These numbers, and the speed comes as a direct result of the number of instructions required to manipulate the leads.· The write routine, which is the only time-sensitive routine for me, is basically just shifting a byte out, bit by bit using RL, copying C to the port(it's MSB), incrementing a counter, checking to see if I've shifted 8 times, and then looping back.
I plan on setting the chip up first(CS), doing a WREN and a WRITE with the appropriate address, and then putting the chip on HOLD and then just clocking in new data so I keep my successive writes short and sweet.
Any advice, even generic advice regarding serial memory, would be appreciated.
Thanks.
Keith
·
I'm going to be using some Ramtron serial fram with my SX28.· I've never used any type of external memory, but I've read the datasheet carefully.· It looks pretty straight forward.· The datasheet was a pretty easy read, and for someone with limited exposure to this stuff, that's saying something.
Are there particular gotchas or things to look out for?· I'll be bit-banging the various leads(CS, SCK, SI/SO, and HOLD) and won't be using interrupts to talk to it.· My ISR is busy with some other tasks, and although I could combine them, it might get ugly.
I plan on writing to it at approximately 7.14 mhz, using an asymmetrical clock.· I think my HIGH time is 100ns, and my low time is 40ns.· Anyone see any trouble doing this?· These numbers, and the speed comes as a direct result of the number of instructions required to manipulate the leads.· The write routine, which is the only time-sensitive routine for me, is basically just shifting a byte out, bit by bit using RL, copying C to the port(it's MSB), incrementing a counter, checking to see if I've shifted 8 times, and then looping back.
I plan on setting the chip up first(CS), doing a WREN and a WRITE with the appropriate address, and then putting the chip on HOLD and then just clocking in new data so I keep my successive writes short and sweet.
Any advice, even generic advice regarding serial memory, would be appreciated.
Thanks.
Keith
·
Comments
All looks OK to me (I'm using serial FRAMS right now, albeit my clock duty is not quite as short), but unsure why you need the HOLD??
If you leave the clock alone, you can wait as long as you like; the only thing that re-initializes things is dropping CS from a high.
Cheers,
Peter (pjv)
What we came up with basically was that, without hold, noise on the SCK or CS lead could cause a problem.· If you assert HOLD then those leads get ignored while waiting.· In my case, there's about 16us worth of time between bytes that need to be written.· If there was noise on the CS line, that would be fatal, because I wouldn't know to reset CS, resend the two necessary opcodes, the address, etc.
I have enough pins now that using HOLD is easy enough, and I'm throwing it in more just to "do it right" than a feeling that it's really necessary.· If it happens to get in the way, then that's the first thing to go.· I like the Keep It Simple Stupid idea, and getting it to work on a basic level is priority one....
Keith
·
Understood. It's what we call "for greater certainty".
But I'm concerned about your noise. If you are worried that noise may be present on the clock/data lines while the unit is not being actively accessed and that disturbs the operation, then how would you prevent that same noise during accesses, and get corrupted readings? If the exposure to noise is the same, then the corruption issues are the same, no?
Cheers,
Peter (pjv)
Honestly, I don't expect any noise.· Although I can appreciate how detrimental noise can be, it's not obvious to me how it might come to invade my setup anyways.· My memory IC will be directly plugged in the solderless breadboard(via a sparkfun PCB adapter), and all the leads from SX to memory will be measured in inches.
Keith
I have found noise really not to be a problem unless lines are long (many feet) or if there is a big noise generator around.
Cheers,
Peter
Setup FRAM to read data byte at address
Before clocking data out of FRAM, place it in hold status
Setup MMC to write a byte of data (block write mode)
Take FRAM out of hold status
Clock the data bits from FRAM to MMC
Repeat for 512 bytes
This should speed up the operation for both SX and Stamp controllers, and with proper programming, no data should every be lost in the event of a power failure. The diagram for the setup is below, a + is a connection of two lines, a E is a crossover w/o connection of two lines. Im hoping this will be my first submission to the Projects forum.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·1+1=10
Agreed, a good and proper use for HOLD. Don't forget though, the FRAM lines must be in a particular state before hold may be asserted.
Good luck on your project.
Cheers,
Peter (pjv)
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·1+1=10
I need some easy way to test that I didn't fry anything, but the most straightforward, I think is to do a RDSR maybe. But this assumes EVERYTHING is working bidirectionally, if I get no response, was the request formed wrong? Or receiver portion not reading correctly, etc?
Keith
I'm successfully communicating with the FRAM using SHIFTIN and SHIFTOUT in SX/B. Now this is running at the goofy standard 83kbps, but its working!
This stuff is way too easy [noparse]:)[/noparse] I'm still in shock that my soldering job, which may look kind of ugly, actually works.
I've got HOLD and WP tied high, and using just four pins, CS, SI & SO, and SCK.
Very cool.
How about posting that code. I'd love to see it.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"SX-Video·Module" Now available from Parallax for only $28.95
http://www.parallax.com/detail.asp?product_id=30012
Product web site: www.sxvm.com
Available now... SX-Video OSD module $59.95 www.sxvm.com
"I'm a man, but I can change, if I have to, I guess"
Red Green
·
Here it is:
This is rough first round test code, so forgive the format.
The pauses were thrown in because I was too lazy to look up what the minimums were, etc, they can certainly be reduced, and possibly eliminated.
Notice the opcodes are "magic" numbers, in that they are fixed values that are covered in the datasheet. They are specified in binary, but decimal is just so much more compact [noparse]:)[/noparse]
For my test, I just WATCH'd result and examined the contents at the breakpoint.
Oh, and SI, SCK, CS are all from the memory chip perspective --- they are tied to the named leads on the actual chip.· This is why you see me SHIFTOUT'ing to SI, and SHIFTIN'ing from SO.
Keith
<edit> Nevermind, I was wrong, from the docs: "Sending the WREN op-code will allow the user to issue subsequent op-codes for write operations.·... Completing any write operation will automatically clear the write-enable latch and prevent further writes without another WREN command." (emphasis added by me), So your code is correct </edit>
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·1+1=10
Post Edited (Paul Baker) : 10/5/2005 3:47:30 PM GMT
This code actually works so I'm guessing its relatively accurate.
Keith
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·1+1=10
I'm not sure; why not just try it?
Cheers,
Peter (pjv)
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·1+1=10
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·1+1=10