SPI-Driver_quick2wire_chip-select

135 views
Skip to first unread message

Peter

unread,
Aug 13, 2013, 7:47:12 AM8/13/13
to quick2wi...@googlegroups.com

Hi!

I’ve got a question concerning the spi chip-select.
I want to connect more than two spi-modules with the Raspberry Pi.
Is it possible to use normal GPIO-Pins for Chip-Select? Raspberry has got only two...
And if it is possible, how do I have to change the quick2wire-spi driver?
 
Thanks a lot!
 
Greets,
Peter

Geoff Drake

unread,
Aug 13, 2013, 8:08:39 AM8/13/13
to quick2wi...@googlegroups.com
Hi Peter

If you want to connect 4 or less devices you could implement a 2-4 decoder, and yes you could use the GPIO lines.

I have not looked at the spi code, so I do not know what changes would need to be made.

Cheers
Geoff
--
You received this message because you are subscribed to the Google Groups "Quick2Wire Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to quick2wire-use...@googlegroups.com.
Visit this group at http://groups.google.com/group/quick2wire-users.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Andrew Scheller

unread,
Aug 13, 2013, 8:26:16 AM8/13/13
to quick2wi...@googlegroups.com
I just had a look at
https://github.com/quick2wire/quick2wire-python-api/blob/master/quick2wire/spi.py
and all the __init__ function does is:
self.fd = posix.open("/dev/spidev%i.%i"%(bus,chip_select), posix.O_RDWR)
so it's the spidev driver that would need to be changed, not the
quick2wire code.

I did a quick google, and this comment confirms that it's the kernel
driver that would need to be modified:
https://projects.drogon.net/understanding-spi-on-the-raspberry-pi/#comment-582

It looks like the kernel SPI driver is in
https://github.com/raspberrypi/linux/blob/rpi-3.6.y/arch/arm/mach-bcm2708/bcm2708.c
with the low-level SPI controller documented in the BCM2835 'datasheet'
http://elinux.org/RPi_Hardware#Components

However (and I don't know very much about SPI here, so I'm just
guessing) maybe you could always write to SPI channel 0, but then
ignore the built-in chip-select lines, and do the multiple
chip-selects you need yourself with regular GPIOs? (You'd obviously
need to ensure that you didn't accidentally enable two different chips
at once)

Andrew

Peter

unread,
Aug 13, 2013, 8:40:26 AM8/13/13
to quick2wi...@googlegroups.com
Hi Guys!
 
Thanks for your quick response!
I will continue searching, but nevertheless I now know what I have to search for ;)
 
Peter
Reply all
Reply to author
Forward
0 new messages