Jump to content
43oh

SPI - CC3200 Master - TPL0501 Slave


Recommended Posts

Hello all,

I'm having trouble getting my digital pot to respond to the CC3200.  Could someone please take a look at my code and let me know where I'm going wrong? Thanks.

 

DataSheet for the digital pot; http://www.ti.com/product/tpl0501-100

 

#include <SPI.h>
 
const int SS = 8;
uint8_t value;
int volts = 0;
void setup()
{
  Serial.begin(9600);
  pinMode(SS, OUTPUT);
  SPI.begin();
  delay(100);
}
 
void loop()
{
  for(value = 0; value < 256; value += 20)
  {
  digitalWrite(SS, LOW);
  delay(10);
  SPI.transfer(value);
  delay(10);
  digitalWrite(SS,  HIGH);
  delay(100);
  }
}
 
Link to post
Share on other sites

Something like this?

 

The data sheet says that the digipot is write only:

 

8bit   -   MSBFirst   -  CS~ low to enable write   -   24MHZ max clock

 

That would be SPI_MODE1 as I understand it, right?

And divide by 4 should reduce the 80MHZ CC3200 clock to a 20MHZ which is below the digipot max.

 

  

#include <SPI.h>
 
const int SS = 8;
uint8_t value;
void setup()
{
  pinMode(SS, OUTPUT);
  digitalWrite(SS, HIGH);
  SPI.setBitOrder(MSBFIRST);
  SPI.setDataMode(SPI_MODE1);
  SPI.setClockDivider(SPI_CLOCK_DIV4);
  SPI.begin();
  delay(100);
}
 
void loop()
{
  for(value = 0; value < 256; value += 20)
  {
  digitalWrite(SS, LOW);
  delay(10);
  SPI.transfer(value);
  delay(10);
  digitalWrite(SS,  HIGH);
  delay(100);
  }
}
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...