urgent question regarding SPI????

Status
Not open for further replies.

yviswanathbe

Full Member level 4
Joined
Jun 14, 2007
Messages
221
Helped
10
Reputation
20
Reaction score
6
Trophy points
1,298
Activity points
3,066
regarding SPI????

Hi Friends,

I am working on Silabs MCU(8051 Architecture).
I Want to interface this with an SPI compatible chip from Analog devices.
Actually the controller supports SPI interfacing,but i routed the GPIO pins to the AD chip (because i have used the controller pins for another purpose),Now i can not change my design.
If i want to communicate with AD chip i should use SPI.
So what i have to do?
Do I have to implement the SPI protocol for writing and reading data?
Please help me,also send some stuff on SPI.

Thanks & Regards,
Viswanath.
 

Re: regarding SPI????

You dont have to implement SPI protocol..
Just use 'it'..
Are you sharing SPI pins as GPIO..?
Have you connected ur uC SPI with AD IC SPI..???



Regards,
S
 

Re: regarding SPI????

No,
I have not connected the uC SPI pins,they are blank. and
I have not connected uC SPI with AD chip SPI pins
instead
i have connected AD chip SPI pins with general purpose IO pins(say Port 7).
Already PCB are ready(This SPI task i have decided in the last,so in a hurry i have designed my circuit).

Hope u understand my problem.

Thanks & Regards,
Viswanath.
 

Re: regarding SPI????


Hi Viswa,
I got it..but it is a bit difficult to 'write' SPI. 'Coz it is not like I2C where you write ur start/stop condtion and clk. In SPI itz totally different and the clock is generated by the uC itself. Also it is very difficult to synchronize the data.
And you have to consider phase/polarity requirements and parallel to serial conversion, as it is 'serial peripheral interface'. It will definitely consume a lot of memory and time as well..
So my next question is..what exactly you wanna do..???


Regards,
Siva
 

Re: regarding SPI????

Thanx.
actually i am designed a PLL.
PLL is ADF4110 (Analog Devices SPI compatible).I have to send data from the ucontroller via SPI.
but i have not used those spi pins of ucontroller in my design,instead i have connected to normal port pins.

So it is not possible to implement SPI?give me some suggestions.

Regards,
Viswanath.
 

Re: regarding SPI????


1)How frequently you are going to transfer data to PLL..?
is it like synthesizer where you need to tune ur frequency and change the output..?
2)IS it possible to multiplex the SPI pins b/w SPI and GPIO..?
(you can just solder the pins from AD to uC)
 

Re: regarding SPI????

No,
i am doing this PLL for giving input to synthesizer.
suppose i want to give 20MHz to the synthesizer,i will generate 20MHz by programming PLL AD chip from ucontroller.(PLL i am using for stability).

Can u send me some stuff on spi,and sample c code if available?

Thanks n Regards,
viswanath.
 

Re: regarding SPI????

Hi viswanath,

You can definitely do it. I have implemented a couple SPI ASM routines, that are specific for my application, for a 8051 based design.

Although it is possible, it is not straight forward, since you have to consider how the SPI device you are communicating with is expecting the data to be sent.

SPI needs basically four lines for communications taking place:

MISO (Master In Slave Out, usually uC is master, other device is slave)
MOSI (Master Out Slave In)
CLK (a clock line, since SPI is a synchronous protocol)
SS (slave select)

A simple algorithm to send SPI data would be the following:
1. Make SS for the device you want to communicate low level
2. Put the bit to be sent in the MOSI line
3. Read the bit in the MISO line
4. Send a clock pulse
5. Repeat from 2 until all bits in the byte are sent and received
6. Repeat for each byte until all bytes are sent and received
7. Make SS high level

This is the basic algorithm; but is depends in your device if you have to send first the Most Significant Bit (MSBit) or the Least Significant Bit (LSBit), and even if you have to send first the MSByte or the LSByte. It also depends on your device if you have to send a low pulse or a high pulse on the clock line.

A good source of information would be your device's datasheet. Also take a look at wikipedia:

https://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…