PDA

View Full Version : Will the real SPI Object please stand up?



Ken Gracey
03-17-2009, 08:36 AM
Hey there,

Prop programming noob here, and not a very capable one either. It seems like most of the SPI objects I find are wrapped up into other sensors, A/Ds, or ICs·for which it was·customized to communicate.·This makes it more difficult for me to adapt existing code to an SPI device not currently in use by·another OBEX contributor. I'd really enjoy having a complete SPI object that I can use with any part I desire.

Is this a real need to the other Prop programmers, or are you getting by fine with out a stand-alone, fully-functional SPI object?

Thank you,

Ken Gracey

·

Mike Green
03-17-2009, 08:50 AM
The closest thing to a general SPI interface is the BS2 Compatibility Library. The problem with SPI is that there's no standard for how devices should work. Some of them are 8 bit, some are 11 bit, some vary all over the place. Some devices have to have separate input and output pins (MISO/MOSI) and some separate their use in time so you can hook them together and save an I/O pin. Sometimes devices return status information while they're receiving new data or a new command. It all varies.

It would be possible to make a configurable routine that works much like the SHIFTIN / SHIFTOUT statements of the Stamps, that would compile an assembly routine to do the actual transfers.· For a lot of SPI devices, the Spin routines in the BS2 Library are fast enough.


Post Edited (Mike Green) : 3/17/2009 12:55:30 AM GMT

Philldapill
03-17-2009, 08:59 AM
This is good and bad at the same time. I'm in the same boat as your are at the moment, Ken. I have an accelerometer that can communicate via I2C, or SPI, but the I2C communication is far to slow for my application. SPI, on the other hand, would be many times faster than the I2C. Due to the speed difference, I was looking for a general SPI object as well. Leave it to Mike to bring fantastic news... or news like this. Either way, it's always appreciated. :)

rjo_
03-17-2009, 09:25 AM
Ken,

Honestly, there is so much already present in the object exchange that after about 2 years, I am just now getting to the point of looking around to see what else is available but not yet in the OBEX. And I really want a couple of Phil's accelerometers...
so making his job easier sounds good to me.

Not only do I think a generic SPI object is needed, but it is such an important topic that it deserves it's own learning lab. I just re-read the wikipedia on the subject, there is nothing in the general description that suggests that a fully configurable SPI object is not possible... except that the nature of the exchange between the corresponding shift registers is completely undefined... so any length word can be returned by any length response and this can vary within the same device...

This suggests that a generic object would not necessarily be fully functional without adding the device specific dialog info, which might be beyond simple abstraction... in which case you simply leave the generic object as a non-functioning template and then give a couple of example applications showing how to modify the template and where the info comes from, which leads to the specific examples. This might also lead to more readable SPI objects in the exchange.

So, I agree with you. I really think some kind of boiler plate is required. And since Mike is never wrong, I agree with him too... it looks like the boiler plate is largely available in the BS2 library... it is simply a matter of dressing it up, pushing it out and then telling everyone how pretty it is:)

Rich

BradC
03-17-2009, 09:32 AM
I suspect those that think an "SPI Object" is going to be a one size fits all are going to be disappointed.

On top of the variants Mike described above, you also have variants and combinations of enable/clock/latch lines of varying sequencing/timing and polarity.
The effort required in configuring some form of SPI object to work with a specific bit of hardware would very likely equal the effort required to write the 10 lines of code required to interface to it anyway. And using the latter method you would build a firm understanding of how it all works while ending up with smaller, tighter code.

I'd second Rich's suggestion of a lab. Grab 4 or 5 different cheap bits of SPI interfaced gear and put together a tutorial on how to talk to each bit. It would serve the learner much better than trying to write/configure some form of generic SPI object.

SPI is never complex, but it's often very different.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cardinal Fang! Fetch the comfy chair.

Ken Gracey
03-17-2009, 10:57 AM
Okay guys, thanks a bunch so far. It seems that what I'm asking for would become fairly complex simply by the nature it must be universally useful. Variants and combos of enable/clock/latch with variable squency/timing/polarity, number of bits, etc. are going to give it enough parameters that it could scare off some users.

But the fact remains that I'm still not happy with what we have to offer. Talking to others I can see that I'm not alone. There's something simple about the BS2 (okay, and Martin's library, too) with SHIFTIN/SHIFTOUT and although the Prop is no BS2, Parallax could at least provide a stand-alone SPI object that could be modified.

