How to Distinguish Rev1B and Rev1C Using Read Status
We are considering a method to distinguish between Rev1B (ST7528) and Rev1C (ST75160) via software.
We attempted to use the "Read Status" parameter over I2C communication for identification. However, both the ST7528 and ST75160 seem to fail when attempting to execute Read Status properly.
We have reviewed the datasheets for each device, but the description of the read sequence is difficult to interpret. Could you please provide the correct and detailed procedure?
The following is our current assumption of the read sequence. Are there any mistakes?
If possible, we would appreciate sample code for each device.
"NHD-C160100DiZ_Rev1B (ST7528)"
-
Start
-
Send Slave Address + R/W = 1 (0x7F), then receive ACK
-
Send Control Byte: C0 = 0, A0 = 0 (0x00), then receive ACK
-
Receive 1 byte of status, then send ACK
-
Stop
"NHD-C160100DiZ_Rev1C (ST75160)"
-
Start
-
Send Slave Address + R/W = 0 (0x7E), then receive ACK
-
Send Control Byte: C0 = 0, A0 = 0 (0x00), then receive ACK
-
Send Read Register Mode command: 0x7C or 0x7D, then receive ACK
-
Stop
-
Start
-
Send Slave Address + R/W = 1 (0x7F), then receive ACK
-
Send Control Byte: C0 = 0, A0 = 0 (0x00), then receive ACK
-
Receive 1 byte of status, then send ACK
-
Hi Hiroki,
To my knowledge, the ST7528 IC does not support read operations over I2C. The read functionality is only supported by the SPI and parallel interfaces, which are not brought out to the FPC.
However, the ST75160 IC should support read and write operations in I2C mode. We unfortunately do not have example code for read functionality, but you may refer to the protocol shown below. Your sequence appears mostly correct, but please note that R/W bit is set to 1 in read mode.
0 -
Hi,
Based on your advice, I tried various approaches, but I haven't been able to get it working at all.
Initialization and WriteData seem to be working fine, but I can't read any data from the ST75160.My goal is simply to successfully read valid data from the ST75160.
I would appreciate it if you could provide a working example code specifically for ReadData — not for Read Status, but for Read Data.
No matter how many times I read the datasheet, there are still many unclear points, and I can't fully understand the correct sequence. For example, in section 9.2.11 "Read Data", it mentions a "pre-instruction", but it doesn't specify what that actually is.
I'm really struggling with this.
0 -
Hi Hiroki,
Unfortunately, we do not currently have the resources to develop and verify new example code for I2C Read Data functionality with the ST75160.
We understand that the ST75160 datasheet can be ambiguous, and while read capability appears to be supported in I2C mode, it is not commonly used in most applications.
Given these limitations, would it be acceptable to explore alternative methods of distinguishing between the two versions without relying on a read function? A hardware-based workaround might be more practical.
If a read-based solution is essential for your application, we recommend reaching out to Sitronix for further support. If we’re able to allocate resources in the future, we will revisit the possibility of developing example code for this functionality.
0 -
Thank you for your response and for the clarification regarding the I2C read functionality of the ST75160.
To clarify, we are not strictly insisting on using the "read" function.
Our goal is to identify whether the connected display is an ST7528 or ST75160 through software, without modifying the existing hardware configuration. Based on that identification, we aim to automatically run the appropriate display software.We would like to avoid having to visually confirm the display’s operation and manually adjust the circuit or firmware accordingly, as this would significantly reduce maintainability and scalability.
If you have any suggestions for achieving this goal—whether through a hardware-based workaround or another method not involving I2C read—we would greatly appreciate your guidance.
For your reference, we have already contacted Sitronix directly, but unfortunately have not received any response.
If there is any possibility that your company could follow up with Sitronix or help facilitate support from them, we would be sincerely grateful.Thank you very much for your time and support. We look forward to your advice.
0 -
Hi Hiroki,
Unfortunately, I cannot think of a reliable method that would detect which display version is connected, unless the I2C read function is implemented.
One hardware-level difference I’m aware of is that certain pin combinations measure different resistance values between the two revisions. However, I'm not sure how practical or repeatable it would be to use that as a detection method in the field.
Given that Sitronix has not yet responded, I understand the challenge. While we don't have direct lines to Sitronix ourselves, we will explore whether there are any channels through which we might be able to help you obtain a more definitive answer.
As a potential workaround, would it be feasible for your production line to visually verify the display revision during assembly and load the proper firmware based on the visual check?
0 -
Thank you for your response.
We would like to avoid relying on visual inspection during assembly to determine the display revision and switch the firmware accordingly. That is precisely why we are reaching out for clarification on how to perform a ReadStatus or ReadData operation, which we hope could enable us to detect the display version programmatically.
For example, do you have any sample code that performs ReadData or ReadStatus via I²C using any Sitronix IC?
I believe the procedure would be similar, so such a sample might still be useful as a reference for working with the ST75160.We truly appreciate your support and any assistance you can offer in helping us obtain a more definitive answer.
0 -
Hello Hiroki,
Please try using the below code as a reference for read functionality.
// I2C bit-banging macros using GPIO pins
#define iic_start() SDA = 1; SCL = 1; _nop_(); SDA = 0; _nop_(); SCL = 0 // I2C start condition
#define iic_stop() SDA = 0; SCL = 1; _nop_(); SDA = 1; _nop_() // I2C stop condition
#define iic_ack(X) SDA = (X) & 0x01; _nop_(); SCL = 1; _nop_(); SCL = 0 // Send ACK (0) or NACK (1)
// Send 1 byte over I2C and wait for ACK
void iic_send_byte(unsigned char wdata)
{
unsigned char bit_cnt;
for (bit_cnt = 0; bit_cnt < 8; bit_cnt++)
{
// Send MSB first
SDA = (wdata & 0x80) ? 1 : 0;
wdata <<= 1;
delay_10uS(); // Setup time
SCL = 1; // Clock high
delay_10uS(); // Hold time
SCL = 0; // Clock low
}
delay_10uS();
// Release SDA for ACK bit from slave
SDA = 1;
SCL = 1;
delay_10uS();
// Configure SDA as open-drain (input mode)
// P2MDOUT bit 7 controls SDA line
P2MDOUT = 0xFC & 0x7F;
// Wait for slave to pull SDA low (ACK)
while (SDA);
SDA = 0;
// Restore SDA to push-pull output
P2MDOUT = 0xFF & 0x7F;
SCL = 0;
}
// Receive 1 byte over I2C
unsigned char iic_recv_byte(void)
{
unsigned char bit_cnt;
unsigned char rdata = 0;
SDA = 1; // Release SDA
// Set SDA as input (open-drain)
P2MDOUT = 0xFC & 0x7F;
for (bit_cnt = 0; bit_cnt < 8; bit_cnt++)
{
SCL = 0;
delay_10uS();
SCL = 1;
delay_10uS();
// Read MSB first
rdata <<= 1;
if (SDA == 1) rdata |= 1;
delay_10uS();
}
SCL = 0;
// Restore SDA to push-pull output
P2MDOUT = 0xFF & 0x7F;
return rdata;
}
// Send command and read 1 byte of data from ST75160i
unsigned char ST75160i_Read(unsigned char cmd)
{
unsigned char rdata;
iic_start();
iic_send_byte(0x7E); // Write address for ST75160i (SA0=SA1=1)
iic_send_byte(0x00); // Control byte (Co=0, A0=0)
iic_send_byte(cmd); // Send command byte
iic_stop();
iic_start();
iic_send_byte(0x7F); // Read address for ST75160i (SA0=SA1=1)
iic_send_byte(0x00); // Control byte (Co=0, A0=0)
rdata = iic_recv_byte(); // Read one byte
iic_ack(1); // Send NACK
iic_stop();
return rdata;
}
// Main application
void main(void)
{
static unsigned char i = 0;
Init_Device(); // MCU peripheral initialization
LCD_intal(); // LCD initialization
// Set Vop (operating voltage) = 11.6V (0x0308)
WriteCommand(0x81);
WriteData(0x08);
WriteData(0x03);
// Test reads from registers 0x7D and 0x7C
ST75160i_Read(0x7D);
ST75160i_Read(0x7C);
}0
Please sign in to leave a comment.
Comments
7 comments