<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>SPI interface with peripheral devices</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/24244/spi-interface-with-peripheral-devices</link><description> 
Sir, 
I am learning SPI interfacing. I am using P89V51RD2FA
microcontroller. 
And I have to interface it with a device using SPI interface but the
problem is that I don&amp;#39;t know what to do when I have to obtain data
more than one byte. 

 
Like in my</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: SPI interface with peripheral devices</title><link>https://community.arm.com/thread/146374?ContentTypeID=1</link><pubDate>Wed, 24 Jun 2009 22:36:33 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:0eee4afb-bbf6-4990-9e9b-d9c2cf95e559</guid><dc:creator>Asham Vohra</dc:creator><description>&lt;p&gt;&lt;p&gt;
Sir,I have being trying to carry out SPI communication but the
data never goes into SPI data register atleast when I debug the
program. I dont know what the pblm..is can u help me on this.&lt;br /&gt;
Please tell some more details abt the data register as much I know it
is a shift register any value that is being sent or received goes or
comes at it.&lt;/p&gt;

&lt;p&gt;
Anything I am missing please let me know.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI interface with peripheral devices</title><link>https://community.arm.com/thread/144632?ContentTypeID=1</link><pubDate>Sun, 31 May 2009 00:26:54 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:b51ba618-97a4-4035-9448-10c70c4d30d6</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
The datasheet for the ade7753 is here: 
&lt;a href="http://www.analog.com/en/analog-to-digital-converters/energy-measurement/ade7753/products/product.html"&gt;www.analog.com/.../product.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;
The timing diagrams on pages 49-51 show pretty clearly what is
required on the CS, SCLK, DIN and DOUT lines.&lt;/p&gt;

&lt;p&gt;
So, all you need to do is to look at your code and check that it
produces those signals as shown!&lt;br /&gt;
In particular, pay attention to where CS may and must not
change...&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI interface with peripheral devices</title><link>https://community.arm.com/thread/142320?ContentTypeID=1</link><pubDate>Sat, 30 May 2009 21:07:01 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:c5141da3-3cae-4fd9-9b31-0cb4eb0ad546</guid><dc:creator>Asham Vohra</dc:creator><description>&lt;p&gt;&lt;p&gt;
I am soldering the hardware at present so really can&amp;#39;t test it.
But it will be ready in a day or two.&lt;/p&gt;

&lt;p&gt;
Yes I have thought about slave signal.Since I am also using an
EEPROM also.So controlling them is important.&lt;/p&gt;

&lt;p&gt;
I have thought about the configurations but I am not sure with
it..Since I can&amp;#39;t test at present.&lt;/p&gt;

&lt;p&gt;
But this line is there in the datasheet and I am making use of
this.&lt;br /&gt;
&amp;quot;Data shifted in at falling edge and shifted out at the rising edge
of the sclk.&amp;quot;&lt;br /&gt;
This is there for my peripheral device.&lt;/p&gt;

&lt;p&gt;
I don&amp;#39;t want u to provide me the code I wish to develop it but I
want u to help me develop the concept.&lt;/p&gt;

&lt;p&gt;
And yes I agree with ur last comment on slowing down the commn. to
check it.&lt;/p&gt;

&lt;p&gt;
Please provide me some clarity on reading three bytes...&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI interface with peripheral devices</title><link>https://community.arm.com/thread/139179?ContentTypeID=1</link><pubDate>Sat, 30 May 2009 09:12:54 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:067d5822-e6f3-4634-adcf-525467527181</guid><dc:creator>ImPer Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
Now we are back 3 days. Haven&amp;#39;t you tested the code?&lt;/p&gt;

&lt;p&gt;
Have you thought about the slave-select signal?&lt;/p&gt;

&lt;p&gt;
Have you configured your SPI to use correct mode, i.e. what phase
of the clock to latch on, and if the bus should idle in high or low
state?&lt;/p&gt;

