Question about SPI
#1
Posted 03 January 2011 - 12:05 AM
#2
Posted 03 January 2011 - 12:12 AM
#3
Posted 03 January 2011 - 12:19 AM
What are the differences between SPI and the other thing that uses TX and RX? I understand that SPI has a clock so the shift register (lets use that as an example) knows when to read the other pin for a HIGH or LOW. but then how does the TX and RX communicate? how does it know when to get the data? Are they both Serial types of communication or not? Any info is appreciated, links are good too. Thanks!
I don't know how much time you have to read stuff, and we could spend a lot of time asking and answering questions so I thought that it may be helpful to supply you with a link to the Wikki page that describes SPI. This may be way more than you wanted to know but there are nuances to using SPI that are not immediately apparent and which many of us take for granted. So here is the Wikki link ( and yes I read it and it is a good description on Jan 2, 2010 You know how Wikkipedia can be )
http://en.wikipedia....l_Interface_Bus
#4
Posted 03 January 2011 - 12:25 AM
Tx and Rx are used for Asynchronous Serial communication which is sometimes described as "self clocking". This is misleading to most users in that the data rate must generally be agreed upon before hand as Chris has stated, the selfclocking come from the method for detecting the begining of the data octet or byte. Here is the Wikkipedia page that describes this http://en.wikipedia....ver/transmitter as before I can only vouch for the correctness as of Jan 2, 2010 when I read it.What are the differences between SPI and the other thing that uses TX and RX? I understand that SPI has a clock so the shift register (lets use that as an example) knows when to read the other pin for a HIGH or LOW. but then how does the TX and RX communicate? how does it know when to get the data? Are they both Serial types of communication or not? Any info is appreciated, links are good too. Thanks!
If I had a choice, I would use SPI over TX/RX because it is easier for me to use. If available and if the distance is not too great I would prefer I2C over SPI.
Edited by klotz, 03 January 2011 - 12:28 AM.
#5
Posted 03 January 2011 - 01:47 AM
Could you break this down a bit more? Distance being what? If I have a central Netduino in the house, and several scattered around the property, what's the prefered for 50 -200 ft, CAT5 cable?
#6
Posted 03 January 2011 - 02:03 AM
If I have a central Netduino in the house, and several scattered around the property, what's the prefered for 50 -200 ft, CAT5 cable?
The preferred method there is TCP/IP networking
Chris
#7
Posted 03 January 2011 - 03:28 PM
If available and if the distance is not too great I would prefer I2C over SPI.
Could you break this down a bit more? Distance being what? If I have a central Netduino in the house, and several scattered around the property, what's the prefered for 50 -200 ft, CAT5 cable?
I would not use I2C or SPI for those distances. In the first case, one should not think of I2C or SPI as a protocol for anything say outside the box. Both are intended for communication between ICs or small peripherals, like ethernet chips, lCD displays and the like.
If I have to go more than a couple of feet, then I would start to concider one of the interconnect serial protocols like Async (TTL, RS232, or RS485.)
Then if we are in the range of Room to Room or greater I would concider ethernet.
So in answer to you direct question. At 50-200ft, especially if you have already installed CAT5, go ethernet. The shields for 'duinos are cheap and .NETMF makes it easy to program.
#8
Posted 03 January 2011 - 04:16 PM
#9
Posted 04 January 2011 - 02:46 AM
#10
Posted 04 January 2011 - 02:51 AM
#11
Posted 09 January 2011 - 07:51 PM
I use this code to setup the spi for the nokia 5100 screen I am using.
SPI.Configuration spiConfiguration = new SPI.Configuration( latch, false, // IC is accessed when chip select is low 0, // setup time 0 ms 0, // hold chip select 0 ms after transfer false, // clock line is low if device is not selected true, // data is sampled at leading edge of clock 2000, SPI.SPI_module.SPI1 );I was wondering what the clock rate number that I put in translates to.... Like I have 2000 there, what is that in Hertz? It says kHz so is that 2 MHz? or something else?
also how do I go convert something like 4 Mega bits per second to Herts?
Thanks
#12
Posted 09 January 2011 - 09:08 PM
Yes, 2000 kHz = 2 MHz.Like I have 2000 there, what is that in Hertz? It says kHz so is that 2 MHz?
In case of SPI the value of bitrate (data transfer speed) equals to clock frequency, because it requires one clock pulse to transfer one bit (there is no protocol overhead). Thus, to achieve bit rate of 4 MHz, you need the clock to run at 4 MHz.also how do I go convert something like 4 Mega bits per second to Hertz?
#13
Posted 09 January 2011 - 10:15 PM
Yes, 2000 kHz = 2 MHz.
In case of SPI the value of bitrate (data transfer speed) equals to clock frequency, because it requires one clock pulse to transfer one bit (there is no protocol overhead). Thus, to achieve bit rate of 4 MHz, you need the clock to run at 4 MHz.
I've gone up to 9500 successfully with that screen, but normally set it to 4000 (per the datasheet).
#14
Posted 09 January 2011 - 10:42 PM
Great I was running it at half the speed! Now it should have a much faster refresh rate right?I've gone up to 9500 successfully with that screen, but normally set it to 4000 (per the datasheet).
#15
Posted 09 January 2011 - 11:01 PM
Great I was running it at half the speed! Now it should have a much faster refresh rate right?
I have not noticed much difference...it is only 504 bytes that is moving. I imagine that the liquid crystal phase change in going to be the limiting factor.
#16
Posted 09 January 2011 - 11:39 PM
Yeah I've noticed that it takes a little time fading out... oh well, it still runs pretty wellI imagine that the liquid crystal phase change in going to be the limiting factor.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users