MAX6955 - read register?

OP #5159050
Lesenswert?

https://datasheets.maximintegrated.com/en/ds/MAX6955.pdf

Wird einer von euch schlau daraus, wie man Register lesen kann? Ich 
finde nirgendwo ein Beispiel (ausser bei AVRFreaks, da hatte auch einer 
Probleme, wurde aber auch nicht gelöst.
Letzten Endes will ich die Tasten lesen, aber es funktioniert überhaupt 
keine Leseoperation.

unsigned char readMAX6955 (unsigned char adr)
{unsigned char data;
i2c_start();
i2c_write (MAX6955);    //0xC0
i2c_write (adr);
i2c_start();            //rep. start
i2c_write (MAX6955 | 1);   //read
data=i2c_read (NO_ACK);
i2c_stop();
return data;
}
Gast #5159352
Lesenswert?

So lese ich Register mit der I2C Bibliothek von  Peter Fleury
Bausteinen:
1
  i2c_start((DS3231_I2C_ADDRESS << 1) | I2C_WRITE);
2

3
  // register name
4
  i2c_write(registername);
5

6

7

8

9
  // Restart to read
10
  i2c_start((DS3231_I2C_ADDRESS << 1) | I2C_READ);
11

12
  content = i2c_read(0);//NACK => one byte
13

14
  i2c_stop();
OP #5159400
Lesenswert?

Das ist mehr oder weniger das gleiche, oder? Und so funktionierts mit 
allen mir bekannten I2C-Bausteinen.
Beim MAX6955 funktionierts aber nicht, liefert 0xFF. Blöderweise steht 
im Datenblatt nichts zur Lesefunktion :-( . Wieder mal ein eigenes 
Süppchen gekocht (die SPI von Maxim ist ja manchmal auch was 
eigenartig)?
Habe die jetzt mal angeschrieben.

Schreiben funktioniert, auf der gleichen Platine ist auch ein EEPROM, da 
funktionierts, Hardwarefehler sind also eher auszuschliessen. Auch keine 
Adresskonflikte.

Komischerweise findet sich im ganzen Netz nicht ein Stückchen 
Beispielcode, immer nur die reinen Schreibfunktionen. Scheint keiner die 
Tasten benutzt zu haben.
Gast #5160588
Lesenswert?

Der verlorene Abschnitt


Message Format for Reading
*********************************
The MAX6955 is read using the MAX6955’s internally
stored command byte as address pointer, the same
way the stored command byte is used as address
pointer for a write. The pointer generally autoincrements
after each data byte is read using the same rules as for
a write (Table 6). Thus, a read is initiated by first configuring
the MAX6955’s command byte by performing a
write (Figure 7). The master can now read n consecutive
bytes from the MAX6955, with the first data byte
being read from the register addressed by the initialized
command byte (Figure 9). When performing readafter-write
verification, reset the command byte’s
address because the stored byte address generally is
autoincremented after the write (Table 6).

************************************************************************ 
*
https://web.archive.org/web/20121224060106/https://datasheets.maximintegrated.com/en/ds/MAX6955.pdf
OP #5160618
Lesenswert?

Das war die Antwort von Maxim:
"The read procedure for the MAX6955 registers follows the I2C standard:

1. The master communicates a Start Condition.

2. The master sends the slave address byte with a write bit. Slave 
acknowledges.

3. The master sends a command byte (in the case of the MAX6955, this 
byte is the address of the register that is to be read). Slave 
acknowledges.

4. The master communicates a Repeated Start Condition.

5. The master sends the slave address byte with a read bit. Slave 
acknowledges.

6. The slave sends the data byte from the desired register to be read. 
Master communicates a Not-Acknowledge.

7. The master communicates a Stop condition.

Let me know if you have any additional questions."

Also das übliche procedere, aber genau das klappt beim MAX6955 eben 
nicht. Stellt sich die Frage, was eigentlich Standard ist? Ist die Sache 
mit dem rep. start eine mögliche Verkürzung, die man unterstützen kann 
oder auch nicht?

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren