Using Custom Fonts

FTDI/Bridgetek EVE2 & EVE3 & EVE4 SPI TFT Series by Matrix Orbital

Moderator: Mods

Rudolph
LCD Guru
Posts: 67
Joined: Wed Feb 28, 2018 11:09 am

Re: Using Custom Fonts

Post by Rudolph »

Okay, this is the same project but it has Arcade_R:
EVE_Test_Arduino_PlatformIO_EVE3-43G_UTF-8.zip
(84.82 KiB) Downloaded 172 times
The difference is that for some reason I had to place the "Loop..." text line a little lower.
And the "Hello UTF-8: €µäöü" line is all upper-case now and has no special chars at the end, only empty squares.

The font is not one I would pick or only for a very specific reason. ;-)

dood
LCD Geek
Posts: 20
Joined: Fri Oct 30, 2020 5:10 pm

Re: Using Custom Fonts

Post by dood »

Well, I start from scratch with the package you post at 9h38PM.
I even take a simple Arduino M0 and not my specific PCB based on SAMD21.

And the conclusion is ... same problem :'(.

I notice that :
1 button and 1 text : freeze
1 button only : ok
1 text only : ok
2 texts : freeze

It seems that as soon as there are two objects, mine is freezing.

Even 1 button and 1 text without specific font is freezing

Code: Select all

EVE_cmd_dl_burst(TAG(10)); /* assign tag-value '10' to the button that follows */
EVE_cmd_button_burst(20,20,80,30, 28, toggle_state,"Touch!");
EVE_cmd_dl_burst(TAG(0)); /* no touch */
		
EVE_cmd_dl_burst(DL_COLOR_RGB | BLACK);

//EVE_cmd_button_burst(20, 120, 80, 30, 28, 0, "Touch!");
//EVE_cmd_setfont2_burst(12, MEM_FONT, 32);
EVE_cmd_text_burst(10, 150, 28, 0, "LOOP - The quick brown fox");
//EVE_cmd_text_burst(10,80,12,0, "Hello UTF-8: €µäöü"); //€µ°");
Here is my hardware wiring (hardware SPI on M0) :
LCD (RiBUS) Arduino M0
1 VDD-3.3v 3.3v
2 GND GND
3 CLK CLK
4 MISO MISO
5 MOSI MOSI
6 CS D9
8 RESET D8
17 VDD-5V 5v

Image

Could it be the TFT screen the culprit ?

Rudolph
LCD Guru
Posts: 67
Joined: Wed Feb 28, 2018 11:09 am

Re: Using Custom Fonts

Post by Rudolph »

Well, I still have to assume that I broke something but I can not reproduce the issue.
20201103_174055.jpg
20201103_174055.jpg (94.35 KiB) Viewed 2510 times
The display in the green case is an EVE3-43G.
Why the green? Just because I had it on the printer when I test-printed the case.

Below is one of these Unicorns we do not talk around here, should be pretty much the same as your Unicorn,
only with BT815 and capacitive touch. :-)

I briefly swithed over to my Unicorn and it worked right away except for the touch,
when I switched the configuration in EVE_config.h I also got touch support.

Now, I do not have an Arduino M0 and do not really want one. :-)
I tried to use a Metro M4 that is collecting dust here for some time now.
But I can't get it to work right now, the software builds, gets flashed, the screen stays black.
Maybe some library issue, no idea.
Last edited by Rudolph on Wed Nov 04, 2020 9:58 am, edited 1 time in total.

dood
LCD Geek
Posts: 20
Joined: Fri Oct 30, 2020 5:10 pm

Re: Using Custom Fonts

Post by dood »

Rudolph wrote:
Tue Nov 03, 2020 10:57 am
Well, I sill have to assume that I broke something but I can not reproduce the issue.
You already support a lot of hardware, no bug, no fun :D
Rudolph wrote:
Tue Nov 03, 2020 10:57 am
I briefly swithed over to my Unicorn and it worked right away except for the touch,
when I switched the configuration in EVE_config.h I also got touch support.
So I keep my Unicorn for testing. I could change later if needed.
Rudolph wrote:
Tue Nov 03, 2020 10:57 am
Now, I do not have an Arduino M0 and do not really want one. :-)
I tried to use a Metro M4 that is collecting dust here for some time now.
But I can't get it to work right now, the software builds, gets flashed, the screen stays black.
Maybe some library issue, no idea.
Alright, I'm staying with your last v5 revision but won't use burst (and I'm still happy with that !).

Thanks for all the time you take, I'll keep you in touch with my project.
If you think about anything concerning this burst problem, feel free to ask some tests, I would be happy to help you.

PS : I've added the PDF schematics on my Github.

Rudolph
LCD Guru
Posts: 67
Joined: Wed Feb 28, 2018 11:09 am

Re: Using Custom Fonts

Post by Rudolph »

Today I learned that the Metro M4 does not support SPI on the same header as the UNO, at least not directly out-of-the-box.
I'll try to use it with the hardware SPI from the ICSP header as it is intended to be used.

And I ordered one of these:
M0-Mini.jpg
M0-Mini.jpg (57.49 KiB) Viewed 2505 times
Just because I would like to know what the issue is.

You are using the Arduino framework with your Arduin M0?
I do prefer going bare-metal though. :-)

