BRT Community

Please login or register.

Login with username, password and session length
Advanced search  

News:

Welcome to the Bridgetek Community!

Please read our Welcome Note

Technical Support enquires
please contact the team
@ Bridgetek Support

Please refer to our website for detailed information on all our products - Bridgetek - Bridging Technology

Pages: [1] 2

Author Topic: Updating Capacitive Touch Controller Firmware of BT815  (Read 16098 times)

david

  • Newbie
  • *
  • Posts: 25
    • View Profile
Updating Capacitive Touch Controller Firmware of BT815
« on: June 17, 2021, 06:23:49 PM »

Hello, I am Trying to flash a new firmware for the capacitive touch controller. I am using the BT815 with the EVE Asset Builder 2.2.
I was not successfull with my code in the first place, I sniffed the I2C traffic between the BT815 and the touch controller and it did not address and send the correct data.
That's why I tried to simplify it by removing the whole I2C communication and just reporting static values to the BT815. This is the code I am compiling:
Code: [Select]
int i2c_addr()
{
  return 0x38; // does not matter for my test
}

int setup()
{
  setWAKE(0);
  delay_ms(5);
  setWAKE(1);
  delay_ms(300);
}

void loop()
{
report_touch(0, 400, 300);
delay_ms(5); // also tried without those delays and with id 1 as well
report_touch(0, 200, 100);
delay_ms(5);
}

which results in this:
Code: [Select]
26,255,255,255,32,32,48,0,4,0,0,0,2,0,0,0,26,255,255,255,0,176,48,0,4,0,0,0,5,2,0,0,34,255,255,255,238,178,48,0,120,218,37,142,177,75,195,80,16,198,239,154,182,168,25,204,251,3,58,60,16,165,24,39,59,56,222,209,69,40,217,197,233,189,182,70,180,89,156,20,117,184,172,18,72,157,197,81,40,205,191,32,14,78,29,187,56,73,233,226,238,232,34,196,151,56,220,241,187,143,239,227,59,101,246,233,78,31,66,102,148,163,54,237,152,107,62,35,207,118,38,55,184,43,3,80,166,79,222,80,153,92,191,16,92,62,96,110,67,167,30,72,150,108,186,129,24,197,27,53,229,17,143,36,51,247,46,239,11,36,202,38,188,103,79,185,51,241,157,247,137,127,1,177,199,61,222,16,239,42,31,130,204,120,206,43,66,153,97,197,129,157,51,242,10,124,137,160,74,67,12,18,88,20,24,45,180,178,39,220,167,192,54,169,37,112,254,174,111,233,24,202,18,98,111,220,149,1,109,59,247,22,125,232,174,68,53,127,234,204,148,238,159,37,66,186,100,101,214,85,227,197,26,209,93,95,216,168,55,200,148,91,82,184,246,41,135,105,1,175,236,148,52,76,159,107,21,100,33,99,249,231,55,252,230,31,142,210,130,218,141,63,227,110,93,240,0,0,26,255,255,255,32,32,48,0,4,0,0,0,0,0,0,0
But when I try to get the touch values (the raw ones from REG_TOUCH_RAW_XY) I just get x: 0, y: 0 or x: 65535, y: 65535.
I can see that the BT815 is not communicating via I2C anymore, so the transfer of the firmware seems to work at least in some parts.

I have also a few more questions:
- is the response of int i2c_addr() used over the one in REG_TOUCH_CONFIG (REG_CYA_TOUCH) or which one is priorized?

- is it possible to configure the I2C frequency?

For uploading the Firmware my code looks like this:
Code: [Select]
Gpu_Hal_WaitCmdfifo_empty(host);
Gpu_Hal_WrCmdBuf(host, TOUCH_DATA, sizeof(TOUCH_DATA));
Gpu_Hal_WaitCmdfifo_empty(host);
I tried it right after GPU_ACTIVE_M in setup and also after getting the BT815 ID via REG_ID.
I also tried to reset the touch component with Gpu_Hal_Wr32(host, REG_CPURESET, 2); followed by Gpu_Hal_Wr32(host, REG_CPURESET, 0);

The real code which I tried to compile and run at the first place is this one:
Code: [Select]
int i2c_addr()
{
  return 0x41;
}

int setup()
{
  setWAKE(0);
  delay_ms(5);
  setWAKE(1);
  delay_ms(300);
}

void loop()
{
  while (getINT() == 1) // wait for INT to go low
    ;
  i2c_startread(0x10);
  int n_touches = i2c_read8();
  int touch_index = 0;
  int x_raw;
  while (touch_index < n_touches) {
x_raw = i2c_read16le();
report_touch(touch_index, i2c_read16le(), x_raw & 0x3fff);
touch_index = touch_index + 1;
  }
  i2c_stop();
}