Parallax would be pleased to sponsor an SPI-only object contest. Even if it involved extracting, documenting, writing a tutorial, and isolating the BS2 library functions in a stand-alone format it would be useful to Parallax and our customers. Do you think that if we put $350 in a contest pot we would get positive results?

Ken Gracey

Harrison.
03-17-2009, 11:21 AM
You could try Beau's SPI Engine posted here: http://forums.parallax.com/showthread.php?p=602056. I've used it in various projects and it has proven to be very reliable.

Timothy D. Swieter
03-17-2009, 11:26 AM
Another idea would be to do an educational lab on SPI. Mention could be given to the various differences in SPI and what can vary. The lab can then present some templates and references for various situations and devices.

EDIT: I now read that others posted the idea too - that is what I get for fast skimming. I second (or third or forth) the lab idea.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Timothy D. Swieter, E.I.
www.brilldea.com (http://www.brilldea.com) - Prop Blade, LED Painter, RGB LEDs, 3.0" LCD Composite video display, eProto for SunSPOT
www.tdswieter.com (http://www.tdswieter.com)

Beau Schwabe
03-17-2009, 12:33 PM
Ken Gracey (Parallax),

The SPI engine that Harrison mentions was written as a stand-alone compatible version of SHIFTIN/SHIFTOUT with a familiar "feel" to the Basic Stamp with the speed of Propeller assembly. In some cases it's been reported that it's actually too fast. So really the only thing that this code needs is a "throttle" around the CLOCK pulse portion of the code. I can spend some time on that tomorrow (Tuesday) if you would like.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe (mailto:bschwabe@parallax.com)

IC Layout Engineer
Parallax, Inc.

Ken Gracey
03-17-2009, 12:46 PM
Beau,

It would be fantastic to have an official Parallax SPI engine as part of our Prop IDE distribution. Add throttle, any documentation and perhaps an example to put it to use (DS1620?).

This would be a great addition and I encourage you to finish it for the Prop people with an OBEX post.

Thanks,

Ken Gracey

Cluso99
03-17-2009, 05:09 PM
Thanks Beau http://forums.parallax.com/images/smilies/smile.gif
I will be interfacing an SPI Flash shortly, so I will try this object out.

Ken: It's great to see Parallax making great offers of support in contests, etc, to boost certain aspects of Propeller development.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
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)
· 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)

BillDer
03-17-2009, 05:45 PM
This is a very timely thread. I am right now working through (read that debugging) using an SPI interface to an accelerometer. I used the shiftin/out from the BS2 object. According to the oscilloscope I think I'm getting all the bits right but the numbers don't make sense yet. It is a ADIS16204 from Analog Devices. The acceleration is sent using two's compliment. I am not to sure how to decode that yet. But that is for another thread.

I used the BS2 object because it seemed the simplest to use and I had a little experience with using the stamp shiftin and out.
I would absolutely love it if there was a Parallax sponsored SPI object. I think a contest is a great idea. I would certainly enter if I knew how to do this. Anything that makes the end product/project easier or quicker is of value!

Bob Lawrence (VE1RLL)
03-17-2009, 07:05 PM
@Beau

That was an easy $350 http://forums.parallax.com/images/smilies/lol.gif

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Aka: CosmicBob

Javalin
03-17-2009, 09:03 PM
Love the post title. Nice bonus for Beau!

J

rjo_
03-17-2009, 10:22 PM
Bob,

I think Beau is going to need a few new chips to test everything out...
And then he is going to need some quality time alone... so, a secretary to answer his phone would be good.
So the final result should be: $350 + parts + staff...
or... a cup of coffee and a smile, whichever comes first.

Rich

Ken Gracey
03-17-2009, 11:32 PM
Beau has our support, for certain! Appears that he's got a solid start and this project could be finished with documentation, a few examples, etc.

You guys are really going to bat for Beau right now. I've dispatched a secretary and SPI parts to his house; no comment on the award cash. Parallax employees are usually not eligible for participation in our external contests. But he can have a free day off if he finishes the project. For now he's still as quiet as a mouse - I'm still looking for him this morning. . Beau. . . Beau. . . where art thou?

Ken Gracey
Parallax, Inc.