dood
LCD Geek
Posts: 20
Joined: Fri Oct 30, 2020 5:10 pm

Re: Using Custom Fonts

Post by dood »

You never give up ! :)

Yes, I'm using the Arduino framework.

Mine is this one : https://robotdyn.com/samd21-m0.html (for testing purpose).
For my project, I'm buying SAMD21 chips and burn Arduino official bootloader on them with an Atmel ICE programmer.

I encountered freezes on these 2 boards but that's the same chip, same bootloader so that's pretty obvious.

Rudolph
LCD Guru
Posts: 67
Joined: Wed Feb 28, 2018 11:09 am

Re: Using Custom Fonts

Post by Rudolph »

Sure, I do give up as everyone else. :-)

Well, I have it up and running on my Metro M4 now.
I did not have to change anything, only wire it up correctly to the ICSP pins for SPI.
Yesterday I hooked up a Logic Analyzer to the Metro M4 and found that the default SPI speed is 4MHz.
And with "SPI.setClockDivider(SPI_CLOCK_DIV2);" it is 8MHz.
So this probably is setup the same way as the Arduino core for ESP, with dedicated values for the SPI clock
and redefining what "SPI_CLOCK_DIV2" and so on means in order to get the same speed as it would run on an Arduino Uno.

What was really frustrating me yesterday was that the upload from PlatformIO to the board only worked once.
When I uploaded something from the Arduino IDE, like the blink example I could upload with PlatformIO again - once.
That really was a showstopper.

I dug in and manually replaced the version 1.9.0 of bossac.exe in \.platformio\packages\tool-bossac with
version 1.9.1 from here: https://github.com/shumatech/BOSSA
And now it just works.
I would like to report this somewhere so it gets updated for everyone else but I do not have the slightest idea who is
responsible for the integration of this package into PlatformIO.

Anyways, when I compile with PlatformIO it uses same GCC V7 and in the Arduino IDE I saw 4.8.something.
Adding support for Arduino Zero/M0 was not enough, I am updating "Adafruit SAMD Boards to 1.6.4" now.
...
Oh, it uses GCC9 now: 9-2019q4
And it just works even when compiled with the Arduino IDE.
20201106_200836.jpg
20201106_200836.jpg (54.43 KiB) Viewed 2495 times
I do have the SAMD21 board as well now but it really should not make any difference.
For Arduino this is all using the same code on my side anyways calling SPI.transfer() and digitalWrite().
So as long as the Arduino cores work it should make no difference whatsoever if this is used with an Uno, a Zero, a Metro M4, an ESP, STM32 or whatnot.

But to actually use this D21 board is something different, looks like the "M0" is not really an Arduino, the M0-mini never was one and if the schematic for the board is correct it is anything but not compatible with an M0.
I can only hope that the schematic is wrong but this does not help much. :-)

If there is something to make it crash and burn I have not triggered it yet.

This is the "inner part" of my display function now:

Code: Select all

EVE_color_rgb_burst(WHITE);
EVE_cmd_fgcolor_burst(0x00c0c0c0); /* some grey */
EVE_cmd_dl_burst(TAG(10)); /* assign tag-value '10' to the button that follows */
EVE_cmd_button_burst(20,20,80,30, 28, toggle_state,"Touch!");
EVE_cmd_dl_burst(TAG(0)); /* no touch */
EVE_cmd_dl_burst(DL_COLOR_RGB | BLACK);
EVE_cmd_setfont2_burst(12, MEM_FONT, 32);
EVE_cmd_text_burst(10,190,12,0, "Hello UTF-8: €µäöü");
EVE_cmd_button_burst(20, 120, 80, 30, 28, 0, "Touch!");
EVE_cmd_text_burst(10, 160, 12, 0, "LOOP - The quick brown fox");
EVE_cmd_text_burst(10,80,12,0, "Hello UTF-8: €µäöü"); //€µ°");
EVE_cmd_button_burst(140, 120, 60, 30, 12, 0, "€");
EVE_cmd_button_burst(210, 120, 60, 30, 12, 0, "ü");
EVE_cmd_button_burst(280, 120, 60, 30, 12, 0, "µ");

