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 [3] 4 5

Author Topic: How to read REG_ID register  (Read 31531 times)

Geethanjali

  • Newbie
  • *
  • Posts: 39
    • View Profile
Re: How to read REG_ID register
« Reply #30 on: November 08, 2021, 09:47:25 AM »

Hi Rudolph,

I was able to turn on the backlight thanks for your help.
As a next step I need to load a screen can you help me in doing that like if there are any small snippet that i can load and check , I have used EVE editor and developed a screen using that tool . It would be helpful if u can provide me with small code snippet or any example.
Are there any steps to be followed to load the bitmap?

Thanks in advance.
Logged

Geethanjali

  • Newbie
  • *
  • Posts: 39
    • View Profile
Re: Commands to load an icon or image
« Reply #31 on: December 06, 2021, 09:05:21 AM »

Hi Rudolph,

Can u please tell what is the command sequence that I should use in order to load an icon or image , I use FRDM K32L board.



thanks in advance.
Logged

Rudolph

  • Sr. Member
  • ****
  • Posts: 389
    • View Profile
Re: How to read REG_ID register
« Reply #32 on: December 06, 2021, 11:00:37 PM »

Hello,

I am a bit buried in work lately and did not go back to use my FRDM K32L board.
But you habe what I got so far and with which I got the board up and running.
Check the tft.c from the source archive I attached.
Logged

Geethanjali

  • Newbie
  • *
  • Posts: 39
    • View Profile
Loading an image
« Reply #33 on: December 10, 2021, 04:07:35 AM »

Hi Rudolph , thanks for your reply

 Currently I am trying to load an raw array of an PNG format image , can u please provide me steps to be followed , should I use CMD_LOADIMAGE command , I am bit confused in sending the commands , Could you please provide me the sequence of commands that has to be sent. I am not using flash to load an image will that be okay.


Thanks in advance.
Logged

Rudolph

  • Sr. Member
  • ****
  • Posts: 389
    • View Profile
Re: How to read REG_ID register
« Reply #34 on: December 12, 2021, 09:28:27 PM »

Check TFT_init() in tft.c, this is the same as in my repository:
https://github.com/RudolphRiedel/FT800-FT813/blob/5.x/examples/EVE_Test_Arduino_PlatformIO/src/tft.c

I have two images stored in tft_data.c:
https://github.com/RudolphRiedel/FT800-FT813/blob/5.x/examples/EVE_Test_Arduino_PlatformIO/src/tft_data.c

The first is a converted image in ARGB1555 format which zlib compressed with EAB and is loaded with:
 EVE_cmd_inflate(MEM_LOGO, logo, sizeof(logo));

The second is a .jpg image which is loaded with:
 EVE_cmd_loadimage(MEM_PIC1, EVE_OPT_NODL, pic, sizeof(pic));

Yes, loading a .png file as raw unconverted data is done with CMD_LOADIMAGE as well.

My EVE_cmd_loadimage() now looks like this (simplified):

Code: [Select]
void EVE_cmd_loadimage(uint32_t ptr, uint32_t options, const uint8_t *data, uint32_t len)
{
    uint32_t ftAddress;

    ftAddress = REG_CMDB_WRITE;
    EVE_cs_set();
    spi_transmit((uint8_t)(ftAddress >> 16) | MEM_WRITE); /* send Memory Write plus high address byte */
    spi_transmit((uint8_t)(ftAddress >> 8)); /* send middle address byte */
    spi_transmit((uint8_t)(ftAddress & 0x000000ff)); /* send low address byte */

    spi_transmit_32(CMD_LOADIMAGE);
    spi_transmit_32(ptr);
    spi_transmit_32(options);
    EVE_cs_clear();

    block_transfer(data, len);
}

The block_transfer() function sends the data in chunks of 3840 bytes to the command FIFO and waits for the command co-processor to empty the FIFO. Why 3840? No strict binding reason, this is just 15 x 256.
But the FIFO can only hold 4096 bytes, so we need to make sure to not overshoot this.

I advise against using PNG directly though.
EVE is rather picky about the format the PNG is saved with, although this can be tested with EAB.

Then EVE needs quite some time to process PNG.
I did a test withe the ugly star image from my demo a while back.
It has 3867 bytes as .png and 3903 bytes as .jpg.
Processing with a FT813 took 53 ms for the PNG and 480 µs for the JPG, that is a factor of 110.

