Hi there.

This is my first post on this forum, so I would like to say hello to everyone. Also, I want to express my gratitude to Rudolph for his amazing work. Big thanks for that!
I'm using RVT101HVBNWC00-B with BT817Q:
Sometimes i have strange calibration matrix value, only with 0 or 65535 values:
TransMatrix1 = 65536;
TransMatrix2 = 0;
TransMatrix3 = 0;
TransMatrix4 = 0;
TransMatrix5 = 65536;
TransMatrix6 = 0;
Sometimes it works well, other times it doesn't. This is my source code:
void restore_calibrate_matrix(void)
{
uint32_t TransMatrix[6];
eeprom_busy_wait();
TransMatrix[0] = eeprom_read_dword(&TransMatrix1);
// check if eeprom is emptyi 0xFFFFFFFF = 2^32 = 4294967295
if(TransMatrix[0] == 0xFFFFFFFF || is_clear(CALIBRATE_PIN,CALIBRATE))
{
//
Touch_Panel_Calibrate();
}
// jesli zapisane bylo cos innego niz fabryczna wartosc to pobierz reszte
else
{
char buff[20];
uart0_puts_P(PSTR("\rTransMatrix[0] = "));
uart0_puts(ultoa(TransMatrix[0],buff,10));
eeprom_busy_wait();
TransMatrix[1] = eeprom_read_dword(&TransMatrix2);
eeprom_busy_wait();
TransMatrix[2] = eeprom_read_dword(&TransMatrix3);
eeprom_busy_wait();
TransMatrix[3] = eeprom_read_dword(&TransMatrix4);
eeprom_busy_wait();
TransMatrix[4] = eeprom_read_dword(&TransMatrix5);
eeprom_busy_wait();
TransMatrix[5] = eeprom_read_dword(&TransMatrix6);
eeprom_busy_wait();
EVE_memWrite32(REG_TOUCH_TRANSFORM_A, TransMatrix[0]);
EVE_memWrite32(REG_TOUCH_TRANSFORM_B, TransMatrix[1]);
EVE_memWrite32(REG_TOUCH_TRANSFORM_C, TransMatrix[2]);
EVE_memWrite32(REG_TOUCH_TRANSFORM_D, TransMatrix[3]);
EVE_memWrite32(REG_TOUCH_TRANSFORM_E, TransMatrix[4]);
EVE_memWrite32(REG_TOUCH_TRANSFORM_F, TransMatrix[5]);
//disp_transMatrix(TransMatrix);
}
}
//
void Touch_Panel_Calibrate(void)
{
uint32_t TransMatrix[6];
EVE_cmd_dl(CMD_DLSTART); // Start the display list
EVE_cmd_dl(CMD_COLDSTART);
EVE_cmd_dl(DL_CLEAR_RGB | GRAY);
EVE_cmd_dl(DL_CLEAR | CLR_COL | CLR_STN | CLR_TAG); // Clear the screen - this and the previous prevent artifacts between lists
make_bigger_fonts();
char txt[50];
strcpy_P(txt,PSTR("Dotknij wskazane\npunkty na ekranie")); // in english "touch the indicated points"
EVE_cmd_text((EVE_HSIZE/2),(EVE_VSIZE/2), 3, EVE_OPT_CENTER, txt);
EVE_cmd_calibrate();
EVE_cmd_dl(DL_DISPLAY); // Instruct the graphics processor to show the list
EVE_cmd_dl(CMD_SWAP); // Make this list active
while(EVE_busy() == 1);
TransMatrix[0] = EVE_memRead32(REG_TOUCH_TRANSFORM_A);
TransMatrix[1] = EVE_memRead32(REG_TOUCH_TRANSFORM_B);
TransMatrix[2] = EVE_memRead32(REG_TOUCH_TRANSFORM_C);
TransMatrix[3] = EVE_memRead32(REG_TOUCH_TRANSFORM_D);
TransMatrix[4] = EVE_memRead32(REG_TOUCH_TRANSFORM_E);
TransMatrix[5] = EVE_memRead32(REG_TOUCH_TRANSFORM_F);
save_matrix(TransMatrix);
disp_transMatrix(TransMatrix);
uart0_send_trans_matrix(TransMatrix);
}
//
void save_matrix(uint32_t *TransMatrix)
{
// eeprom write -> update block :))
eeprom_busy_wait();
eeprom_write_dword(&TransMatrix1, TransMatrix[0]);
eeprom_busy_wait();
eeprom_write_dword(&TransMatrix2, TransMatrix[1]);
eeprom_busy_wait();
eeprom_write_dword(&TransMatrix3, TransMatrix[2]);
eeprom_busy_wait();
eeprom_write_dword(&TransMatrix4, TransMatrix[3]);
eeprom_busy_wait();
eeprom_write_dword(&TransMatrix5, TransMatrix[4]);
eeprom_busy_wait();
eeprom_write_dword(&TransMatrix6, TransMatrix[5]);
eeprom_busy_wait();
}
//
void disp_transMatrix(uint32_t *TransMatrix)
{
uint8_t i = 6;
page_start();
uint16_t y = EVE_VSIZE/2; // połowa ekranu
uint8_t dy = 30; // odstęp pomiedzy wierszami w osi oY
y = y - (3*dy); // zaczynam o 3 wiersze wcześniej
for(i=0; i<6; i++)
{
EVE_cmd_number(EVE_HSIZE/2,y,30,EVE_OPT_CENTER,TransMatrix[i]);
y += dy;
}
y += dy;
char txt[50];
strcpy_P(txt,PSTR("Dotknij ekranu lub nacisnij przycisk aby wyjsc")); // in english: "touch the screen to exit"
EVE_cmd_text(EVE_HSIZE/2,y,31,EVE_OPT_CENTER,txt);
page_stop();
_delay_ms(500); //while(1){};
while(0 == EVE_memRead8(REG_TOUCH_TAG) && is_set(CALIBRATE_PIN,CALIBRATE));
//while(is_set(CALIBRATE_PIN,CALIBRATE)){}; // czekam na ponowne nacisniecie przycisku
}
void uart0_send_trans_matrix(uint32_t * TransMatrix)
{
char buff[16];
for(uint8_t i=0; i<6; i++)
{
//EEMEM uint32_t TransMatrix1 = 33612304;
uart0_puts_P(PSTR("\rEEMEM uint32_t TransMatrix"));
uart0_puts(utoa(i+1,buff,10));
uart0_puts_P(PSTR(" = "));
uart0_puts(ultoa(TransMatrix[i],buff,10));
uart0_puts_P(PSTR(";"));
}
//uart0_puts_P(PSTR("\r test=")); uart0_puts(ultoa(UINT32_MAX,buff,10));
}
In the main function, I simply call the 'restore_calibrate_matrix' function. This function reads the calibration matrix from EEPROM. If EEPROM is empty (i.e., it has a value of 0xFFFFFFFF), I invoke the screen calibration and then save the new calibration matrix values to EEPROM. However, if EEPROM contains any saved values, it reads the consecutive 'TransMatrix[n]' and then saves them to 'REG_TOUCH_TRANSFORM_n'.
I feel that one panel, the older one, works perfectly fine while the newer one has the problems described above.
Regards
Karol