dood
LCD Geek
Posts: 20
Joined: Fri Oct 30, 2020 5:10 pm

Re: Using Custom Fonts

Post by dood »

Sorry for the delay, busy week-end here !
I'll give a try tomorrow with last "Arduino SAMD Boards" (1.8.4 to 1.8.9).

But I can see that it works like a charm on every hardware you use, so there is something wrong on my side, that's for sure !

dood
LCD Geek
Posts: 20
Joined: Fri Oct 30, 2020 5:10 pm

Re: Using Custom Fonts

Post by dood »

I give another try with last updates (Arduino IDE and boards definition) but no luck.
Rudolph wrote:
Fri Nov 06, 2020 12:39 pm
looks like the "M0" is not really an Arduino, the M0-mini never was one and if the schematic for the board is correct it is anything but not compatible with an M0.
You talk about the mini-M0 you just recieve ?
Because my M0's are Arduino, I'm using "Arduino M0" in "Arduino SAMD boards" and everything is fine.

I can try with an M4 but don't actually have one and won't use it anyway so a little bit useless ... except to know the truth :)

Rudolph
LCD Guru
Posts: 67
Joined: Wed Feb 28, 2018 11:09 am

Re: Using Custom Fonts

Post by Rudolph »

Yes, I am a tad bit sceptic about the mini-M0 I received.
It probably is even working fine - after figuring out which bootloader it uses and what Arduino Core to really use with it.
But I could not find documentation for it, it maybe is a knockoff from the RobotDyn design.

The M4 in this regard really is only annother Arduino with an even higher core clock and more memory.
What I wanted to test is if it makes a difference to not use an AVR 8-bit Arduino but something more powerfull.
And it does not, the SPI runs like on the UNO - although it could clock higher with different settings.
The memory is less full and calculations take less time.
My Arduino code is not using anything special, so still no idea what your issue might be.

dood
LCD Geek
Posts: 20
Joined: Fri Oct 30, 2020 5:10 pm

Re: Using Custom Fonts

Post by dood »

I give a try on PlatformIO, very powerfull compared to Arduino IDE.
That's probably obvious for many people but anyway :)

So I will do some tests with PlatformIO as IDE, I'm not very confident but who knows ...

dood
LCD Geek
Posts: 20
Joined: Fri Oct 30, 2020 5:10 pm

Re: Using Custom Fonts

Post by dood »

No luck, behaviour is the same with PlatformIO.

Anyway I keep using your lib without burst capacities, if I get something nice I'll probably work again on this problem (which is only on my side since you made lots of tests on your hardware !).

amaul
LCD Geek
Posts: 21
Joined: Mon Jun 08, 2020 5:29 pm

Re: Using Custom Fonts

Post by amaul »

Hey Rudolph,

I noticed you've added a custom font with flash features in your latest v5 example set, which is nice as I need both :). Upon the first couple compiles here I do not see any text on the order of "EVE Demo" as I would expect. TEST_UTF8 is set to 1, and REG_FLASH_STATUS is reading 2 so I think my flash is working. I do see text when I set TEST_UTF8 to 0. Was this example working for you on your side? Using Adafruit nRF52840 Feather with should default to general Arduino target.

Thanks!

Alex

Rudolph
LCD Guru
Posts: 67
Joined: Wed Feb 28, 2018 11:09 am

Re: Using Custom Fonts

Post by Rudolph »

Yes, it works, I tried it a couple of times with different boards.

There is this in TFT_init() in tft.cpp:

Code: Select all

#if (TEST_UTF8 != 0) && (EVE_GEN > 2)	/* we need a BT81x for this */
	#if 0
		/* this is only needed once to transfer the flash-image to the external flash */
		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 */
	#endif

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

#endif // TEST_UTF8
Have you changed the "#if 0" at least once to "#if 1" and ran in this way?
Otherwise the data is not written to the FLASH.
I thought it would be a good idea to not write to the FLASH with every reset.

And what this looks like could be seen here for ESP32 with DMA:
https://user-images.githubusercontent.c ... 975d07.png

So it's not much, only the "EVE Demo" Text on top.

Or this one on ATSAME51J19A running bare-metall with DMA and an added gradient:
https://www.mikrocontroller.net/attachm ... 193133.jpg

Post Reply