Maybe BT81x are better with PNG but it does not really matter since BT81x can use ASTC compressed images.
And ASTC 8x8 for example uses only 2 bits per pixel and still comes with alpha channel, so even when only running from RAM_G your images need 1/8 of storage space.

So as you are using a BT816, I recommend using ASTC instead.
Logged

Geethanjali

  • Newbie
  • *
  • Posts: 39
    • View Profile
Image not getting displayed properly
« Reply #35 on: December 16, 2021, 07:28:28 AM »

Hi Rudolph thanks for your reply,

I am uploading an ARGB1555 format image , The image is getting uploaded but it looks empty without colours like its completely blank with correct resolution and x and y cordinates , can u please help me with where is the mistake. What I should correct .


Thanks in advance.


Logged

BRT Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 733
    • View Profile
Re: How to read REG_ID register
« Reply #36 on: December 16, 2021, 02:37:40 PM »

Hi,

Which format is your ARGB1555 image in? Is it the raw data (e.g. the .raw or .rawh from EVE Asset Builder) or is it a bin file which you are inflating with CMD_INFLATE?

Best Regards, BRT Community
Logged

Rudolph

  • Sr. Member
  • ****
  • Posts: 389
    • View Profile
Re: How to read REG_ID register
« Reply #37 on: December 16, 2021, 04:51:29 PM »

Exactly what I wanted to ask.  :)

And then I have to note that this forum is a bit akward to use for more lively discussions due to the strict moderation.
Well, it is what it is and without moderation this forum would be flooded with spam.

Anyways, if you feel like I could answer your question you could also open a new discussion here: https://github.com/RudolphRiedel/FT800-FT813/discussions

Or add a post here: https://www.mikrocontroller.net/topic/395608
Also there is a good chance that your question already was answered in the thread somewhere. :-)
Logged

Geethanjali

  • Newbie
  • *
  • Posts: 39
    • View Profile
Image not getting displayed properly
« Reply #38 on: December 17, 2021, 04:04:32 AM »

Hi,


It is in PNG format, It is the raw data (.rawh file from EVE Screen Editor) . I am using a 7.0" Inch  RVT70HSBNWC00-B display.




Thanks in advance.
« Last Edit: December 17, 2021, 04:08:55 AM by Geethanjali »
Logged

Rudolph

  • Sr. Member
  • ****
  • Posts: 389
    • View Profile
Re: How to read REG_ID register
« Reply #39 on: December 17, 2021, 03:46:19 PM »

Ah ok, so just raw converted data, so neither CMD_LOADIMAGE or CMD_INFLATE are suitable for this.
This requires a direct memory transfer and I have two helper functions for this:

/* helper function, write a block of memory from the FLASH of the host controller to EVE */
void EVE_memWrite_flash_buffer(uint32_t ftAddress, const uint8_t *data, uint32_t len)

/* helper function, write a block of memory from the SRAM of the host controller to EVE */
void EVE_memWrite_sram_buffer(uint32_t ftAddress, const uint8_t *data, uint32_t len)

These are only different when using a Harvard architecture like AVR.
And "ftAddress" is the address for EVE, so usually somewhere in RAM_G.

I recommend using EVE Asset Builder for converting images though. It also comes with an "ASSET COMPRESSOR" module and a "BIN2C" module.
Logged

Geethanjali

  • Newbie
  • *
  • Posts: 39
    • View Profile
Touch register - tag value
« Reply #40 on: January 03, 2022, 01:23:11 PM »

Hi Rudolph,

Thanks for your reply , Can you please help me in Touch related function like since I am new to touch related activities in this display , I am quite confused . Can u please provide me the sequence of the commands to be sent . I tried reading Touch Tag Register ( REG_TOUCH_TAG) and Co-ordinates of that particular register (REG_TOUCH_TAG_XY) , I am getting wrong co-ordinate values . It would be helpful if u can help me in this .
It would be more helpful if I can get any examples to understand.

Once I  assign each graphical object with tag value , they are getting assigned as 0 , TAG(0) in EVE editor is that right?
For example - I have 3 objects if i assign them with tag value it is all 0 through EVE editor tool TAG(0).

I am using Riverdi (RVT70HSBNWC00-B) - BT817


