Can't access flash - EVE3

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

Moderator: Mods

Post Reply
Martin
LCD?
Posts: 5
Joined: Sat Nov 28, 2020 12:29 pm

Can't access flash - EVE3

Post by Martin »

Hi,

I am developing an application using a EVE3-70G and a STM32F4, based on Rudolphs library (many thanks!).
So far everything works. Except...
I need large fonts and I wanted to use a font I wrote into the external flash (as described in the "using custom fonts" thread). I converted a 60 pixel size font using EAB 1.6 and programmed it into the flash of the display (USB2SPI), all without problems.
However I am not able to access the flash memory from my STM32 code. I put a EVE_init_flash at the beginning of TFT_init and this command hangs.
Specifically, flash_status is read as flash_status_basic, so Eve sees the flash I guess. Then, the command EVE_cmd_flashfast() fails; it hangs forever in the busy loop.
Any ideas? The EAB flash programmer can switch to fast mode (according to the log window) and it states that the blob with the flash parameters was written successfully (also the flash write verify was OK). So the flash memory is there (32 Mbit btw), Eve can access it both in basic and fast mode. I also tried flash_attach and _detach, these also fail.
Any ideas?

- Martin

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

Re: Can't access flash - EVE3

Post by Rudolph »

> I put a EVE_init_flash at the beginning of TFT_init and this command hangs.

Just to be clear, did you put it before for after EVE_init()?

The TFT_init() I more recently tested UTF-8 fonts with looks like this:

Code: Select all

void TFT_init(void)
{
 if(EVE_init() != 0)
 {
  tft_active = 1;
  EVE_memWrite8(REG_PWM_DUTY, 0x30); /* setup backlight, range is from 0 = off to 0x80 = max */
  touch_calibrate();

#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, 363008, 5056); /* copy .xfont from FLASH to RAM_G, offset and length are from the .map file */

  EVE_cmd_inflate(MEM_LOGO, logo, sizeof(logo)); /* load logo into gfx-memory and de-compress it */
  EVE_cmd_loadimage(MEM_PIC1, EVE_OPT_NODL, pic, sizeof(pic));
  initStaticBackground();
 }
}
Before I try to explain every line, just ask if anything is unclear. :-)


Regarding STM32, as I am not using STM32 I did not get that far with the HAL functions.
When I tried to build my PlatformIO example that was building perfectly fine before it is not even working right now.
Somehow the types are no longer recognized, not even after adding #include <stdint.h> which really should not be necessary.
I updated the "ST STM32" platform from 9.0.0 to 10.0.0 but that is not any better.
Something got broken underneath.
When it worked before I believe I had an earlier version, like 8.
Anyways, I am not actively using STM32 and so my EVE_target.h and EVE_target.c are still missing a couple of things like DMA support.
And my main.c for the STM32 example merely has enough code to see the project compile - if it does.
For the benefit of all potential STM32 users I would apreciate some help with this.

Martin
LCD?
Posts: 5
Joined: Sat Nov 28, 2020 12:29 pm

Re: Can't access flash - EVE3

Post by Martin »

Hi Rudolph,

I made some progress in the meantime. I found out that it was not the flash access that failed, but the EVE_busy check. REG_CMDB_SPACE would never read 0xFFC, but always 0xEFC so it stuck in the busy check. I tried all kinds of modifications, but could not make it work.
In the end the solution was to increase the SPI clock. I had it in the MHz range (2 or 3 I think) and set it to 23 MHz and everything worked! Copy font to ram, rendering font from flash - works perfectly.

I have no clue what the problem might have been. It could be signal integrity (display cable is almost 30 cm), but I doubt it - it's perfectly stable and EVE works fine except for this busy issue.
It could be a timing thing - 2 MHz transfers take much longer than 23 MHz?
Or it could be a silicon bug - I darkly remember having read something related here or in the Bridgetek forum.

Regarding STM32: I avoid HAL bloat wherever possible. Use the lightweight LL functions (STM32CubeMX can generate those as well) instead.
As for PlatformIO - don't know about that. I use mainly STM32CubeIDE and IAR, also there's Keil.
So how can I help you regarding STM32?

Thanks! Martin

Post Reply