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

Author Topic: BT81x library and Arduino IDE  (Read 10116 times)

elektor18

  • Newbie
  • *
  • Posts: 12
    • View Profile
BT81x library and Arduino IDE
« on: November 18, 2020, 10:50:42 AM »

Hi,

I have display from Riverdi (5inch) works with BT815. Everything is ok with it but it is time to use flash storage to display ASTC images. I was trying to use this memory but don't know how to load blob... I created blob.h and attach it to project, then load it to the G_RAM and then to flash:

Code: [Select]
uint8_t *dfg = blob;  // uint8_t blob[]={0x70... rest of blob data in blob.h file
Gpu_Hal_WrCmdBuf(phost, dfg, sizeof(dfg));

Gpu_CoCmd_FlashHelper_Update(phost, 0, (uint32_t)dfg, sizeof(dfg));

Are those steps ok?
Logged

Rudolph

  • Sr. Member
  • ****
  • Posts: 389
    • View Profile
Re: BT81x library and Arduino IDE
« Reply #1 on: November 19, 2020, 09:42:38 PM »

This looks okay, cmd_flashupdate works without blob.

I am compressing the image files when I put them into the controllers memory though.
You can generate zlib compressed files with the "Asset Compressor" of EVE Asset Builder.
And especially fonts get compressed by a lot since all the glyphs are individual ASTC images.
But the blob also is quite compressible since most of the 4k is 0xff anyways, at least so far.

This is a snippet I am using with my own library to test UTF-8 fonts currently:

Code: [Select]
uint32_t datasize;

EVE_cmd_inflate(0, flash, sizeof(flash)); /* de-compress flash-image to RAM_G */
datasize = EVE_cmd_getptr(); /* we unpacked to RAM_G address 0x0000, so the first address after the unpacked data also is the size */
EVE_cmd_flashupdate(0,0,4096); /* write blob first */
EVE_init_flash();
EVE_cmd_flashupdate(0,0,(datasize|4095)+1); /* size must be a multiple of 4096, so set the lower 12 bits and add 1 */

EVE_cmd_flashread(MEM_FONT, 363008, 5056); /* copy .xfont from FLASH to RAM_G, offset and length are from the .map file */

However, Riverdi is offering an USB adapter for this: https://riverdi.com/product/hermes-board/
You can use this to directly program flash images with the EVE Asset Builder.
Transferring bits and pieces by putting it in the micro is possible but not much fun beyond a couple of KB.
And this is not only depending on your Controllers memory, with the 1MB of RAM_G you would need to do 16 turns to fill up the 128MBit memory on the Riverdi module.



https://github.com/RudolphRiedel/FT800-FT813
« Last Edit: November 21, 2020, 10:52:56 AM by Rudolph »
Logged

elektor18

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: BT81x library and Arduino IDE
« Reply #2 on: November 26, 2020, 11:24:26 AM »

Thanks for reply,

Before I use compression for my files, I would like to load blob to flash to see it works in fast flash mode. For now it is returning only basic mode... Can you advice why it doesn't work?
Logged

Rudolph

  • Sr. Member
  • ****
  • Posts: 389
    • View Profile
Re: BT81x library and Arduino IDE
« Reply #3 on: November 27, 2020, 07:03:19 PM »

I am not using the library you are using, whichever exactly it is, I am using my own which also works for Arduino.
So apart from that it looks like you are doing it correctly I can not really tell much about
the small snippet you posted.
Perhaps add the blob.h you created?

However, I just ordered a RVT50UQBNWC01 for my collection to help with this:
https://github.com/RudolphRiedel/FT800-FT813/issues/14
If you are interested I could expand my Arduino example a little to include using the flash.
Logged

elektor18

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: BT81x library and Arduino IDE
« Reply #4 on: December 01, 2020, 12:27:50 PM »

Hi,

Yes, if you could expand your Arduino code, that would be brilliant.
I'm using ESP8266 module.

Here is blob file included in my project.
Code: [Select]
  uint8_t blob[]={
0x70, 0xDF, 0xFB, 0x92, 0x1E, 0x01, 0x00, 0x00, 0xE8, 0xA6, 0x30, 0x00,
0x18, 0x01, 0x10, 0x00, 0x00, 0x00, 0xF8, 0xDA, 0x4A, 0xA7, 0x2A, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x40, 0x80,
0x8D, 0x72, 0x62, 0x72, 0x5B, 0x36, 0x68, 0x40, 0x94, 0x32, 0xF1, 0x33,
};


