cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with TouchGFX generated Project and LWIP/Ethernet

kens0o
Associate II

Hi,

i am having problems with TouchGFX generated Project and LWIP/Ethernet

My Software setup:

STMCubeIDE Version: 1.9.0

TouchGFX Version: 4.19.1

STM32Cube_FW_H7_V1.10.0

My Hardware setup:

STM32H747I-DISCO

I have followed the steps in the ST-article How-to-create-project-for-STM32H7-with-Ethernet-and-LwIP-stack-working (can't add link) but can't ping the board. There is no Ethernet interrupt or RX callback, but GPIOs are set to high speed and ETH global interrupt is enabled and set to priorty 5 - preemption and 0 - subpriority.

Ping works in the attached example from the article, even when I migrate to the new H7-FW (after using the steps under 10. STM32Cube_FW_H7_V1.10.0 (and newer) specific issues).

I think there might be a problem with the MPU region, since I read somewhere that the M4 core is accessing the 0x30040000 with 0x10040000 and I have setup the same address there (sorry i am new to dualcore and mpu configs - see region 4 to 7 in my config). here is my config:

void MPU_Config(void)
 
{ 
 MPU_Region_InitTypeDef MPU_InitStruct = {0}; 
 
 /* Disables the MPU */
  HAL_MPU_Disable();
 
  /** Initializes and configures the Region and the memory to be protected
 
 */
 
 MPU_InitStruct.Enable = MPU_REGION_ENABLE;
 
 MPU_InitStruct.Number = MPU_REGION_NUMBER0; 
 MPU_InitStruct.BaseAddress = 0x90000000; 
 MPU_InitStruct.Size = MPU_REGION_SIZE_256MB; 
 MPU_InitStruct.SubRegionDisable = 0x0; 
 MPU_InitStruct.TypeExtField = MPU_TEX_LEVEL0; 
 MPU_InitStruct.AccessPermission = MPU_REGION_FULL_ACCESS; 
 MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_DISABLE; 
 MPU_InitStruct.IsShareable = MPU_ACCESS_NOT_SHAREABLE; 
 MPU_InitStruct.IsCacheable = MPU_ACCESS_NOT_CACHEABLE; 
 MPU_InitStruct.IsBufferable = MPU_ACCESS_NOT_BUFFERABLE; 
 
 HAL_MPU_ConfigRegion(&MPU_InitStruct);
 
 
 /** Initializes and configures the Region and the memory to be protected
 */ 
 MPU_InitStruct.Number = MPU_REGION_NUMBER1; 
 MPU_InitStruct.Size = MPU_REGION_SIZE_128MB; 
 HAL_MPU_ConfigRegion(&MPU_InitStruct);
  
 /** Initializes and configures the Region and the memory to be protected
 */
  MPU_InitStruct.Number = MPU_REGION_NUMBER2; 
 MPU_InitStruct.BaseAddress = 0xD0000000; 
 MPU_InitStruct.Size = MPU_REGION_SIZE_32MB; 
 MPU_InitStruct.IsCacheable = MPU_ACCESS_CACHEABLE;  
 HAL_MPU_ConfigRegion(&MPU_InitStruct);
 
 /** Initializes and configures the Region and the memory to be protected 
 */
 
 MPU_InitStruct.Number = MPU_REGION_NUMBER3; 
 MPU_InitStruct.BaseAddress = 0x24000000; 
 MPU_InitStruct.Size = MPU_REGION_SIZE_512KB; 
 MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_ENABLE; 
 HAL_MPU_ConfigRegion(&MPU_InitStruct);
 
 /** Initializes and configures the Region and the memory to be protected 
 */ 
 MPU_InitStruct.Number = MPU_REGION_NUMBER4; 
 MPU_InitStruct.BaseAddress = 0x10000000; 
 MPU_InitStruct.Size = MPU_REGION_SIZE_256KB; 
 HAL_MPU_ConfigRegion(&MPU_InitStruct); 
 
 /** Initializes and configures the Region and the memory to be protected 
 */
 
 MPU_InitStruct.Number = MPU_REGION_NUMBER5; 
 MPU_InitStruct.BaseAddress = 0x10040000; 
 MPU_InitStruct.Size = MPU_REGION_SIZE_32KB; 
 MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_DISABLE; 
 HAL_MPU_ConfigRegion(&MPU_InitStruct);
 
  /** Initializes and configures the Region and the memory to be protected 
 */
  MPU_InitStruct.Number = MPU_REGION_NUMBER6; 
 MPU_InitStruct.BaseAddress = 0x30040000; 
 MPU_InitStruct.TypeExtField = MPU_TEX_LEVEL1; 
 MPU_InitStruct.AccessPermission = MPU_REGION_NO_ACCESS; 
 MPU_InitStruct.IsCacheable = MPU_ACCESS_NOT_CACHEABLE; 
 HAL_MPU_ConfigRegion(&MPU_InitStruct); 
 
 /** Initializes and configures the Region and the memory to be protected 
 */
 
 MPU_InitStruct.Number = MPU_REGION_NUMBER7; 
 MPU_InitStruct.Size = MPU_REGION_SIZE_256B; 
 MPU_InitStruct.TypeExtField = MPU_TEX_LEVEL0; 
 MPU_InitStruct.IsShareable = MPU_ACCESS_SHAREABLE; 
 MPU_InitStruct.IsBufferable = MPU_ACCESS_BUFFERABLE; 
 HAL_MPU_ConfigRegion(&MPU_InitStruct);
 
 /* Enables the MPU */ 
 HAL_MPU_Enable(MPU_PRIVILEGED_DEFAULT); 
}

Another clue I got is this: in the ethernetif.h there is this complete section grayes out, but i am using the GNU Compiler:

#if defined ( __ICCARM__ ) /*!< IAR Compiler */ 
#pragma location = 0x30000260 
extern u8_t memp_memory_RX_POOL_base[]; 
 
#elif defined ( __CC_ARM ) /* MDK ARM Compiler */ 
__attribute__((at(0x30000260)) extern u8_t memp_memory_RX_POOL_base[]; 
 
#elif defined ( __GNUC__ ) /* GNU Compiler */ 
__attribute__((section(".Rx_PoolSection"))) extern u8_t memp_memory_RX_POOL_base[];
 
#endif

So I think the problem could be the structure of the TouchGFX generated Project.

On the left is the TouchGFX generated Project, which links only some files to the CM7 Subproject and on the right is the example project which has the files directly included in the CM7 subproject

0693W00000QKCpFQAX.png 

Thank you for any help and hints!

17 REPLIES 17

You are right, the connection fails after a few minutes, even with minimal load.

Can you give me a hint which lwIP/FreeRTOS settings I have to check?

I am in search for now. It looks like new HAL driver (from CubeIDE 1.10) is more ​promising while still might have some DMA issues. Right now I do have uptime of 1h 30m with constant TCP and ICMP load. iperf shows average 40Mbit/s Ethernet input to MCU and 10Mbit/s of output from MCU bandwidth. Will send you my best settings as I will have moreless stable setup.

I already found your post and read the links, but it is hard for me to figure out if they all concern the FW_H7_1.10 and which of these points could be the reason for the link failing after 5 to 30 minutes.

It would be nice if you could lead me in the right direction.

All of the lwIP related issues are definitely still broken and causing problems.

Hello ! I'm facing the same kind of problem.

I generated a project with TouchGFX Designer, opened the .ioc file with CubeMX and added Ethernet connectivity along with the LwIP stack.

I opened the project with CubeIDE and it seems that it cannot build the project because there are no reference to "lwip.h" (eventhough I can open it by right-clicking it -> open declaration). Just like you said, the LwIP files are in the first CM7 folder. I tried including paths in the settings of the project for eliminating some of the undefined references but it wasn't the solution. What did you do exactly for changing the structure of your project and linking the files ?

Hi,

I didn't change the structure of my project. I just open the Project with "open Projects from File System", add my files to CM7/Core/Inc and /Src and generate a file link of my files in /Src to STM32CubeIDE\CM7\Application\User\Core. I didn't have problems with the link files, CubeIDE just can't see the code in your Project, when you open files outside of it (especially included files).

Here is a screenshot of my includes for comparison:

0693W00000QKukxQAD.png

Piranha
Chief II

So, continuing from this topic...

> But I can't figure out where the DMA transfers are resumed.

The DMA transfers are resumed by issuing a poll demand. On H7 this is done by a write to the respective descriptor tail pointer register.

Read the following from RM0399 Rev 3:

61.9.4 Performing normal receive and transmit operation

61.4.1 DMA controller; DMA transmission in default mode, DMA reception

There is an issue with inconsistent naming and wrong and misleading documentation for these registers on H7. This is described/reported there:

https://community.st.com/s/question/0D53W00000EGsnUSAT/how-does-ethernet-rx-descriptor-wrapping-work-on-stm32h7