cancel
Showing results for 
Search instead for 
Did you mean: 

AzureRTOS Nx_TCP_Echo_Server on NUCLEO-H743ZI2

Irek
Associate II

Hello everyone,

I use the NUCLEO-H743ZI2 board in my project and previously, Before I've used the MBed OS - it works well on this board, just I need to maximize TCP transfer speed as well as QSPI. So I decided to try another RTOS. After reading forums, I decided to try the Azure RTOS and Cube IDE. I chose the Nx_TCP_Echo_Echo_Server example as a starting point. I reconfigured it to use with NUCLEO-H743ZI2, and also I disabled DHCP as I don't need it. Also added plenty of printf functions at different steps in the app_netxduo.c. As result project can be build, and I see next messages in Terminal:

The network cable is connected.
nx_ip_interface_status_check == NX_SUCCESS.
nx_ip_address_set == NX_SUCCESS.
nx_tcp_socket_create == NX_SUCCESS .
nx_tcp_server_socket_listen == NX_SUCCESS .
TCP Server listening on PORT 5000
STM32 NX_APP_DEFAULT_IP_ADDRESS: 192.168.0.200
Next is the tx_semaphore_get

Then I try to ping the board I see the blinking LED on the Ethernet connector of the board but I get :

Ping statistics for 192.168.0.200:
Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),

Thus, it looks like the function

static VOID tcp_listen_callback(NX_TCP_SOCKET *socket_ptr, UINT port)
{
tx_semaphore_put(&TCPSemaphore);
}

never called.

I already spent two days trying to find solutions. All receipts which I found - like
https://community.st.com/t5/stm32-mcus/ethernet-not-working-on-stm32h7x3/ta-p/49479
I implemented them - the result is the same.


Does anyone have any idea where is the problem?
Thanks in advance.

 

20 REPLIES 20
mbarg.1
Senior II

You must add some more info to get valuable feedback like if you are running some demo or 100% your code.

In case you are NetXDuo primitive, try look at stats embedded in NX_IP structure.

You can get an idea if ethernet is working properly.

Thank you for reply!
As I am a newcomer here, could you please explain what should I upload? The whole project now is 160Mb and in ZIP it is 50 Mb - probably this is too large?
Thank you in advance!

Here is the zip-archive of my project with an empty Debug folder.

I had a look at your code and:

  1. you did not see my post "

    STMCubeMX migration to v6.13 FW H7 V1.12 " -

    - LinkerScript define RxDecripSection but code use RxDescripSection;
  2. It seems you have 2 projects nested one inside another - avoid as it make difficult to troubleshoot;
  3. when you share a project, delete all Debug dir - will be smaller.

I stop here - let me know if you are ok

Thank you for your reply!
After correction RxDescripSection to RxDecripSection and TxDescripSection to TxDecripSection result it the same - my board do not respond to ping. Also now I got not a success return value from the 

status = nx_ip_interface_status_check(&NetXDuoEthIpInstance, 0, NX_IP_ADDRESS_RESOLVED,
&actual_status, 10);

lines in the app_netxduo.c
As for the "2 projects nested one inside another " - I don't have any idea why it happened as I used the Import STM32Cube example wizard! Honestly for me this is the 2nd project in CubeIDE - first was LED blinking. 

I loaded your code and got stuck at

HAL_StatusTypeDef UART_WaitOnFlagUntilTimeout(UART_HandleTypeDef *huart, uint32_t Flag, FlagStatus Status,
                                              uint32_t Tickstart, uint32_t Timeout)
{
  /* Wait until flag is set */
  while ((__HAL_UART_GET_FLAG(huart, Flag) ? SET : RESET) == Status)
  {
    /* Check for the Timeout */
    if (Timeout != HAL_MAX_DELAY)
    {
      if (((HAL_GetTick() - Tickstart) > Timeout) || (Timeout == 0U))
      {

        return HAL_TIMEOUT;
      }

      if ((READ_BIT(huart->Instance->CR1, USART_CR1_RE) != 0U) && (Flag != UART_FLAG_TXE) && (Flag != UART_FLAG_TC))
      {
        if (__HAL_UART_GET_FLAG(huart, UART_FLAG_ORE) == SET)
        {
          /* Clear Overrun Error flag*/
          __HAL_UART_CLEAR_FLAG(huart, UART_CLEAR_OREF);

as if you do have a bad .ioc.

Here a valid .ioc & .ld

Generate a new project with this .ioc, replace .ld. you should be ok.

I suggest you create a new project for your board with a single project.

Good morning Mbarg,

Unfortunately all the magic passes :) don't work. 
My previous project had not any problems with USART but you have them.

I inserted in it valid .ioc & .ld from you - this did not help. Even more - this ioc gave me next problems with Ethernet:
Untitled.png

So I followed your advice and created a new project.
I have configured Azure as shown here. 

I added a blinking LED3 like here - to know that the board is working 

I changed MPU configuration according to this link. 

I did correction RxDescripSection to RxDecripSection and TxDescripSection to TxDecripSection according to this link. 
And finally I added app_netxduo.c and app_netxduo.h from old project.
As result - LED blinking, USART working, Ethernet initialized well, but still I can't ping my board!

And I don't know which shaman's tambourine to bang now.
Can you help, please?
Thank you very much in advance!

 

 

 

Sorry, but you did NOT follow my instructions correctly.

I asked you to generate a new project from my .iot, using STM32CubeIde menu New -> STM32 Project From Existing ... - see screenshot.

Actually your project has wrong ETHERNET GPIO Settings - Nucleo board use other pins !!

Also .ld is not what i sent - @line 141, there is no include ... and you have not my MB_H743.ld extension in your project.

Good morning Mbarg,

Ок, I created new project as you suggested - see it in attachment.
Just in your Azure RTOS settings, I disabled most of the Ethernet features as I need a very simple thing - TCP server with static IP address. And I inserted the content of the MB_H743.ld inside STM32H743ZITX_FLASH.ld as I have another folder structure. Also I added app_netxduo.c and app_netxduo.h from old project.

As result, the project can be build and uploaded to the board, but it restarts every second - I see it in the Terminal. 
And I still do not have a chance to ping my board. 

> Actually your project has wrong ETHERNET GPIO Settings - Nucleo board use other pins !!
I have looked the official document - mb1364-h743zi-c01_schematic.pdf
And yes, you are right - the two pins TX_EN and TXD0 are connected to another pins compare to official STM's ioc file for this H743ZI2 board. Strange! Why ioc file was not tested?

What I can do now?
Just as remark: I need a very simple thing - TCP server with static IP address. I use official STM's board and I do not understand why it takes one week of fight without success to do such simple thing?