• Home
    • View
    • Login
    This page
    • Normal
    • Export PDF
    • Page Information

    Loading...
  1. Dashboard
  2. Undefined Space
  3. Device I/O
  4. Setting up and Running SPI Sample (MPC3008)

Setting up and Running SPI Sample (MPC3008)

  • Created by Jen Dority, last modified on Aug 04, 2014

MCP3008 Setup

Connections

MCP3008 PinRasp Pi Signal 
VDD+3.3V 
VREF+3.3V 
AGNDGND 
CLKSCLK 
DOUTMISO 
DINMOSI 
CS /SHDNCE0 
DGNDGND 

 

CH<number> pins get connected to the AnalogOUT of the analog circuits

Analog Circuits

Force-sensitive Resistor

 

Photocell

Potentiometer (Variable Resistor)

Running SPI Sample

First build the dio-spi.jar file:

 

cd samples/spi
ant

 

Then copy ../../build/jar/dio-spi.jar to the board.

(On the Pi/iMX6)
For this example you should have SPIDevice entry in your dio.properties file like this example for the raspberry pi:

 

12 = deviceType: spibus.SPIDevice, name:SPI_Slave, deviceNumber:0, address:0, csActive:1, wordLength:8, clockFrequency:500000, clockMode:1, bitOrdering:1

 

Note that these are the current values in the repo which reflect a recent update. Older dio.peprties versions will not work.

 

sudo $JAVA_HOME/bin/java -Djava.library.path=. -Djava.security.policy=./java.policy -classpath .:./dio.jar:dio-samples.jar:dio-spi.jar -Djdk.dio.registry=./dio.properties -Ddeviceaccess.uart.prefix=/dev/ttyAMA dio.spi.MCP3008Sample 12 4

 

Note that "12" is the device manager ID number of the SPIDevice in the example property line shown above. "4" selects the channel on the MPC3008. You should use the channel number connected to the analog circuit you're trying to read.

Overview
Content Tools
ThemeBuilder
  • No labels

Terms of Use
• License: GPLv2
• Privacy • Trademarks • Contact Us

Powered by a free Atlassian Confluence Open Source Project License granted to https://www.atlassian.com/software/views/opensource-community-additional-license-offer. Evaluate Confluence today.

  • Kolekti ThemeBuilder Powered by Atlassian Confluence 8.5.21
  • Kolekti ThemeBuilder printed.by.atlassian.confluence
  • Report a bug
  • Atlassian News
Atlassian
Kolekti ThemeBuilder EngineAtlassian Confluence
{"serverDuration": 163, "requestCorrelationId": "97220ff87646865a"}