Go Down

Topic: MAX6954: Anyone Have Any Luck With Inferfacing With Arduino? (Read 876 times) previous topic - next topic

codlink

I have a few 6954s and read a ton of articles about how hard it is to get the communication through SPI to work correctly using this chip.  Was wondering if anyone has played with it.
//LiNK

JoeN


I have a few 6954s and read a ton of articles about how hard it is to get the communication through SPI to work correctly using this chip.  Was wondering if anyone has played with it.


The answer is no, but I just did a bit of research on this and the problem is that the MAX6954 expects the clock pin to be handled in a way that is incompatible with the way Atmel processors or Arduino do SPI (not sure which).  From the datasheet:

Quote from: Maxim Integrated, Inc.

The MAX6954 is written to using the following sequence:
1) Take CLK low.
2) Take CS low. This enables the internal 16-bit shift register.
3) Clock 16 bits of data into DIN, D15 first to D0 last, observing the setup and hold times. Bit D15 is low, indicating a write command.
4) Take CS high (while CLK is still high after clocking in the last data bit).
5) Take CLK low.


Specifically, the SPI library takes CLK low before you can take CS high.   This is inconvenient, but hardly a show-stopper.  If you read the datasheet, know what the device expects, and control the lines yourself manually, you can make this happen.  There are only three lines here to work your magic on.  This is called bit-banging and it works just fine (I have used it on the MAX7219 and TLC5940, not to mention 74HC595s).  The chip on the other side has no idea you are doing it in software rather than using the SPI hardware in the processor and wouldn't care anyway.
I have only come here seeking knowledge. Things they would not teach me of in college.

Grumpy_Mike

Quote
The answer is no, but I just did a bit of research on this and the problem is that the MAX6954 expects the clock pin to be handled in a way that is incompatible with the way Atmel processors or Arduino do SPI

Well there was a site in German where someone had made a chess board with an arduino and a MAX6954 chip, but when I checked it now it seems to have changed and there is no mention of the chip on that page. That site put me onto this chip in the first place. I have some samples but have not used them in a project yet. The page used to be at:-
http://www.andreadrian.de/schach/#Selbstbau_Schachcomputer_SHAH

Google showed this:-
https://gist.github.com/1176125

Then there is an unresolved thread on this forum.
http://arduino.cc/forum/index.php/topic,12946.0.html

codlink


Well there was a site in German where someone had made a chess board with an arduino and a MAX6954 chip, but when I checked it now it seems to have changed and there is no mention of the chip on that page. That site put me onto this chip in the first place. I have some samples but have not used them in a project yet. The page used to be at:-
http://www.andreadrian.de/schach/#Selbstbau_Schachcomputer_SHAH


Wow, that's one hell of a post..  


Google showed this:-
https://gist.github.com/1176125


Yes found that as well, and got me thinking it could work.  I really haven't been through the code line by line yet, but will go over it and take out what I don't need.  Maybe I can get something happening.  


Then there is an unresolved thread on this forum.

http://arduino.cc/forum/index.php/topic,12946.0.html


Read that one as well, wondering why they stopped working on it...  

I think I may pursue this a little harder and see what I can come up with.  Maybe make a library to support it.
//LiNK

pklaus

#4
Jul 01, 2013, 07:35 pm Last Edit: Jul 01, 2013, 07:58 pm by pklaus Reason: 1
Hi everyone! I was also trying to get the MAX6954 working on the Arduino. Especially on the Arduino Due. To me it seems to be impossible with the builtin SPI routines. In the following example, the very first command being sent is fine (switching on the display test mode) but the next one is not accepted anymore:

Code: [Select]
#include <SPI.h>

// SPI on Arduino Due:   MOSI    MISO    SCK     SS
//                       ICSP-4  ICSP-1  ICSP-3  4,10,52
#define CS   52

void setup() {
 SPI.begin(CS);
 SPI.setClockDivider(CS, 84);
 SPI.setBitOrder(MSBFIRST);
 SPI.setDataMode(SPI_MODE0);
 
 // Enabling Display Test Mode
 SPI.transfer(CS, 0x07, SPI_CONTINUE);
 SPI.transfer(CS, 0x01);

 // Disabling Display Test Mode
 SPI.transfer(CS, 0x07, SPI_CONTINUE);
 SPI.transfer(CS, 0x00);
}

void loop() {
}


I think the reason is the strange timing behaviour of the chip. The MAX6954 expects the CLK to be low before CS goes low but afterwards the CLK should be high before CS goes high (see it's datasheet). That's just strange. I attached a measurement done with my Open Bench Logic Sniffer logic analyzer. It shows the behaviour of the code above. It reveals that the CLK is low when when CS changes to low as well as when CS changes to high as you would expect for a normal SPI device.

I don't want to implement the device using bit-banging. I'll check out the MAX6955 (which doesn't come as DIP :( ) and try to use its I2C bus.

I don't understand how Anthony DiGirolamo got it working with the Arduino (see [1] and [2]) (without implementing bit-banging mode!).

Here are links to similar problems: A discussion also describing the timing problem and some PIC code for the MAX6954 obviously also non-working.

myPinballs


Hi everyone! I was also trying to get the MAX6954 working on the Arduino. Especially on the Arduino Due. To me it seems to be impossible with the builtin SPI routines. In the following example, the very first command being sent is fine (switching on the display test mode) but the next one is not accepted anymore:

Code: [Select]
#include <SPI.h>

// SPI on Arduino Due:   MOSI    MISO    SCK     SS
//                       ICSP-4  ICSP-1  ICSP-3  4,10,52
#define CS   52

void setup() {
 SPI.begin(CS);
 SPI.setClockDivider(CS, 84);
 SPI.setBitOrder(MSBFIRST);
 SPI.setDataMode(SPI_MODE0);
 
 // Enabling Display Test Mode
 SPI.transfer(CS, 0x07, SPI_CONTINUE);
 SPI.transfer(CS, 0x01);

 // Disabling Display Test Mode
 SPI.transfer(CS, 0x07, SPI_CONTINUE);
 SPI.transfer(CS, 0x00);
}

void loop() {
}


I think the reason is the strange timing behaviour of the chip. The MAX6954 expects the CLK to be low before CS goes low but afterwards the CLK should be high before CS goes high (see it's datasheet). That's just strange. I attached a measurement done with my Open Bench Logic Sniffer logic analyzer. It shows the behaviour of the code above. It reveals that the CLK is low when when CS changes to low as well as when CS changes to high as you would expect for a normal SPI device.

I don't want to implement the device using bit-banging. I'll check out the MAX6955 (which doesn't come as DIP :( ) and try to use its I2C bus.

I don't understand how Anthony DiGirolamo got it working with the Arduino (see [1] and [2]) (without implementing bit-banging mode!).

Here are links to similar problems: A discussion also describing the timing problem and some PIC code for the MAX6954 obviously also non-working.


Did you get any further with this? I am tearing my hair out with this damn chip. I to cannot understand how Anthony got his project to work perfectly? I cannot get anything displayed at all on my test breadboard (1 chip , 2 16 segment alpha digits). I have tried using the hardware serial SPI approach and creating a software approach.

Go Up