It would be nice, if there are some more information about updating the touch firmware or if someone could test the firmware on top to check if the uploading is the problem.
If it helps I can also provied sniffed I2C traffic of one of the compiled firmwares.
Logged

david

  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: Updating Capacitive Touch Controller Firmware of BT815
« Reply #1 on: June 24, 2021, 07:13:49 AM »

I would be very grateful for any help. Did anyone successfully transfer a self compiled touch firmware binary yet?
Logged

BRT Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 733
    • View Profile
Re: Updating Capacitive Touch Controller Firmware of BT815
« Reply #2 on: June 24, 2021, 12:59:20 PM »

Hi David,

We will try out your code and will post back here with the results,

Best Regards, BRT Community
Logged

BRT Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 733
    • View Profile
Re: Updating Capacitive Touch Controller Firmware of BT815
« Reply #3 on: July 02, 2021, 11:29:29 AM »

Hi David,
Just to update you, we tried your code and could see the same result, we're just investigating and will post an update soon,
Best Regards, BRT Community
Logged

david

  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: Updating Capacitive Touch Controller Firmware of BT815
« Reply #4 on: July 16, 2021, 02:52:32 PM »

Do you have any new information? I am comparing a few different touch controllers (also with host mode) and it would help a lot to have more information about that topic. Did you also try the sample code on a BT817, does it work there (I could not get one yet)?
Logged

david

  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: Updating Capacitive Touch Controller Firmware of BT815
« Reply #5 on: September 06, 2021, 09:39:40 AM »

I am still interested in that. It would be very nice, if I can get an update about it. Is it a bug in the compiler or with BT815 or am I not using it correctly?
Logged

karst.drenth

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: Updating Capacitive Touch Controller Firmware of BT815
« Reply #6 on: November 30, 2021, 11:23:56 AM »

Hi,

I have a similar need. The CTP of my display seems to be pretty noisy...  :'( ( many false touches detected )

It has the GT11 chip on there. Reading the GT11 Manual/Programming guide, there is a setting for noise reduction. ( and some more settings that cope with ESD and noise problems )

Question 1: what are the BT815 factory firmware's settings for the GT11
Question 2: is the "custom firmware" method also able to only have a "setup" function and let "loop" just be done by the original firmware ?
Question 3: if 2) not is possible, what is the ROM's firmware source for the "loop" equivalent ?

Grtzz,
Karst
Logged

karst.drenth

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: Updating Capacitive Touch Controller Firmware of BT815
« Reply #7 on: November 30, 2021, 03:50:24 PM »

Hi,

Self-answer to Question 2:

Code: [Select]
----------------------------------------------------------------------
GT911-Custom.eab compilation is in progress...
Microcode 'capcs.fs' uses 1100 bytes.
Loader command stream is 368 bytes
350 new bytes in firmware
Compilation is done.
----------------------------------------------------------------------
GT911-Custom.eab compilation is in progress...

Cross-compilation failed - exiting

in file included from *the terminal*:0
in file included from *the terminal*:-1
in file included from cross.fs:242
capcs.fs:361: error: Undefined word
begin loop
Backtrace:
0 $FFA47D28 throw
1 $FFA4A1F0 no.extensions 
Compilation failed!

I tried to compile this:

Code: [Select]
/*

The tiny language resembles C in syntax.

It allows:
  - functions, of "void" and "int" type
  - constructs, if .. else, while and do .. while loops
  - local variables, of "int" type only
  - integer arithmetic (no / or %)

The end-user defines three functions:
  - i2c_addr() which returns the I2C address
  - setup() one-time initialization
  - loop() poll the CTP and update the touch sensing registers

In addition a number of built-in functions are available for IO in the user's code. Together these form a simple HAL.

  - void delay_ms(n)              // delay for n milliseconds
  - void delay_us(n)              // delay for n microseconds
  - void i2c_regwr(u, v)          // write value v to register u
  - void i2c_startread(u)         // start a read from register u
  - int i2c_read16le()            // read 16 bits from I2C, little-endian
  - int i2c_read16be()            // read 16 bits from I2C, big-endian
  - int i2c_read8()               // read 8 bit from I2C
  - void i2c_stop()               // end the I2C read
  - void report_touch(id, x, y)   // set the touch sensing registers
  - int getINT()                  // get the INT input
  - void setINT(u)                // set INT open-drain
  - void setWAKE(u)               // set WAKE output
  - int getCYA()                  // get the CYA register value
*/


/* This code assumes CTP reports n_touches = 0 during last touch interrupt at finger-up */
int i2c_addr()
{
  return 0x38;
}

