View previous topic :: View next topic |
Author |
Message |
starfire151
Joined: 01 Apr 2007 Posts: 195
|
Master and Slave SPI interfaces on one PIC? |
Posted: Sat Mar 07, 2009 3:41 pm |
|
|
I've checked the code listings but haven't seen anything related to this topic other than I2C interfaces.
Has anyone used a "lower" level PIC (18LFxxx family) with simulataneous Master and Slave SPI ports? I have used the built-in hardware port for connection to an SD card interface successfully but I need to act as an SPI Slave for an upstream device and an SPI Master to some downstream devices.
I know the newer PIC32 devices have multiple SPI (and I2C) hardware ports but that would be overkill for my small application.
Compiler version: 3.249 |
|
|
Ttelmah Guest
|
|
Posted: Sat Mar 07, 2009 3:51 pm |
|
|
For master, software SPI, is easy. If you look at the example files, many of them perform SPI, by simple bit-banging, without making any use of the SPI hardware. The latter (V4) compilers, also allow a software SPI implementation, without having to do the bit-banging yourself. _Slave_, is impossible at faster data rates without the hardware. It can be done at (very) low rates.
Remember also, that one master can drive multiple slave devices, provided you are using a select line on the slaves.
Best Wishes |
|
|
starfire151
Joined: 01 Apr 2007 Posts: 195
|
master/slave spi |
Posted: Sat Mar 07, 2009 4:02 pm |
|
|
Thanks very much for the reply!
I only need the one upstream Slave interface so I will dedicate it to the hardware port of my 18LF2620. I should be able to bit-bang the downstream (Master interface) devices at a slower rate.
Thanks, again, for the response.
Dave |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
|