SPI format and frequency for the MAX3140?

29 May 2009 . Edited: 29 May 2009

Hi,

You said you are working on an RS485 interface (as I am) Are you planning to use the MAX3140? I am having trouble determining the SPI frequency. I am using spi.format(16,1,1) but the returns don't really make any sense. If you are using this part could you tell me what you are using for these parameters?

Gary

29 May 2009 . Edited: 29 May 2009

Hi Gary,

We're not actively building a RS485 interface, so haven't got any real experience here.

But looking at http://datasheets.maxim-ic.com/en/ds/MAX3140.pdf, Figure 11 (pg 15) suggests the SPI operates with POL=0, PHA=0. So you should be using:

spi.format(16, 0, 0);

or rather

spi.format(16, 0); // bits, mode

as we've moved to enumerating the mode from 0-3. See http://mbed.co.uk/projects/libraries/api/mbed/trunk/SPI#SPI.format

See if that helps?

Simon

29 May 2009 . Edited: 29 May 2009

Any clue on frequency?

29 May 2009 . Edited: 29 May 2009
03 Jun 2009 . Edited: 03 Jun 2009

I got the max3140 working (at least in transmit - working on receive) using the 1000000Hz SPI rate. My problem? Simple stupidity! I put a printf statement right after I asset chip select and that blew my framing. I'll probably post it to the blog if it's interesting enough.

 

Gary

04 Jun 2009 . Edited: 04 Jun 2009

Hi

Gary Trimble wrote:

I got the max3140 working (at least in transmit - working on receive) using the 1000000Hz SPI rate. My problem? Simple stupidity! I put a printf statement right after I asset chip select and that blew my framing. I'll probably post it to the blog if it's interesting enough.

Nice work! Yeah, printf takes a long time if the baud rate is low (remember 9600 modems?!), so shouldn't really be used in timing critical sections at those speeds. Like most bugs, it is obvious now you've seen it, but until then...

Yeah, if you get it working, it'd be great if you could put up a max3140 example in the cookbook. Feel free to add photos of your handiwork too :) Chris got hold of some of those chips, so we then may be able to reproduce it.

Great stuff!

Simon