Beau Schwabe
03-18-2009, 12:24 AM
Thanks guys/gals!

Ok, As per an E-mail Ken sent me this morning, I will get an Assembly version out to the OBEX sometime today, and A Spin version out sometime later in the week.

The difference between the two (Assembly or Spin) aside from the speed, is that the Assembly version will require it's own cog, while the Spin version will be parasitic to an existing cog.

As far as SPI parts, I have plenty of "stuff" to complete this project, but always happy to receive more for future projects.

I wasn't expecting a cash reward. I'm pretty humbled just getting something out that other people can benefit from. That's my reward.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe (mailto:bschwabe@parallax.com)

IC Layout Engineer
Parallax, Inc.

Beau Schwabe
03-18-2009, 07:20 AM
Looks like it might be late tonight or tomorrow... quite·unexpectedly, I had a·power cord to the computer that become un-plugged http://forums.parallax.com/images/smilies/shakehead.gif
··



▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe (mailto:bschwabe@parallax.com)

IC Layout Engineer
Parallax, Inc.

ianw
03-18-2009, 02:03 PM
Similar to BillDer, I too have an ADIS sensor that I need to write an SPI interface for using two's compliment.

I had previously read through Beau's code, and several of the SPI objects posted to the obex, in addition to wikipedia and various other web resources - I'm now starting to understand what I am doing. Although I am very curious to see what Beau comes up with as an interface for SPI, from my limited understanding of the code I've seen and several corresponding datasheets, it is apparent that there is a great deal of variety in how an SPI interface is defined for various sensors. So, I think it would also be helpful if a lab was still developed around this new object to step user's through the mapping of a datasheet spec to Beau's interface. Even better, as a part of this lab, might be to map the inputs/outputs from the example SPI object into Hanno's tool for viewing the traces.

In my case, I have 10+ sensor readings being output from the SPI object, and 10+ offsets/calibration parameters that can be fed into the sensor system.
If the concept of a lab built around Beau's object is outside of the scope for his work, I'd be happy to help write/test for such an effort since I think it would be generally useful for others in the community confronted with developing an SPI interface for the first time, although I'll probably have a few questions along the way.

Beau Schwabe
03-18-2009, 03:48 PM
SPI - Serial Peripheral Interface uploaded to the OBEX http://obex.parallax.com/objects/431/

Sorry for the delay... I received a new "toy" from E-Bay and when I went to plug it in to try it out, I inadvertently unplugged a few other things. Needless to say, I didn't save, nor had the auto-save kicked in.

If you find any problems with the SPI object, please let me know... there are a few aspects with the SHIFTIN that I was unable to test, so if anyone finds a circumstance that fails, then please let me know ASAP.



ianw,

If you and others can provide more specific details, I can make necessary changes to the SPI object. An aspect of SPI that I have not covered makes use of multiple data lines that can be used in parallel. If there is a strong interest there, that might be a worthwhile addition to the SPI object. The High Speed 14.5 Meg Baud Prop to Prop serial communication touches on this concept using 4 I/O lines but uses Asynchronous communication. The SPI is different in that it would need to use Synchronous communication.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe (mailto:bschwabe@parallax.com)

IC Layout Engineer
Parallax, Inc.

BillDer
03-18-2009, 05:48 PM
Thank you Beau, I can't wait to try this out.
In regards to your other question, the ADIS16204 accelerometer has two data lines.
Like Ianw, I need help in understanding how to interpret the datasheet. For example, to figure out whether the chip was MSBPOST or MSBPRE, I had to do trial and error. I'm pretty sure it is MSB first. Looking at the oscilloscope I counted bits and looked at the received bits using debug. When the two matched I assumed I got it right. Now, my problem is to figure out how to decode the bits into a usable G. For example, the data is 14 bits, two's complement. I am thinking all I have to do is subtract one then flip the bits. I hope that is right.
Thanks again Beau!

Laurent R
03-18-2009, 06:44 PM
Thank you Beau,

It's exactly what I'was looking for :D

Beau Schwabe
03-18-2009, 11:32 PM
BillDer,

Through the SPI interface, the Clock starts out HIGH and data is valid upon the rising edge, so this would mean that it needs a POST clock. ... and yes it is MSB, so you would use MSBPOST for the SHIFTIN command, and MSBFIRST for the SHIFTOUT command.

