[SOLVED] Problem with Ethernet using branch 1.9 on DISCO_F746NG board

All about boards manufactured by ST
Post Reply
c.dicaprio
Posts: 2
Joined: Sat Aug 20, 2022 9:52 pm

[SOLVED] Problem with Ethernet using branch 1.9 on DISCO_F746NG board

Post by c.dicaprio »

Hello to all,
I have a problem using Ethernet with other library like PNGDec and LVGL on a DISCO_F746NG board.
It appear to me as a memory problem: both library PNGDec and LVGL use a lot of memory, but I need help to point out the right direction to debug the problem.

I'm using the STM32duino branch 1.9 and this librarys:
. STM32duino LTDC branch ver 1.9.0
. STM32duino_STM32Ethernet ver 1.3.0
. EthernetWebServer_SSL_STM32 ver 1.6.0
. Ethernet_Generic ver 2.4.0
. STM32duino_LwIP ver 2.1.2
. STM32duino_STM32SD ver 1.2.3
. Arduino_CMSIS-DSP ver 5.7.0
. PNGdec ver 1.0.1


I modified the Arduino GFX ImageViewPng example to read .PNG files from SDCard and display it [1].
It works without problem. So I have confirmation that: LTDC+SDCard+External SDRAM work well.

I realized another project [2] that download a .PNG image from the WEB, sending back to serial console the HEX values: this works without problem.

Code: Select all

// *************************************************************************************
Console output when the "png.open" is commented out and all is working:

Init Display!

Start WebClient_SSL on DISCO_F746NG with LAN8742A Ethernet & STM32Ethernet Library
EthernetWebServer_SSL_STM32 v1.6.0
Connecting... Connected! IP address: 192.168.1.34
Connecting to : www.ilmeteo.it, port : 443
Connected to www.ilmeteo.it
Took: 377
Initializing SD card...SD Initialization done!
(EthernetSSLClient)(SSL_WARN)(connected): Socket was dropped unexpectedly (this can be an alternative to closing the connection)

Disconnecting.
Received 20536 bytes in 0.9043 s, rate = 22.71 kbytes/second
idx: 614, ln: 19922

89 50 4E 47 0D 0A 1A 0A 00 00 00 0D 49 48 44 52 00 00 01 3B 00 00 01 3B 08 03 00 00 00 95 .... B6 E3 0A 04 
Creating image.png file...
Image Stored! [19922 Byte]
// *************************************************************************************


But when, in the last project, I configure the PNGDec library for display the downloaded .PNG, the ethernet stop to acquire the IP and, if configured with a fixed IP, it does not works too. The project compile without problems, the board restart after the flash download, but the "uint32_t net_res = Ethernet.begin(mac[0]);" instruction return with error:

Code: Select all

// *************************************************************************************
Console output when the "png.open" is compiled and the "uint32_t net_res = Ethernet.begin(mac[0]);" is NO working:

Init Display!

Start WebClient_SSL on DISCO_F746NG with LAN8742A Ethernet & STM32Ethernet Library
EthernetWebServer_SSL_STM32 v1.6.0
Connecting... ERROR: No IP
// *************************************************************************************
To be clear: this occur every time I compile the project with this instruction enabled:

Code: Select all

// *************************************************************************************
    /*
     * If I enable the code below, the Ethernet client will stop to work.
     * The board is no more capable to take an IP using the DHCP even to use a static IP
     * I tried both method: "png.open" and "png.openRAM" but with the same result.
     */
#if 1
    int rc = png.open("image.png", myOpen, myClose, myRead, mySeek, PNGDraw);
    if (rc == PNG_SUCCESS)
    {          
      rc = png.decode(NULL, 0);      
      png.close();
    }
#endif    
// *************************************************************************************
The first thing I did was to increase HEAP and STACK, but nothing changed:

Code: Select all

// *************************************************************************************
C:\Users\%username%\AppData\Local\Arduino15\packages\STM32\hardware\stm32\1.9.0\variants\DISCO_F746NG\ldscript.ld

/* Highest address of the user mode stack */
_estack = 0x20050000;    /* end of RAM */
/* Generate a link error if heap and stack don't fit into RAM */
_Min_Heap_Size = 0x8000;      /* required amount of heap  */
_Min_Stack_Size = 0x4000; /* required amount of stack */

/* Specify the memory areas */
MEMORY
{
RAM (xrw)      : ORIGIN = 0x20000000, LENGTH = 320K
FLASH (rx)      : ORIGIN = 0x8000000, LENGTH = 1024K
SDRAM (rwx)    : ORIGIN = 0xC0000000, LENGTH = 8M    /* sdram, 8MB */
}
// *************************************************************************************
So I'm in stuck with this problem!
Any ideas, tests, debugging strategies are welcome!

Many many thanks for your time.

TIA
Clemente

[1] https://github.com/cledic/STM32duino/tr ... Png_github
[2] https://github.com/cledic/STM32duino/tr ... PNG_github
c.dicaprio
Posts: 2
Joined: Sat Aug 20, 2022 9:52 pm

Re: [SOLVED] Problem with Ethernet using branch 1.9 on DISCO_F746NG board

Post by c.dicaprio »

I solved the problem by inserting two defines in the "variant.h" file to disable the cache:

Code: Select all

#define D_CACHE_DISABLED
#define I_CACHE_DISABLED
Thanks
Clemente
Post Reply

Return to “STM boards (Discovery, Eval, Nucleo, ...)”