FreeRTOS NO Ping stm32h735

Hello FreeROTS friends,

I’m having an issue with the simple implementation of FreeRTOS TCP Plus on stm32h735. After successfully building and debugging through numerous errors, following the documentation, I’m unable to execute a “ping.”

My code gets stuck in the NetworkInterface.c file, precisely at this point:

ulTaskNotifyTake( pdFALSE, ulMaxBlockTime );

When sending a PING, I receive a negative response. My pins are correctly configured (I know this because I implemented LwIP). I have a small blink application where I can see that FreeRTOS is working, and I can print to the screen with Linux, but I’ve been struggling with this issue for a week, and I can’t seem to resolve it.

I need advice and guidance.

Hey @HispaEmo, sorry to hear that you’ve gotten stuck on this. I’ve got some basic questions to learn some more about your system:

  • You say your code gets stuck at ulTaskNotifyTake(), do you have multiple tasks running at this point where the other tasks keep going?
    • I find it can be helpful to leave a second task that does something like blink an LED just to ensure the system hasn’t completely halted
  • What Network Interface are you using? I’m assuming you’re using the STM32Hxx interface, but just want to make sure
  • Do you have a link to your project or anything that’d you be willing to share to help us further understand your issue?
  • When you say “When sending a PING, I receive a negative response” do you mean:
    • Sending a ping from the device out, the device then receives a negative response
    • Sending a ping to the device from your local development machine receives a negative response?
  • Have you maybe tried this project that @htibosch linked in an older FreeRTOS Forum Thread?

Sorry for all the questions, just trying to narrow down what the exact issue is so we can help you figure it out!

Assuming that you are using the STM32Hxx network interface and you are not able to ping your device from another device (which may be your PC), can you put breakpoints at the following places -

  1. Is the Ping request received by the device and handed over to the IP task? FreeRTOS-Plus-TCP/source/portable/NetworkInterface/STM32Hxx/NetworkInterface.c at V4.0.0 · FreeRTOS/FreeRTOS-Plus-TCP · GitHub
  2. Is IP task getting Ping request? FreeRTOS-Plus-TCP/source/FreeRTOS_IP.c at V4.0.0 · FreeRTOS/FreeRTOS-Plus-TCP · GitHub
  3. Is IP task handling Ping request - FreeRTOS-Plus-TCP/source/FreeRTOS_ICMP.c at V4.0.0 · FreeRTOS/FreeRTOS-Plus-TCP · GitHub

Let us know whatever you find.

1 Like

hi @aggarg @skptak ,

Hello FreeRTOS friends,

I’m back seeking guidance. I want to mention that I’ve configured this project without using the IDE, by manually setting up the necessary ETH pins for its operation.

I’ve followed the documentation on the page, but I’m unable to get the ping working.

-I’ve used a configuration for printing with the terminal.

My program is stuck in a loop in the FreeRTOS_IP.c file:

c