As far as the two data lines, I assume you mean DIN and DOUT. Generally the DIN and be connected directly to the DOUT via a 1K to 330 Ohm resistor, and you connect the Propeller directly to the DIN.


R
DOUT >----/\/\---o---< DIN
|
o-----------> Data


According to the datasheet on page 5 of the referenced pdf, The SPI's ClockDelay could be set to a minimum of 1 resulting in a 300ns clock pulse width.




''SPI.start(ClockDelay, ClockState)
SPI.start(1, 1)


Delay := 15 ''Clock delay
'' = 300ns + (N-1) * 50ns

'' Example1:
'' A Delay of 5 would be 500ns
'' 300ns + 4 * 50ns = 500ns

'' Example2:
'' A Delay of 15 would be 1us
'' 300ns + 14 * 50ns = 1000ns = 1us




Reference PDF:
http://www.analog.com/static/imported-files/Data_Sheets/ADIS16204.pdf

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe (mailto:bschwabe@parallax.com)

IC Layout Engineer
Parallax, Inc.

Post Edited (Beau Schwabe (Parallax)) : 3/18/2009 3:40:05 PM GMT

Ken Gracey
03-18-2009, 11:37 PM
Nie job, Beau! I have not had the opportunity to try it out yet, but it's what I was looking for (I will use the Spin version whenever possible first, so I look forward to that one as well). Please be sure that Jeff has it for the updated Prop IDE distribution, too.

Ken Gracey
Parallax, Inc.

Beau Schwabe
03-18-2009, 11:52 PM
Ken,

Thank you, I will get the Spin version out later in the week/weekend. For the most part Spin would be plenty fast for SPI. In some cases however you might want to use the Assembly version which I have posted that really blazes. Even faster if you streamline it to eliminate some of the conditional requirements for a specific project. The benefit however to having an all Spin version is that you could parasitically use an existing cog. The Assembly version requires it’s own cog, but with the dispatching used within the assembly, you can add additional Assembly functions, but again this is something that could be modified to meet the needs of a specific project. Either way, the Spin version or the Assembly version will have it's place.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe (mailto:bschwabe@parallax.com)

IC Layout Engineer
Parallax, Inc.

Beau Schwabe
03-19-2009, 12:46 AM
BillDer,
About combining the DIN and DOUT... the data sheet says "...Because the SPI port operates in full duplex mode, it supports simultaneous, 16-bit receive (DIN) and transmit (DOUT) functions during the same data frame." ... so my recommendation of combining the DIn and DOUT will not work unless the ADIS16204 will also operate in a half duplex mode.
There seems to be a need for a third SPI function that will simultaneously READ/WRITE ... let me think about this and I will get back to you.
·




▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe (mailto:bschwabe@parallax.com)

IC Layout Engineer
Parallax, Inc.

Bill Henning
03-19-2009, 01:56 AM
Thanks Beau!

I'll check it out... what would interest me is a tech note on using the counters to provide a clock to SPI interfaces, specifically how to synchronize starting/stopping the clock with the byte/word/whatever boundaries. I've been working with one chip and can get up to almost 5mbps without problems, but I would love to get the 10mbps counters would easily allow, or even higher :)

Bill


Beau Schwabe (Parallax) said...
SPI - Serial Peripheral Interface uploaded to the OBEX http://obex.parallax.com/objects/431/

Sorry for the delay... I received a new "toy" from E-Bay and when I went to plug it in to try it out, I inadvertently unplugged a few other things. Needless to say, I didn't save, nor had the auto-save kicked in.

If you find any problems with the SPI object, please let me know... there are a few aspects with the SHIFTIN that I was unable to test, so if anyone finds a circumstance that fails, then please let me know ASAP.



ianw,

If you and others can provide more specific details, I can make necessary changes to the SPI object. An aspect of SPI that I have not covered makes use of multiple data lines that can be used in parallel. If there is a strong interest there, that might be a worthwhile addition to the SPI object. The High Speed 14.5 Meg Baud Prop to Prop serial communication touches on this concept using 4 I/O lines but uses Asynchronous communication. The SPI is different in that it would need to use Synchronous communication.

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

