vxcheese
Posts: 6
Joined: Fri May 01, 2015 4:56 pm

Help with two spi devices

Sun Jun 28, 2015 9:15 pm

Hey guys,

I'm trying to make a portable Raspberry Pi. I have a TFT screen (tinylcd 3.5 one), and it uses SPI. I also have two analog joysticks I want to hook up, and I have a MCP3008. The MCP3008 requires use of SPI as well. Can someone give me a wiring diagram or something as to how I would go about connecting the two devices successfully?
Cheers!

EDIT: On a Raspberry Pi 2.

ghp
Posts: 1517
Joined: Wed Jun 12, 2013 12:41 pm
Location: Stuttgart Germany
Contact: Website

Re: Help with two spi devices

Mon Jun 29, 2015 4:48 am

Hello,
when I look into the description of this Display/ Touch-Controller, I see that both SPI-chip-selects are used by this hardware.

You could try to emulate the SPI hardware by simple GPIO handling. But the perhaps best way would be to look for an I2C-connected ADC. There are breakouts available for e.g ads1015.

If you have a 3.3V arduino around, then write a small sketch and send the adc values by serial line to the RPi. If price is a constraint,
use a bare atmel328-controller, but this needs some programming skills.

Regards,
Gerhard

vxcheese
Posts: 6
Joined: Fri May 01, 2015 4:56 pm

Re: Help with two spi devices

Mon Jun 29, 2015 2:57 pm

I am using the standard 3.5" display. Not the touch version so it's probably using one port. Also, is there an i2c chip as easy to use as the MCP3008?

User avatar
mikronauts
Posts: 2794
Joined: Sat Jan 05, 2013 7:28 pm
Contact: Website

Re: Help with two spi devices

Mon Jun 29, 2015 4:18 pm

The problem is that the display will use up all (or close to all) SPI bandwidth.

If all you are wanting read is joysticks, just add a PCF8591 I2C 4 channel ADC.
http://Mikronauts.com - home of EZasPi, RoboPi, Pi Rtc Dio and Pi Jumper @Mikronauts on Twitter
Advanced Robotics, I/O expansion and prototyping boards for the Raspberry Pi

Return to “Interfacing (DSI, CSI, I2C, etc.)”