static void prvProcessIPEventsAndTimers( void )
{
(...)

  switch( xReceivedEvent.eEventType )
    {
        case eNetworkDownEvent:
            /* Attempt to establish a connection. */
            prvProcessNetworkDownEvent( ( ( NetworkInterface_t * ) xReceivedEvent.pvData ) );
            break;

I have uploaded the repository to GitHub:

I’m a newbie in FreeRTOS, and I greatly appreciate any kind of assistance.

Can you please check this thread?. Seems to be the same issue, but I might be wrong.

1 Like

I’d also recommend to generate one project using IDE and get that working first as that should be faster. Once you have that working, you can compare your manually configured one for the differences and figure out if you missed something.

1 Like

hi @NikhilKamath

Yes, yesterday I was reading this post because I also think it is related to my issue.

I have implemented the missing code in the functions:


void HAL_MspInit(void)
{
  /* USER CODE BEGIN MspInit 0 */

  /* USER CODE END MspInit 0 */

  __HAL_RCC_PWR_CLK_ENABLE();
  __HAL_RCC_SYSCFG_CLK_ENABLE();
/* PendSV_IRQn interrupt configuration */
  HAL_NVIC_SetPriority(PendSV_IRQn, 15, 0);
}

And also in the function HAL_ETH_MspInit():

/* ETH interrupt Init */
HAL_NVIC_SetPriority(ETH_IRQn, 5, 0);
HAL_NVIC_EnableIRQ(ETH_IRQn);
HAL_NVIC_SetPriority(ETH_WKUP_IRQn, 5, 0);
HAL_NVIC_EnableIRQ(ETH_WKUP_IRQn);

The compiler throws an “undefined” error with __HAL_RCC_PWR_CLK_ENABLE();. I don’t know how to configure this.

If I comment out this line //__HAL_RCC_PWR_CLK_ENABLE();, the program throws an error in the stm32hxx_hal_eth.c file, in the function `

void HAL_ETH_IRQHandler( ETH_HandleTypeDef * heth ){

(...)
    /* ETH MAC Error IT */
            if( __HAL_ETH_MAC_GET_IT( heth, ( ETH_MACIER_RXSTSIE | ETH_MACIER_TXSTSIE ) ) )
            {

And it goes back to the loop in Debug mode at the same point.

I have a couple of tasks, like blink, when the interruption arrives, these stop working.

thank you.

@HispaEmo

Are you using the STM32Cube to generate the code? If so,HAL_MspInit is a function that is generated and should be building for you right after the code generation itself.

Also, are using the ethernet drivers provided in the +TCP network interface for STM32H devices?

Here is an example +TCP project targeting the STM32H723ZG Nucleo board.

1 Like

Per this comment from @HispaEmo , it does not seem to be the case. As I have mentioned before, I’d suggest again to get a project working using CubeMX so that you have something working to compare against.

1 Like

HI @aggarg

Sorry if I explained myself poorly. I always build projects starting from the IDE, and then I add the FreeRTOS Kernel and FreeRTOS TCP Plus, their folders to the project. This implies some duplications, especially in the eth files.

Anyway, I appreciate your advice because I’m starting from scratch with this project, and it’s often overwhelming dealing with the numerous issues that come up.

Thanks!

HI @tony-josi-aws

After trying for about a week to implement TCP Plus and attempting a ping without success, I downloaded this project and changed the pins, respecting those of my H735 board.

The ping works successfully, and I appreciate your response. However, how can I understand its operation?

My project is behind schedule, and I need to progress faster. Any suggestions?

My next goal is to implement coreHTTP and make a request to a webpage. I welcome any advice, guides, repositories, or anything that can help me achieve this.

Thanks!

@HispaEmo,

The ping works successfully, and I appreciate your response. However, how can I understand its operation?

I believe the main difference between the project that I shared and the one you are using is that the one I shared makes use of the ethernet drivers provided in the +TCP network interface for STM32H devices, and yours might be using the one thats generated for you by the STM32Cube IDE. And you should also follow the instructions suggested in the readme.md file of the STM32Hxx driver folder as not all RAM locations are accessible to the Ethernet MAC in the STM32Hxx devices.

Note that the +TCP version used in the shared example might not be the latest.

My next goal is to implement coreHTTP and make a request to a webpage. I welcome any advice, guides, repositories, or anything that can help me achieve this.

You can refer to the coreHTTP demos listed in this repo to get started with including coreHTTP in your project.

1 Like

Hello @tony-josi-aws ,

Regarding the project you suggested, I have a question.

In the memory, .ethernet_data appears twice, once in FLASH and once in RAM_D1.

imagen

Is this intended, or can I delete one of them to save space in memory?

Thank you very much.

I do not think you need to have it in Flash. Can you share your linker script .ethernet_data section? It should look like the following - STM32_Nucleo_H723ZG_FreeRTOS_TCP/STM32H723ZGTX_FLASH.ld at master · tony-josi-aws/STM32_Nucleo_H723ZG_FreeRTOS_TCP · GitHub?

Make sure you do not have >RAM_D1 AT> FLASH.

1 Like

hey @aggarg

Thank you. If I remove it from RAM_D1, my project stops working. However, if

/* Ethernet data. */
. = ALIGN(4);
.ethernet_data :
{
  PROVIDE_HIDDEN (__ethernet_data_start = .);
  KEEP (*(SORT(.ethernet_data.*)))
  KEEP (*(.ethernet_data*))
  PROVIDE_HIDDEN (__ethernet_data_end = .);
} >FLASH AT>RAM_D1

I don’t manage to free up space in FLASH.

same with.

= ALIGN(4);
  .ethernet_data :
  {
    PROVIDE_HIDDEN (__ethernet_data_start = .);
    KEEP (*(SORT(.ethernet_data.*)))
    KEEP (*(.ethernet_data*))
    PROVIDE_HIDDEN (__ethernet_data_end = .);
  } >RAM_D1

many thanks!

You do not need to remove from RAM_D1.

= ALIGN(4);
  .ethernet_data :
  {
    PROVIDE_HIDDEN (__ethernet_data_start = .);
    KEEP (*(SORT(.ethernet_data.*)))
    KEEP (*(.ethernet_data*))
    PROVIDE_HIDDEN (__ethernet_data_end = .);
  } >RAM_D1

Are you sure that with this one you have .ethernet_data in flash too? If yes, please share the map file.

1 Like

It may be the case that the duplicate sections are initialized RAM variables, with the “dupes” in flash being the source which is copied to RAM at startup. What is the code running in you reset interrupt handler? Is there a copy loop at the very beginning?

1 Like

Hello again, @NikhilKamath @RAc @aggarg @tony-josi-aws @skptak

I’ve been working on other layers, but I’m reaching out again because I’m running out of space.

I’m sharing my memory layout with you. The only way I found to avoid duplicating the ethernet_data in both flash and RAM_D1 is:

.ethernet_data (NOLOAD):
{
	. = ALIGN(8);
	*(.ethernet_data)
	*(.ethernet_data*)
	. = ALIGN(8);
} >RAM_D1

As you can see, the .bss section is too heavy, and I’m trying to allocate it in another memory space. Is this possible? I’ve researched enabling HyperRAM, but I can’t get the application to work with .bss hosted in OCTOSPI2.

Any advice?

many many thanks

You can try reducing the size of .bss.

This is a question for ST. Please reach out to ST.

1 Like