Pages: [1]   Go Down
Author Topic: The infamous Max 6954  (Read 942 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 25
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok, I'm stumped...

I have read around on the forums for the answer to this, and I cannot find it.

I have the MAX6954 setup on a SPI collection on the UNO R3.

I have modified the digitalPot example, so that I could use the easy way to write the address and the command.

At the moment I want to send the command to test all the segments of the 16- segment displays.

Withthe help of http://www.maxim-ic.com/app-notes/index.mvp/id/3212, I have got the following code
Code:
// inslude the SPI library:
#include <SPI.h>


// set pin 10 as the slave select for the digital pot:
const int slaveSelectPin = 10;

void setup() {
  // set the slaveSelectPin as an output:
  pinMode (slaveSelectPin, OUTPUT);
  // initialize SPI:
  SPI.begin();
 
  digitalPotWrite(0x07, 0x01);
}

void loop() {
  digitalPotWrite(0x07, 0x01);
  digitalPotWrite(0x02, 0xff);

}

int digitalPotWrite(int address, int value) {
  // take the SS pin low to select the chip:
  digitalWrite(slaveSelectPin,LOW);
  //  send in the address and value via SPI:
  SPI.transfer(address);
  SPI.transfer(value);
  // take the SS pin high to de-select the chip:
  digitalWrite(slaveSelectPin,HIGH);
}

I have tried playing with SPI.setBitOrder() and set MSBFIRST, and LSBFIRST

I have also played with SPI.setMode(), and gone through all of the options...

All of which give nothing on the display., although I have noticed that the mode 3 gives the led on pin 13 lit all of the time dimley.

Has anyone got any ideas on this one?

Everything appears to be wired correcly.

I have also added an LED to the DOUT and it looks like there is output coming through the registers.

I have a serial dump of the address and values which gives me

Code:
7 -1
2 - 255

is there any way I can se the binary representation of what is being transfered?

Many thanks

Jimmy
« Last Edit: March 03, 2012, 06:48:26 pm by manicmoddin » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 25
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

Well I have got it going to some extent, I can now get it to updat 90% of the time, but there does appear to be slight glitch every so often when it issues out commands.

I think this will be down to the max chip not being 100% spi compatible despite what they say.

From what I have read online, these thinks are hard to get working correctly and they will not give the display due to having to take the CS low halfway through a clock pulse.

This is what got me going

Code:
// inslude the SPI library:
#include <SPI.h>


// set pin 10 as the slave select for the digital pot:
const int slaveSelectPin = 10;


void setup() {
 
  // set the slaveSelectPin as an output:
  pinMode (slaveSelectPin, OUTPUT);
  Serial.begin(9600);
  // initialize SPI:
  SPI.begin();
  SPI.setBitOrder(MSBFIRST);
  SPI.setDataMode(SPI_MODE2);
  SPI.setClockDivider(SPI_CLOCK_DIV16); // 2,4,8,16,32,64,128
 
  push(0x07, 0x01);
  delay(1000);
  push(0x07, 0x00);
  delay(100);
  push(0x04, 0x01);
  push(0x03, 0x01);
  push(0x02, 0x0f);

}

void loop() {

  if(Serial.available()) {
    byte incoming = Serial.read();
    push(0x20, incoming);
  }
}

int push(int address, int value) {
  // take the SS pin low to select the chip:
  //digitalWrite(13, LOW);
  //delay(10);
  digitalWrite(slaveSelectPin,LOW);
  //  send in the address and value via SPI:
  SPI.transfer(address);
  SPI.transfer(value);
  // take the SS pin high to de-select the chip:
  digitalWrite(slaveSelectPin,HIGH);
  //delay(5);
  //digitalWrite(13, HIGH);
}

Hope this is of help to someone...

I will also try a bitbang method now to get 100% working

Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I will also try a bitbang method now to get 100% working

Hi manicmoddin!

Did you get somewhere with the MAX6954 using bit-banging?

I'm also kind of stuck with this IC on the Arduino Due.

Thanks
Logged

Miramar Beach, Florida
Offline Offline
Faraday Member
**
Karma: 140
Posts: 5873
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This is not correct.
Code:
SPI.setDataMode(SPI_MODE2);
That device is MSBFIRST and SPI mode 0. CLK LOW with HIGH pulses (CPOL=0) and capture on the first (rising) edge (CPHA=0).
http://datasheets.maximintegrated.com/en/ds/MAX6954.pdf
Page 9.

The Due has its own SPI stuff that seems different from the other Arduinos. That may be a thread for the Due section.
http://forum.arduino.cc/index.php?board=87.0

If the device has problems, I usually use a "delayMicroseconds(1);" after setting the slave select to LOW and before starting the first transfer. Sometimes these devices don't get ready as fast as you think.
« Last Edit: July 01, 2013, 01:56:15 pm by SurferTim » Logged

Pages: [1]   Go Up
Jump to: