Jump to content

SPI interface... hardware and software problems...


pilo

Recommended Posts

Well, we want to have an SPI interface for controlling DAC, (maybe ADC), PGA, clock...

The problems is that not allof these device allow chaining... so we need one CS for each chip (on the ti eval boad for dac they use one Dout for each chip too... but as they are in High Z mode when CS is high, I think there's no problem to use the same dout for all chip).

SO how is the best to do this? Use one pic pin per CS, or use an adress bus? the problem in both case is how to wire stuff. It's easy to do yes, but as we want to keep it modular, how to setup adress for module (chip) easily?

I think in any case using adress decoding stuff is the key (instead of one pin per chip). But where to put those? on the core with the pic, or on the module... that's the question.

Maybe there's an other solution, a software one.

I know this is not really MIOS programming, but as I want to use MIOS to control it, what I can and what I can't do (I don't use analog input so I can use them as output for adress/CS I think).

I though about this for about 2 days now and I'm bit lost... don't know what's the best way...

thanks

Link to comment
Share on other sites

Hi Pilo,

if the devices are not controlled from an interrupt service routine, but from the main program, you can use the LCD data pins for the shift clock (SCLK) and the digital out (DOUT). For the digital input (DIN) you have to use a dedicated pin, but it can be shared by all devices if they support an high impedance mode if CS not active.

So, only the chip select lines require dedicated outputs. If there aren't enough free, you could use one or more shift registers (74HC595), connected to the same SCLK and DOUT lines like the other chips. The register clock (RCLK) has to be driven seperately.

In this way you will have an endless number of chip select outputs, but every serial register increases the latency by ca. 8 uS

Alternatively you could add some glue logic for the chip select lines which decodes (e.g.) 8 outputs from a 3 bit input line (3-to-8 decoder)

Best Regards, Thorsten.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...