Other Parts Discussed in Thread: BUF16821
Hello
My customer using the same platform, same read/write way, reading four out terminal, just only first one data is correct , what could it be happen ?
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hello
My customer using the same platform, same read/write way, reading four out terminal, just only first one data is correct , what could it be happen ?
Hi Fandy,
i have notified our expert regarding this topic. Please expect a response by 6/12/19.
Thanks,
Aaron
Hi Fandy,
Got couple of questions:
- Is this a write to DAC registers or EEPROM?
- Is this an immediate write to DAC register or not? ( D15=1 or 0 )
-The issue is the read back? That's a DAC output voltage issue, or just a read back issue?
What I understood:
- After power on the routine write to DAC register 0 to 3 "376hex" and reads back:
-OUT1: 0x376( correct )
-OUT2:0x2ff ( wrong)
- OUT3:0x001(wrong)
-OUT4:0x2ff(wrong)
Does it happened with multiple parts or just 1?
Thanks,
Costin
Hi Costin
thanks,Please see below answer from customer
- Is this a write to DAC registers or EEPROM? ---A:EEPROM
- Is this an immediate write to DAC register or not? ( D15=1 or 0 ) --- A: D15:0; D14:1
-The issue is the read back? That's a DAC output voltage issue, or just a read back issue? --- A: just a read back issue, Actual outpu voltage is OK.
What I understood:
- After power on the routine write to DAC register 0 to 3 "376hex" and reads back:
-OUT1: 0x376( correct )
-OUT2:0x2ff ( wrong)
- OUT3:0x001(wrong)
-OUT4:0x2ff(wrong)
Does it happened with multiple parts or just 1? --- A:multiple parts
//--------------------------------
//Read DAC source code as follows,is it OK?
...
for(i=0; i<4; i++) //Read out1~4
{
CTP_I2C_WriteDat_BUF16821(0x40|addr[i]); // not sure is correct??
buf = CTP_I2C_ReadDat_BUF16821(addr[i]);
printf("\n gamma dat[%d]= 0x%x;",i,buf);
Delay_ms(50);
}
...
//--------------------------------------
uint8_t CTP_I2C_WriteDat_BUF16821(uint8_t dat)
{
I2C_Start();
I2C_Send_Byte(0x74<<1);
if(I2C_Wait_Ack())
{
I2C_Stop();
return 1;
}
I2C_Send_Byte(dat);
if(I2C_Wait_Ack())
{
I2C_Stop();
return 1;
}
I2C_Stop();
return 0;
}
...
//-----------------
uint16_t CTP_I2C_ReadDat_BUF16821(uint8_t reg)
{
uint8_t tmp1,tmp2;
uint16_t tmp;
I2C_Start();
I2C_Send_Byte(0x74<<1);
if(I2C_Wait_Ack())
{
I2C_Stop();
return 1;
}
I2C_Send_Byte(reg);
if(I2C_Wait_Ack())
{
I2C_Stop();
return 1;
}
I2C_Start();
I2C_Send_Byte((0x74<<1)|0x01);
if(I2C_Wait_Ack())
{
I2C_Stop();
return 1;
}
tmp1=I2C_Read_Byte();
I2C_Ack();
tmp2=I2C_Read_Byte();
I2C_NAck();
tmp = tmp1&0x03;
tmp = (tmp<<8) + tmp2;
I2C_Stop();
return tmp;
}
Hi Fandy,
Seems to me an iteration issue. My suggestion is to check the read back first without register iteration.
Instead of staring from dat[0] to dat[3] do just a singe read for each register.
Does it failed in this condition?
Another test is to change the register iteration range, instead of 0-3, do a 1-3 or 1-4
Regards,
Costin
Hi Costin:
Thanks for your help.
//----------------------test mode1:
{
buf = CTP_I2C_ReadDat_BUF16821(0x01);
printf("\n Read 0x01 = 0x%x;",buf);
buf = CTP_I2C_ReadDat_BUF16821(0x00);
printf("\n Read 0x00 = 0x%x;",buf);
}
UART Print:
Read 0x01 = 0x2ff;
Read 0x00 = 0x1;
//----------------------test mode2:
{
buf = CTP_I2C_ReadDat_BUF16821(0x00);
printf("\n Read 0x00 = 0x%x;",buf);
buf = CTP_I2C_ReadDat_BUF16821(0x01);
printf("\n Read 0x01 = 0x%x;",buf);
}
UART Print:
Read 0x00 = 0x376;
Read 0x01 = 0x2ff;
//--------------
Result: just test mode2 first output is correct
============================================
my question:
as BUF16821 DS page14 describtion:
"To read the data present in nonvolatile register for a particular DAC/VCOM channel, the master must first issue a general acquire command, or a single acquire command with the appropriate DAC/VCOM channelchosen."
can you give me an example code? (Email: guicai_wang2@tianma.cn)
Thanks a lot.
Dear Costin:
i find another issue:
if write dat "0x2ea" to NV 0x00 address,the read dat is not correct:
//-----------------
addr[0]=0x00;
dat[0]=0x2ea;
CTP_I2C_WriteReg_BUF16821(addr[0],0x4000|dat[0]);
buf = CTP_I2C_ReadDat_BUF16821(addr[0]);
printf("\n gamma dat[0]= 0x%x;",buf);
UART Print: gamma dat[0]= 0x2ff;
//----------------
change the write dat "0x300",and write to the NV same address,the read dat is OK:
//---------------
addr[0]=0x00;
dat[0]=0x300;
CTP_I2C_WriteReg_BUF16821(addr[0],0x4000|dat[0]);
buf = CTP_I2C_ReadDat_BUF16821(addr[0]);
printf("\n gamma dat[0]= 0x%x;",buf);
UART Print: gamma dat[0]= 0x300;
//--------------
I do not know WHY?
Hi
The number of write to NV should not exceed 16
I’ll get back to you next week, this week I don’t have
data sheet access
Regards,
Costin
Hi Fandy,
For one register you need "single acquire command", "general acquire command" is needed for multiple registers
If you exceeded the max numbers of write-16, the NVM will stop working correctly.
I'll close this thread, lets continue thru e-mail, please send me details at:
Regards,
Costin