|
|
View previous topic :: View next topic |
Author |
Message |
thomas Guest
|
Multiple SPI Slave |
Posted: Sun Aug 10, 2003 9:13 pm |
|
|
Hi everyone,
As you know, the PIC has only 1 SPI port. It can send data to multiple slaves. How can I configure it so that it can receive data from multiple slaves?
Regards,
Thomas
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516867 |
|
|
Charlie U Guest
|
Re: Multiple SPI Slave |
Posted: Sun Aug 10, 2003 11:22 pm |
|
|
:=Hi everyone,
:=As you know, the PIC has only 1 SPI port. It can send data to multiple slaves. How can I configure it so that it can receive data from multiple slaves?
:=Regards,
:=Thomas
Check the devices you plan to use. Most, if not all, have a Chip Select input that selects the device when you wish to communicate with it. Just connect these Chip Selects to pins on you PIC and use them to select the proper device at the proper time and you can then use a single SPI interface.
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516868 |
|
|
thomas Guest
|
Re: Multiple SPI Slave |
Posted: Mon Aug 11, 2003 12:24 am |
|
|
I understand this, but my point is, if multiple slaves' SDO outputs are connected to a single Master's SDI input, there will be a conflict. Let's say if slave A finished sending data to the master and its SDO signal is kept low. Now slave B wants to send data to the master, but the Master's SDI input is held low by slave A's SDO signal. Therefore, slave B can't send data to the Master properly.
Regards,
Thomas
:=:=Hi everyone,
:=:=As you know, the PIC has only 1 SPI port. It can send data to multiple slaves. How can I configure it so that it can receive data from multiple slaves?
:=:=Regards,
:=:=Thomas
:=
:=Check the devices you plan to use. Most, if not all, have a Chip Select input that selects the device when you wish to communicate with it. Just connect these Chip Selects to pins on you PIC and use them to select the proper device at the proper time and you can then use a single SPI interface.
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516869 |
|
|
R.J.Hamlett Guest
|
Re: Multiple SPI Slave |
Posted: Mon Aug 11, 2003 3:08 am |
|
|
:=I understand this, but my point is, if multiple slaves' SDO outputs are connected to a single Master's SDI input, there will be a conflict. Let's say if slave A finished sending data to the master and its SDO signal is kept low. Now slave B wants to send data to the master, but the Master's SDI input is held low by slave A's SDO signal. Therefore, slave B can't send data to the Master properly.
:=Regards,
:=Thomas
A 'slave', cannot initiate a transaction. The master does this. The processor enables one slave, talks to it, and gets it's replies. A 'slave' cannot talk, till the master talks to it. The problem you are describing, would only apply on a 'multi-master' system, where you would have to add extra control lines, and protocols to prevent a clash (there have been plenty of discussions of this on the group in the past - a search should find some examples).
Best Wishes
:=:=:=Hi everyone,
:=:=:=As you know, the PIC has only 1 SPI port. It can send data to multiple slaves. How can I configure it so that it can receive data from multiple slaves?
:=:=:=Regards,
:=:=:=Thomas
:=:=
:=:=Check the devices you plan to use. Most, if not all, have a Chip Select input that selects the device when you wish to communicate with it. Just connect these Chip Selects to pins on you PIC and use them to select the proper device at the proper time and you can then use a single SPI interface.
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516874 |
|
|
TSchultz
Joined: 08 Sep 2003 Posts: 66 Location: Toronto, Canada
|
RE: Multiple SPI Slave |
Posted: Mon Aug 11, 2003 6:13 am |
|
|
One other item to make sure of;
Make sure the SPI slave devices you are using have a tri-stated SDO. Not all devices I have used in the past do this but most do.
Assuming that all the devices do have a tri-stated SDO then multiple slaves is simply a matter of connecting them all to the SDI pin on the PIC and then adressing the chip you want to "talk" to. Each slave will have its own chip select pin, make sure only one is selected at a time.
-Troy
:=:=Hi everyone,
:=:=As you know, the PIC has only 1 SPI port. It can send data to multiple slaves. How can I configure it so that it can receive data from multiple slaves?
:=:=Regards,
:=:=Thomas
:=
:=Check the devices you plan to use. Most, if not all, have a Chip Select input that selects the device when you wish to communicate with it. Just connect these Chip Selects to pins on you PIC and use them to select the proper device at the proper time and you can then use a single SPI interface.
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516880 |
|
|
thomas Guest
|
Re: Multiple SPI Slave |
Posted: Mon Aug 11, 2003 1:53 pm |
|
|
Yes, I know that the slave can not initiate a transaction (I think my previous reply was a little misleading). I think what I need to do is to make the SDO of the slaves high-Z so that other slaves can control the SDI line of the master properly.
Regards,
Thomas
:=:=I understand this, but my point is, if multiple slaves' SDO outputs are connected to a single Master's SDI input, there will be a conflict. Let's say if slave A finished sending data to the master and its SDO signal is kept low. Now slave B wants to send data to the master, but the Master's SDI input is held low by slave A's SDO signal. Therefore, slave B can't send data to the Master properly.
:=:=Regards,
:=:=Thomas
:=A 'slave', cannot initiate a transaction. The master does this. The processor enables one slave, talks to it, and gets it's replies. A 'slave' cannot talk, till the master talks to it. The problem you are describing, would only apply on a 'multi-master' system, where you would have to add extra control lines, and protocols to prevent a clash (there have been plenty of discussions of this on the group in the past - a search should find some examples).
:=
:=Best Wishes
:=
:=:=:=:=Hi everyone,
:=:=:=:=As you know, the PIC has only 1 SPI port. It can send data to multiple slaves. How can I configure it so that it can receive data from multiple slaves?
:=:=:=:=Regards,
:=:=:=:=Thomas
:=:=:=
:=:=:=Check the devices you plan to use. Most, if not all, have a Chip Select input that selects the device when you wish to communicate with it. Just connect these Chip Selects to pins on you PIC and use them to select the proper device at the proper time and you can then use a single SPI interface.
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516895 |
|
|
Hans Wedemeyer Guest
|
Re: Multiple SPI Slave |
Posted: Mon Aug 11, 2003 5:50 pm |
|
|
If the slaves are other PIC's that have hardware SPI then you have no problem at all.
The Master will select each slave chicp as it needs to communicate with it.
If you use the SLAVE SELECT pin on each slave then the SDO is controlled by it. If slave is slected the SOD can be O/P if not selected it is HiZ.... no need to mess with doing it yourself.
I did a project earlier this year, one PIC18F talking to 4 PIC16F chips at 10MHz SPI.... works fine...
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516906 |
|
|
thomas Guest
|
Re: Multiple SPI Slave |
Posted: Mon Aug 11, 2003 6:34 pm |
|
|
Thank you for your help! This is exactly what I am looking for!
Regards,
Thomas
:=If the slaves are other PIC's that have hardware SPI then you have no problem at all.
:=The Master will select each slave chicp as it needs to communicate with it.
:=If you use the SLAVE SELECT pin on each slave then the SDO is controlled by it. If slave is slected the SOD can be O/P if not selected it is HiZ.... no need to mess with doing it yourself.
:=
:=I did a project earlier this year, one PIC18F talking to 4 PIC16F chips at 10MHz SPI.... works fine...
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516907 |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|