BillDer
03-19-2009, 07:29 PM
Beau,
Thank you very much. You have actually cleared up a lot. First, I never thought of using one pin to read both DIN and DOUT. I am going to try that. Also, using MSBPOST for the shiftin statement. Your answer gave also provided the logic for determining the correct thing in the future as well.
One question on setting the delay. Do I use both statements like this to start it running.

SPI.Start(1,1)
Delay := 15

Or were you just telling me the 1,1 parameters set the delay at 15 or???

Thanks again.
PS
I was also having trouble figuring out how to decipher two's compliment. In your demo
you had the line:
Celsius := Celsius << 23 ~> 23 '' extend sign bit
I believe I can use the same logic for the accelerometer right?
so if I did this:
bs2.pulsout_uS(clk, 210)
results := spi.shiftin(Dout, clk, SPI#MSBPost,16) 'most significant bits first
results := results << 2 ~> 2 '' extend sign bit
I think I will get the correct acceleration.
Right?

Beau Schwabe
03-19-2009, 11:58 PM
BillDer,

Just the... SPI.Start(1,1) ...will create a clock pulse width of about 300ns

The formula is:

Delay = 300ns + (N -1) * 50ns

where:
N = the delay value you supply in the first argument of the ... SPI.Start(1,1) ... command.

BTW, the second argument is the initial or Idle clock state.


I think that the ... Celsius := Celsius << 23 ~> 23 '' extend sign bit ... will work for you, but make sure you are only looking at the data. From briefly looking at the data sheet on your Accelerometer, it looks like there may be other bits embedded in the data that could corrupt the results.


But again, saying all this, unless the ADIS16204 will also operate in a half duplex mode, my SPI will not work when combining the DIN and DOUT. That trick only works if the SPI communication is half-duplex. The ADIS16204 appears to operate in full-duplex mode.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe (mailto:bschwabe@parallax.com)

IC Layout Engineer
Parallax, Inc.

Q*bert
03-20-2009, 05:52 AM
Ken Gracey (Parallax) said...
Parallax would be pleased to sponsor an SPI-only object contest. Even if it involved extracting, documenting, writing a tutorial, and isolating the BS2 library functions in a stand-alone format it would be useful to Parallax and our customers. Do you think that if we put $350 in a contest pot we would get positive results?

Ken Gracey


This kind of attitude from Parallax is one of the things that has me so excited to be working with the Propeller.

Really refreshing!

ianw
03-22-2009, 04:15 AM
Beau said...
But again, saying all this, unless the ADIS16204 will also operate in a half duplex mode, my SPI will not work when combining the DIN and DOUT. That trick only works if the SPI communication is half-duplex. The ADIS16204 appears to operate in full-duplex mode.


Was there ever a full duplex 4-pin version of this object created?

Are there still any plans to make a lab for mapping a new SPI device's datasheet to the generic SPI object? By reading the BasicStamp docs, I was able to learn about ShiftIn-ShiftOut as it's used with the DS1620, but it would be helpful to see docs specific to the propeller that also addressed decoding SPI parameters from datsheets to be used by the object.

Thanks,
Ian

Beau Schwabe
03-22-2009, 06:43 AM
ianw (http://forums.parallax.com/member.php?u=55226),

"Was there ever a full duplex 4-pin version of this object created?" - Not to my knowledge.· I have had a busy start to the weekend and have not had a chance to get back into the SPI.· Keeping the 4-pin full duplex in mind it is my full intention to put something together be it a Spin object or an·Assembly object but I'm not sure I can get to it this weekend.



▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe (mailto:bschwabe@parallax.com)

IC Layout Engineer
Parallax, Inc.

Beau Schwabe
03-23-2009, 01:25 PM
Here are two SPI versions:· One in Spin, and the other in Assembly.· For the most part Spin would be plenty fast for SPI in some cases however you might want to use the Assembly version which really blazes. (about 200 times faster than the Spin version)· The benefit however to having an all Spin version is that you could parasitically use an existing cog.· The Assembly requires it’s own cog to operate
·
SPI Assembly - Serial Peripheral Interface
http://obex.parallax.com/objects/431/ (http://obex.parallax.com/objects/431/)
·
SPI Spin - Serial Peripheral Interface
http://obex.parallax.com/objects/433/ (http://obex.parallax.com/objects/433/)

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe (mailto:bschwabe@parallax.com)

IC Layout Engineer
Parallax, Inc.

ianw
03-24-2009, 02:46 AM
Beau said...
Keeping the 4-pin full duplex in mind it is my full intention to put something together be it a Spin object or an Assembly object but I'm not sure I can get to it this weekend.

Thanks Beau - I'll keep monitoring this thread for the 4 pin full duplex version

Sapieha
03-25-2009, 04:28 AM
Hi Beau Schwabe (Parallax)


Have You tested Asembly SPI on this IC (Adresing range and speed)
Ramtron FM25H20 2Mb Serial FRAM, 3V Memory

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nothing is impossible, there are only different degrees of difficulty.
For every stupid question there is at least one intelligent answer.
Don't guess - ask instead.
If you don't ask you won't know.
If your gonna construct something, make it·as simple as·possible yet as versatile as posible.


Sapieha

Bill Henning
03-25-2009, 04:36 AM
Nice find!

Too bad its expensive; $18 qt 1 at future.

See the EDN announcement at www.edn.com/blog/1560000156/post/260026626.html (http://www.edn.com/blog/1560000156/post/260026626.html)


Sapieha said...
Hi Beau Schwabe (Parallax)
Have You tested Asembly SPI on this IC (Adresing range and speed)
Ramtron FM25H20 2Mb Serial FRAM, 3V Memory

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

Beau Schwabe
03-25-2009, 05:46 AM
Sapieha,

Looks like it would work just fine. The Chip select pin is inverted, but you manage that outside of the SHIFTIN/SHIFTOUT command anyway.
The Data looks to be half duplex, so you could combine the DataIn and the DataOut via a resistor and use a 3-wire SPI interface.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe (mailto:bschwabe@parallax.com)

IC Layout Engineer
Parallax, Inc.

Sapieha
03-25-2009, 06:31 AM
Hi Beau Schwabe (Parallax)

I wil incorporate 4 of them to have FRAM drive to TriBlade ziCOG CPM work drive with Yours permision to use Asembly SPI driver.
My consideration is if This driver can handle Adresing of that chip.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nothing is impossible, there are only different degrees of difficulty.
For every stupid question there is at least one intelligent answer.
Don't guess - ask instead.
If you don't ask you won't know.
If your gonna construct something, make it·as simple as·possible yet as versatile as posible.


Sapieha

Beau Schwabe
03-25-2009, 11:33 PM
Sapieha,
Absolutely, feel free to use the SPI driver.
Looking at the FM25H20 datasheet page 8 for memory Writes, and Reads, it looks like you can combine the Op-Code with the 18-Bit Address to send via SHIFTOUT the entire 32-bit Long.· Then if you are writing, continue a SHIFTOUT with an 8-bit data send or if you are reading continue a SHIFTIN with an 8-bit data read.
Ohh and BTW) you can combine DataIn and DataOut ... see page 2 under 'Q' and 'D'
·
Reference:
http://www.zlgmcu.com/RAMTRON/pdf/FM25H20.pdf (http://www.zlgmcu.com/RAMTRON/pdf/FM25H20.pdf)
·



▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe (mailto:bschwabe@parallax.com)

IC Layout Engineer
Parallax, Inc.

SexieWASD
09-23-2009, 07:09 AM
Ok kinda an old thread, but not that old.

Beau Schwabe, thank you for the driver, and the good documentation in it! I just got my AD5235 digital potentiometers doing some tricks and I'm really having some fun with this. I struggled a bit with the hardware side of my board (I would fail at your job), but I knew the prop would be the right choice in the end. I thank you for making SPI easy. I'm new to the prop, all forms of serial communication, I don't know spin and I only glanced at the education kit PDF, and besides a misunderstanding of compile current / compile top I got your driver up and running without a hitch in only a days worth of spare time.


... And now for I2c :)

DogP
09-24-2009, 01:00 PM
Well... since this thread is bumped, I might as well also throw my thanks out there... every time I need SPI, I start w/ Beau's code and go from there (which is partially what I was talking about at UPENE when I said everything I do on the Prop is just copying Beau's code http://forums.parallax.com/images/smilies/wink.gif ).

DogP

Beau Schwabe
09-24-2009, 03:24 PM
Thanks DogP, I appreciate that. http://forums.parallax.com/images/smilies/smilewinkgrin.gif

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe (mailto:bschwabe@parallax.com)

IC Layout Engineer
Parallax, Inc.