Thanks in advance.
« Last Edit: January 03, 2022, 01:26:51 PM by Geethanjali »
Logged

Rudolph

  • Sr. Member
  • ****
  • Posts: 389
    • View Profile
Re: How to read REG_ID register
« Reply #41 on: January 05, 2022, 01:06:17 PM »

There really is not much to it, for the most part you assign a tag-value and when an object is touched this value is reported in REG_TOUCH_TAG.
And then there are more options like multi-point-touch and sliders and so on, but this the next step.

So, the TAG command, a value of zero is invalid, valid range is 1 to 255 and default value is 255.

A display list like this:

Code: [Select]
CLEAR(1, 1, 1)
POINT_SIZE(200)
TAG(0)
BEGIN(POINTS)
VERTEX2F(2000, 2000)
TAG(10)
VERTEX2F(3000, 2000)
TAG(11)
VERTEX2F(4000, 2000)
TAG(12)
VERTEX2F(5000, 2000)
END()
CMD_TEXT(298, 164, 28, 0, "Text")
TAG(0)
CMD_TEXT(199, 53, 28, 0, "Text")

Should produce a tag-value of zero if you touch anywhere except the second, third and fourth dot, plus the first "Text".
It should only produce a tag-valu of 10 if you touch the second dot.
It should only produce a tag-valu of 11 if you touch the third dot.
It should only produce a tag-valu of 12 if you touch either the fourth dot or the first "Text".

So this tag value applies to a single object or to a whole group of objects.

If you are not getting the tag values when you are touching the objects then your touch interface is not calibrated.
Try to touch somewhere else, to find out if there is for example an offset to left and up.
This offset is due to misalignment between the touch rasterizer and the display.

To calibrate the touch you use CMD_CALIBRATE which will present you with three dots to click on after annother.
After this new calibration values are used and stored in registers REG_TOUCH_TRANSFORM_A ... REG_TOUCH_TRANSFORM_F.
You can read the values in these registers and either store these for example in an EEPROM by your software or put them directly in your code, so after that you only need to write these values back in the registers at startup.
« Last Edit: January 05, 2022, 01:07:49 PM by Rudolph »
Logged

Geethanjali

  • Newbie
  • *
  • Posts: 39
    • View Profile
Re: How to read REG_ID register
« Reply #42 on: January 07, 2022, 05:55:39 AM »

Hi Rudolph , thanks for your reply

I am not sure how to tag the graphical objects in EVE screen editor , could you please help me in that ? also is there any sequence for TOUCH registers to be configured and with what values since I am not clear on calibration part ,
Is that like I should use CMD_CALIBRATE command first and read the REG_TOUCH_TAG and calibration registers , I am using a capacitive touch .

Thanks in advance.
Logged

Rudolph

  • Sr. Member
  • ****
  • Posts: 389
    • View Profile
Re: How to read REG_ID register
« Reply #43 on: January 07, 2022, 10:21:45 AM »

The sequence above is for the EVE Screen Editor.
So the way to tag objects is just to set a tag-value and everything after that gets this tag-value.
And when you switch to the "Inspector" Tab on the bottom you can scroll down in the RAM_REG window a little to show REG_TOUCH_TAG.
Now switch in the toolbar above from from the arrow for "Context dependent cursor" to the hand for "Use the cursor to touch the emulated display" and you can see REG_TOUCH_TAG changing according to the display list.

As for the calibration, check my example code: https://github.com/RudolphRiedel/FT800-FT813/blob/5.x/examples/EVE_Test_SAMC21_EVE2-50G/tft.c
The tft.c is the same for every example across all the platforms and different displays.
I have a function touch_calibrate():

