DSPRelated.com
Forums

Software SPI

Started by Samir Bendoukha August 19, 2010
Dear all,

I am using the two SPI modules on the C6747 for an EEPROM and an ADC. I need
to connect a an SPI DAC as well to the DSP. The DAC will be used very rarely
as it is used to provide a coarse tune for a VCO. Is it possible to connect
it to a bunch of GPIO pins and do the SPI in software using the GP timer?

If anyone has done this before, could you may be give me some pointers.

Thanks everyone.

--
Kind regards,
Samir.

---------------------------
Samir Bendoukha

"Computers are like air conditioners, they stop working properly if you open
Windows."
Samir,

The SPI is a two way interface AND each device (input or output) is individually
addressed as part of the communication protocol.

So, on a single SPI interface you can have both the ADC and the DAC devices.

R. Williams

---------- Original Message -----------
From: Samir Bendoukha
To: c6x
Sent: Thu, 19 Aug 2010 15:29:37 +0100
Subject: [c6x] Software SPI

> Dear all,
>
> I am using the two SPI modules on the C6747 for an EEPROM and an ADC.
> I need to connect a an SPI DAC as well to the DSP. The DAC will be
> used very rarely as it is used to provide a coarse tune for a VCO. Is
> it possible to connect it to a bunch of GPIO pins and do the SPI in
> software using the GP timer?
>
> If anyone has done this before, could you may be give me some pointers.
>
> Thanks everyone.
>
> --
> Kind regards,
> Samir.
>
> ---------------------------
> Samir Bendoukha
>
> "Computers are like air conditioners, they stop working properly if
> you open Windows."
------- End of Original Message -------

_____________________________________
Dear Samir,

you can connect multiple slave devices to one SPI master port, but you need
to provide individual Slave Chip Select signals. The SIMO/MOSI and
SOMI/MISO lines are connected in parallel.

The 6747 has only one SPIx_SCS[0] output. The easiest way to add additional
Slave Select Outputs is using GPIO-Pins and OR gates:
/SSa = GPIOa OR SCS[0]
/SSb = GPIOb OR SCS[0]
To select device a: GPIOa = L GPIOb = H
To select device b: GPIOa = H GPIOb = L
Before starting the SPI data transfer set the GPIO pins to select the device.

For an even simpler solution you may directly connect GPIO pins to the
Slave Selects without using SCS[0]. In this case your program must
- drive GPIO low
- do SPI transfer
- wait until SPI transfer is completed
- drive GPIO high

You can use the 6747 SPIFMT registers to configure up to 4 individual data
formats for the slave devices.

Best Regards
Adolf Klemenz

At 15:29 19.08.2010 +0100, Samir Bendoukha wrote:
>Dear all,
>
>I am using the two SPI modules on the C6747 for an EEPROM and an ADC. I
>need to connect a an SPI DAC as well to the DSP. The DAC will be used very
>rarely as it is used to provide a coarse tune for a VCO. Is it possible to
>connect it to a bunch of GPIO pins and do the SPI in software using the GP
>timer?
>
>If anyone has done this before, could you may be give me some pointers.
>
>Thanks everyone.
>
>--
>Kind regards,
>Samir.
>
>---------------------------
>Samir Bendoukha
>
>"Computers are like air conditioners, they stop working properly if you
>open Windows."
>

_____________________________________
Fellows,

I made a mistake.
I stated that the SPI protocol included a device address byte.
...My error...
The use of a chip select signal, one for each device, is correct and my statement in an
earlier post about device addressing is wrong.

...my excuse...
So many different communication protocols and *I* did not refresh my memory before
opening my mouth.

My apologies.

R. Williams

---------- Original Message -----------
From: Adolf Klemenz
To: Samir Bendoukha , c6x
Sent: Fri, 20 Aug 2010 09:49:31 +0200
Subject: Re: [c6x] Software SPI

> Dear Samir,
>
> you can connect multiple slave devices to one SPI master port, but you
> need to provide individual Slave Chip Select signals. The SIMO/MOSI
> and SOMI/MISO lines are connected in parallel.
>
> The 6747 has only one SPIx_SCS[0] output. The easiest way to add
> additional Slave Select Outputs is using GPIO-Pins and OR gates:
> /SSa = GPIOa OR SCS[0] /SSb = GPIOb OR SCS[0] To select device a:
> GPIOa = L GPIOb = H To select device b: GPIOa = H GPIOb = L Before
> starting the SPI data transfer set the GPIO pins to select the device.
>
> For an even simpler solution you may directly connect GPIO pins to the
> Slave Selects without using SCS[0]. In this case your program must
> - drive GPIO low
> - do SPI transfer
> - wait until SPI transfer is completed
> - drive GPIO high
>
> You can use the 6747 SPIFMT registers to configure up to 4 individual
> data formats for the slave devices.
>
> Best Regards
> Adolf Klemenz
>
> At 15:29 19.08.2010 +0100, Samir Bendoukha wrote:
> >
> >
> >Dear all,
> >
> >I am using the two SPI modules on the C6747 for an EEPROM and an ADC. I
> >need to connect a an SPI DAC as well to the DSP. The DAC will be used very
> >rarely as it is used to provide a coarse tune for a VCO. Is it possible to
> >connect it to a bunch of GPIO pins and do the SPI in software using the GP
> >timer?
> >
> >If anyone has done this before, could you may be give me some pointers.
> >
> >Thanks everyone.
> >
> >--
> >Kind regards,
> >Samir.
> >
> >---------------------------
> >Samir Bendoukha
> >
> >"Computers are like air conditioners, they stop working properly if you
> >open Windows."
> >
------- End of Original Message -------

_____________________________________