int setup()
{
  setWAKE (0);
  delay_ms(3);
  setWAKE (1);
  delay_ms(300);
}

//void rtouch()
//{
//  int x    = i2c_read16be() & 0xFFF;
//  int id_y = i2c_read16be();
//
//  report_touch(id_y >> 12, x, id_y & 0xFFF);
//}
//
//void loop()
//{
//  while (getINT() == 1) // wait for INT to go low
//    ;
//
//  i2c_startread(0x02);
//
//  int n_touches = i2c_read8();
//
//  while (n_touches != 0) {
//    rtouch();
//    n_touches = n_touches - 1;
//  }
//
//  i2c_stop();
//}

So loop() is mandatory.  :(

@BRT Community

Is it possible to post the source code of the ROM-micro-code for the GT911 ?

Greetz,
Karst
Logged

BRT Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 733
    • View Profile
Re: Updating Capacitive Touch Controller Firmware of BT815
« Reply #8 on: December 01, 2021, 04:31:35 PM »

Hello Karst,

I will contact the developers to see if they can provide the GT911 source code.

Although if you are only trying to alter one register setting in the GT911 you could try the following method denoted in section 4.8.6 of the BT81x datasheets:

Code: [Select]
- Hold the touch engine in reset (set REG_CPURESET = 2)
- Write the CTPM configure register address and value to the BT815 designated memory location
- Up to 10 register address/value can be added
- Release the touch engine reset (set REG_CPURESET = 0)

Best Regards,
BRT Community
Logged

karst.drenth

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: Updating Capacitive Touch Controller Firmware of BT815
« Reply #9 on: December 02, 2021, 03:42:59 PM »

Hi,

Thanks @BRT Community

That is exactly what I planned to do :)

But...

"...Write the CTPM configure register address and value to the BT815 designated memory location..."

Big question: Which is BT815 designated memory location ??  ;)

Greetz,
Karst

P.S. my "problem" is no longer urgent, since I switched to another Display which has a way better CTP ;) But it will emerge again at the moment I want to (re-)use the old display
Logged

BRT Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 733
    • View Profile
Re: Updating Capacitive Touch Controller Firmware of BT815
« Reply #10 on: December 02, 2021, 03:59:12 PM »

Hello,

I am just waiting on the developers clarifying exactly which memory location is the correct designation, however I believe that RAM_JTBOOT is the intended location (30 B000h to 30 B7FFh).

Please see below for an example:

Code: [Select]
#define FW_RD(a) VC.rd16(RAM_JTBOOT + 2 * (a))
#define FW_WR(a, v) VC.wr16(RAM_JTBOOT + 2 * (a), (v))
void init_custom_touch(size_t num_regs, uint8_t *reg_value)
{
 while (VC.rd(REG_CPURESET) != 0)
 ;
 VC.wr(REG_CPURESET, 2);
 uint16_t main = FW_RD(0) & 0xfff;
 uint16_t i_set = 0x4000 | (main - 4);
 uint16_t patch = main + 1;
 uint16_t i_eol = FW_RD(patch);
 while (num_regs--) {
 uint8_t reg = *reg_value++;
 uint8_t val = *reg_value++;
 FW_WR(patch++, 0x8000 | val);
 FW_WR(patch++, 0x8000 | reg);
FW_WR(patch++, i_set);
 }
 FW_WR(patch, i_eol);
 VC.wr(REG_CPURESET, 0);
}

Best Regards,
BRT Community
Logged

BRT Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 733
    • View Profile
Re: Updating Capacitive Touch Controller Firmware of BT815
« Reply #11 on: December 06, 2021, 02:40:54 PM »

Hello,

I have had it confirmed from the development team that RAM_JTBOOT is the correct memory location.


Best Regards,
BRT Community
Logged

karst.drenth

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: Updating Capacitive Touch Controller Firmware of BT815
« Reply #12 on: December 09, 2021, 09:15:01 AM »

Hi,

Thanks for the info (y)

I will try and let you know the result :)

Greets,
Karst
Logged

david

  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: Updating Capacitive Touch Controller Firmware of BT815
« Reply #13 on: April 22, 2022, 10:39:25 AM »

Hi David,
Just to update you, we tried your code and could see the same result, we're just investigating and will post an update soon,
Best Regards, BRT Community

Did you get any response about that?
Logged

BRT Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 733
    • View Profile
Re: Updating Capacitive Touch Controller Firmware of BT815
« Reply #14 on: May 02, 2022, 08:58:56 AM »

Hi David,

Which model of CTP are you currently using for your testing?

Best Regards, BRT Community
Logged
Pages: [1] 2