Code: [Select]
void touch_calibrate(void)
{

/* send pre-recorded touch calibration values, depending on the display the code is compiled for */

...

#if defined (EVE_RVT70)
    EVE_memWrite32(REG_TOUCH_TRANSFORM_A, 0x000074df);
    EVE_memWrite32(REG_TOUCH_TRANSFORM_B, 0x000000e6);
    EVE_memWrite32(REG_TOUCH_TRANSFORM_C, 0xfffd5474);
    EVE_memWrite32(REG_TOUCH_TRANSFORM_D, 0x000001af);
    EVE_memWrite32(REG_TOUCH_TRANSFORM_E, 0x00007e79);
    EVE_memWrite32(REG_TOUCH_TRANSFORM_F, 0xffe9a63c);
#endif

...

/* activate this if you are using a module for the first time or if you need to re-calibrate it */
/* write down the numbers on the screen and either place them in one of the pre-defined blocks above or make a new block */
#if 0
    /* calibrate touch and displays values to screen */
    EVE_cmd_dl(CMD_DLSTART);
    EVE_cmd_dl(DL_CLEAR_RGB | BLACK);
    EVE_cmd_dl(DL_CLEAR | CLR_COL | CLR_STN | CLR_TAG);
    EVE_cmd_text((EVE_HSIZE/2), 50, 26, EVE_OPT_CENTER, "Please tap on the dot.");
    EVE_cmd_calibrate();
    EVE_cmd_dl(DL_DISPLAY);
    EVE_cmd_dl(CMD_SWAP);
    while (EVE_busy()) {};

    uint32_t touch_a, touch_b, touch_c, touch_d, touch_e, touch_f;

    touch_a = EVE_memRead32(REG_TOUCH_TRANSFORM_A);
    touch_b = EVE_memRead32(REG_TOUCH_TRANSFORM_B);
    touch_c = EVE_memRead32(REG_TOUCH_TRANSFORM_C);
    touch_d = EVE_memRead32(REG_TOUCH_TRANSFORM_D);
    touch_e = EVE_memRead32(REG_TOUCH_TRANSFORM_E);
    touch_f = EVE_memRead32(REG_TOUCH_TRANSFORM_F);

    EVE_cmd_dl(CMD_DLSTART);
    EVE_cmd_dl(DL_CLEAR_RGB | BLACK);
    EVE_cmd_dl(DL_CLEAR | CLR_COL | CLR_STN | CLR_TAG);
    EVE_cmd_dl(TAG(0));

    EVE_cmd_text(5, 15, 26, 0, "TOUCH_TRANSFORM_A:");
    EVE_cmd_text(5, 30, 26, 0, "TOUCH_TRANSFORM_B:");
    EVE_cmd_text(5, 45, 26, 0, "TOUCH_TRANSFORM_C:");
    EVE_cmd_text(5, 60, 26, 0, "TOUCH_TRANSFORM_D:");
    EVE_cmd_text(5, 75, 26, 0, "TOUCH_TRANSFORM_E:");
    EVE_cmd_text(5, 90, 26, 0, "TOUCH_TRANSFORM_F:");

    EVE_cmd_setbase(16L);
    EVE_cmd_number(310, 15, 26, EVE_OPT_RIGHTX|8, touch_a);
    EVE_cmd_number(310, 30, 26, EVE_OPT_RIGHTX|8, touch_b);
    EVE_cmd_number(310, 45, 26, EVE_OPT_RIGHTX|8, touch_c);
    EVE_cmd_number(310, 60, 26, EVE_OPT_RIGHTX|8, touch_d);
    EVE_cmd_number(310, 75, 26, EVE_OPT_RIGHTX|8, touch_e);
    EVE_cmd_number(310, 90, 26, EVE_OPT_RIGHTX|8, touch_f);

    EVE_cmd_dl(DL_DISPLAY); /* instruct the co-processor to show the list */
    EVE_cmd_dl(CMD_SWAP); /* make this list active */
    while (EVE_busy()) {};

    while(1);
#endif
}

This is just the most simplified version of how calibrating the touch could look like.
If the code is activated it just does the calibration and prints the values on the screen.

And having these values in the source-code is just the most portable way to do this.

If I had a series of devices with production over a longer period, I would add a calibration menu and find a way to store the values at runtime in the system, for example in an EEPROM. But this would no longer be portable.
« Last Edit: January 07, 2022, 01:28:12 PM by Rudolph »
Logged

Geethanjali

  • Newbie
  • *
  • Posts: 39
    • View Profile
Re: Touch
« Reply #44 on: January 10, 2022, 09:11:01 AM »

Hi Rudolph thanks for your reply , I am able to tag values
 
Problem I am facing right now is I am not able to read the tag value its 0 everytime . I have calibrated the screen also like I used calibrate command read values from EVE editor and I used that for writing the registers ( REG_TOUCH_TRANSFORM_A till F) for startup.


Could you please help me in this.
Thanks in advance.
Logged
Pages: 1 2 [3] 4 5