&lt;p&gt;
What are you doing to figure out what goes wrong? Just requesting
code from this forum, or are you looking at the signals? Remember
that SPI is synchronous. Being the master side, you can slow down the
communication so you can take a closer look at the signals.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI interface with peripheral devices</title><link>https://community.arm.com/thread/135787?ContentTypeID=1</link><pubDate>Sat, 30 May 2009 06:11:03 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:8709a375-a9bb-4336-8a22-595a920cabce</guid><dc:creator>Asham Vohra</dc:creator><description>&lt;p&gt;&lt;p&gt;
Sir,&lt;br /&gt;
the code is not completely correct.&lt;br /&gt;
Also there is some confusion it will be simpler if u could tell me
how to send three bytes.&lt;/p&gt;

&lt;p&gt;
According to me since SPI is duplex there should be no problem if
I do in the following way&lt;/p&gt;

&lt;p&gt;
like&lt;br /&gt;
sending word&lt;br /&gt;
dummy byte&lt;br /&gt;
data obtained 1st byte&lt;br /&gt;
dummy byte&lt;br /&gt;
data obtained second byte&lt;br /&gt;
dummy byte&lt;br /&gt;
data obtained 3rd byte&lt;/p&gt;

&lt;p&gt;
each dummy byte I send will return me a byte of data due to shift
registers present.&lt;br /&gt;
Is it the correct way????&lt;br /&gt;
For doing this I will be making use of interrupt signal.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI interface with peripheral devices</title><link>https://community.arm.com/thread/125472?ContentTypeID=1</link><pubDate>Fri, 29 May 2009 00:36:29 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:760beeb9-22c3-473f-82d2-0a510b7cf794</guid><dc:creator>ImPer Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
&amp;quot;Still one aspect is not clear to me.&amp;quot;&lt;br /&gt;
And you didn&amp;#39;t think about writing out exactly what aspect that would
be? We have to guess?&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI interface with peripheral devices</title><link>https://community.arm.com/thread/114963?ContentTypeID=1</link><pubDate>Thu, 28 May 2009 22:19:16 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:3bea43b8-7825-4556-853c-fe6f5710b6cb</guid><dc:creator>Asham Vohra</dc:creator><description>&lt;p&gt;&lt;p&gt;
Please look at the above problem and help me.Still one aspect is
not clear to me.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI interface with peripheral devices</title><link>https://community.arm.com/thread/125479?ContentTypeID=1</link><pubDate>Tue, 26 May 2009 22:02:53 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:61649d85-9660-430d-b0d2-fa841171befe</guid><dc:creator>Asham Vohra</dc:creator><description>&lt;p&gt;&lt;p&gt;
Sir,&lt;br /&gt;
the code is not completely correct.&lt;br /&gt;
Also there is some confusion it will be simpler if u could tell me
how to send three bytes.&lt;/p&gt;

&lt;p&gt;
According to me since SPI is duplex there should be no problem if
I do in the following way&lt;/p&gt;

&lt;p&gt;
like&lt;br /&gt;
sending word&lt;br /&gt;
dummy byte&lt;br /&gt;
data obtained 1st byte&lt;br /&gt;
dummy byte&lt;br /&gt;
data obtained second byte&lt;br /&gt;
dummy byte&lt;br /&gt;
data obtained 3rd byte&lt;/p&gt;

&lt;p&gt;
each dummy byte I send will return me a byte of data due to shift
registers present.&lt;br /&gt;
Is it the correct way????&lt;br /&gt;
For doing this I will be making use of interrupt signal.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI interface with peripheral devices</title><link>https://community.arm.com/thread/114964?ContentTypeID=1</link><pubDate>Tue, 26 May 2009 21:21:50 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:4d3fdabc-533d-4fa2-b679-15c733a2a0b2</guid><dc:creator>Asham Vohra</dc:creator><description>&lt;p&gt;&lt;p&gt;
great thanks seriously I never got that result...&lt;br /&gt;
thanks again&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI interface with peripheral devices</title><link>https://community.arm.com/thread/103135?ContentTypeID=1</link><pubDate>Tue, 26 May 2009 06:02:20 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:4eea61f5-80fa-4b13-902d-19e0e51407d4</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
Really?!&lt;/p&gt;

&lt;p&gt;
Just googling &amp;quot;ADE7753 SPI&amp;quot; gave this:&lt;/p&gt;