It is just part, it is not allowed to put more characters on this forum I'm afraid.
Logged

Rudolph

  • Sr. Member
  • ****
  • Posts: 389
    • View Profile
Re: BT81x library and Arduino IDE
« Reply #5 on: December 02, 2020, 09:28:21 PM »

Well, at least I can confirm that these are the first 48 bytes of unified.blob. :-)

Okay, challenge accepted, I dug up an ESP8266, more specfically a D1 Mini.
I bought this years ago and it gave me all kinds of crappy issues now, at first the software did not build and
then I had to spend quite some time finding out which pins are where and to confirm that these
really do work like I would like them to.
Anyways, it sort of kinda starts to work now but I am still get nothing on the display, have to call it a day though.


Edit: the ESP8266 is still not up and running, this thing is getting on my nerves
I have it up and running on Uno, Metro-M4 and ESP32 currently and it worked a while ago on ESP8266 as well.
And these are only the Arduino variants.
https://github.com/RudolphRiedel/FT800-FT813/tree/5.x/example_projects/EVE_Test_Arduino_PlatformIO

I am using the same board to adapt to the display with all four boards:
https://github.com/RudolphRiedel/EVE_display-adapter/tree/master/L-D5019-01-05

But when I connect my D1 Mini to it does not work.
For example whatver pin I select for CS it is somehow to weak to pull down low against a 10k pullup resistor.
I just ordered a new D1 Mini...

« Last Edit: December 05, 2020, 10:36:47 PM by Rudolph »
Logged

elektor18

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: BT81x library and Arduino IDE
« Reply #6 on: December 06, 2020, 12:03:40 PM »

Hi,
Thanks for that. I have ESP32 as well, I used it and works now.
I'll have a play with it and try to load blob now.

Thanks again,
Very well done.

One last question. How can you transfer data to write flash now?
Can you transfer data from uart straight to the display flash? Would you accept this challenge?  ;)
« Last Edit: December 06, 2020, 02:02:24 PM by elektor18 »
Logged

Rudolph

  • Sr. Member
  • ****
  • Posts: 389
    • View Profile
Re: BT81x library and Arduino IDE
« Reply #7 on: December 07, 2020, 10:17:21 PM »

I expaned my simple demo a little, it now includes a flash-image containing an UTF-8 font that is programmed into the external flash of a BT81x and then the font is used from there by copying the .xfont file for the font to RAM_G and setting it up as a font with CMD_SetFont2.

I tried it with an ATSAME51 running bare metal, with an Arduino UNO and an ESP32 with Arduino.

Regarding the ESP8266, it really looks like my board is toast.
And not only that it killed one of my display-adapters now as well.
It even looked like my ESP32 board had been killed as well but I still can use it with a differen display-adapter board.
Right now it looks like the best move would be to rip out ESP8266 support entirely and never look back.
But then I probably get the new board tomorrow.

>One last question. How can you transfer data to write flash now?

Like I wrote, probably the best option is to get one of the USB/SPI adapters and use EVE Asset Builder to fill the flash.
But for simply trying something I am flashing from the memory of my microcontroller.

>Can you transfer data from uart straight to the display flash?

Well, it certainly could be done, it would be like using a bootloader.
Copy 4096 bytes over whatever interface to EVE, copy this block to RAM_G, update one page in the external flash, repeat.

>Would you accept this challenge?

Nope, for one this is out of scope for EVE and then I really consider the USB/SPI interfaces
to be the superior solution to the issue of needing to fill the flash.




Logged

Rudolph

  • Sr. Member
  • ****
  • Posts: 389
    • View Profile
Re: BT81x library and Arduino IDE
« Reply #8 on: December 17, 2020, 10:35:52 PM »

Edit: I have Arduino-ESP8266 up and running now

https://github.com/RudolphRiedel/FT800-FT813/tree/5.x/example_projects/EVE_Test_Arduino_PlatformIO

After quite some frustration I found the last issue.
The function that is converting the strings for gadgets like buttons was copying 32 bit values from the string and either the ESP8266  has stricter requirements as any other architecture I am using, including the ESP32, or the compiler settings for ESP8266 are a bit off in that strings are not placed with 32 bit alignment while for other architectures that require this the strings are 32 bit aligned by the compiler.
« Last Edit: December 18, 2020, 10:18:11 PM by Rudolph »
Logged