&lt;p&gt;
&lt;a target="_blank" href="http://www.avrfreaks.net/index.php?name=PNphpBB2&amp;amp;file=viewtopic&amp;amp;t=65635"&gt;www.avrfreaks.net/index.php&lt;/a&gt;&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI interface with peripheral devices</title><link>https://community.arm.com/thread/114962?ContentTypeID=1</link><pubDate>Tue, 26 May 2009 06:00:52 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:98b2ff69-4976-4814-8432-3fb8493d86eb</guid><dc:creator>Asham Vohra</dc:creator><description>&lt;p&gt;&lt;p&gt;
okk...thanks for ur reply&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI interface with peripheral devices</title><link>https://community.arm.com/thread/77471?ContentTypeID=1</link><pubDate>Tue, 26 May 2009 05:59:10 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:fc67b081-6294-4f8c-af58-35912f295ce4</guid><dc:creator>Asham Vohra</dc:creator><description>&lt;p&gt;&lt;p&gt;
okkk...I get it because of the shift registers present...&lt;br /&gt;
Also one more thing how am I supposed to send these 24 bits????...3
dummy bytes one after the other ???&lt;/p&gt;

&lt;p&gt;
It is still not clear to me..please help.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI interface with peripheral devices</title><link>https://community.arm.com/thread/103133?ContentTypeID=1</link><pubDate>Tue, 26 May 2009 05:58:52 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:3a0b1cff-b801-4cdf-a99c-c44cb8d4404d</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
I didn&amp;#39;t actually say that; what I said was,&lt;/p&gt;

&lt;p&gt;
&lt;i&gt;&amp;quot;0xFF is more likely to be appropriate&amp;quot;&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
The reason being that the idle state is usually high - so sending
FF is effectively doing nothing!&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI interface with peripheral devices</title><link>https://community.arm.com/thread/77472?ContentTypeID=1</link><pubDate>Tue, 26 May 2009 05:55:00 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:ae9f6822-dd7d-4076-abe7-b16219b4a45f</guid><dc:creator>Asham Vohra</dc:creator><description>&lt;p&gt;&lt;p&gt;
thanks for ur posts...&lt;/p&gt;

&lt;p&gt;
I wish to interface the microcontroller with ADE7753(which is a
energy metering chip) .&lt;br /&gt;
Yes I checked the examples but generally all examples are for single
byte. I am not able to find any example for more than one byte...&lt;/p&gt;

&lt;p&gt;
&amp;quot;And sending 0xFF will be better&amp;quot;&lt;br /&gt;
Can u tell the reason behind this??&lt;br /&gt;
It will make the concept more clear.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI interface with peripheral devices</title><link>https://community.arm.com/thread/56139?ContentTypeID=1</link><pubDate>Mon, 25 May 2009 00:08:08 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:41e6eade-18de-4b05-885f-1e469dee7daf</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
That&amp;#39;s a pretty common chip, and a very common interface.&lt;/p&gt;

&lt;p&gt;
Have you searched for examples?&lt;/p&gt;

&lt;p&gt;
What peripheral, specifically, are you trying to use?&lt;br /&gt;
Again, have you searched for examples?&lt;/p&gt;

&lt;p&gt;
&lt;i&gt;&amp;quot;send some dummy byte which will be 0s&amp;quot;&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
If you send any dummy bytes, 0xFF is more likely to be
appropriate...&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI interface with peripheral devices</title><link>https://community.arm.com/thread/89763?ContentTypeID=1</link><pubDate>Sun, 24 May 2009 23:54:57 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:2499a2f5-2229-4925-9ec5-8638c663c32d</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
Some implementations may provide a &amp;quot;read-only&amp;quot; SPI function which
provides the clocks without you having to specifically supply some
&amp;quot;dummy&amp;quot; data to write.&lt;/p&gt;

&lt;p&gt;
You have to check the &lt;b&gt;Documentation&lt;/b&gt; for the specific device
that you&amp;#39;re using&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI interface with peripheral devices</title><link>https://community.arm.com/thread/56137?ContentTypeID=1</link><pubDate>Sun, 24 May 2009 22:49:53 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:3f31b584-7412-4d3c-a0e0-de2e18431740</guid><dc:creator>ImPer Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
SPI is always dual-direction (even if the data in one direction is
sometimes ignored) so if the master expects to receive 24 bits of
data from the slave, then it must send out 24 bits to generate all
the clocking for the 24 bits sent in the other direction.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>