cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H563 MQTT Client failed interface status check

Sander_UP
Associate III

Hello!

I am facing a problem with the STM32H563VIT6 trying to set up MQTT client. I tried to take STM32H573I-DK\Applications\NetXDuo\Nx_MQTT_Client example as a base example on how to do it, but it has not worked for me. The problem I am facing is that no IP can be acquired and thus the MQTT client will not work. I have set up everything correctly in the netxduo header file (DNS, MQTT broker name).

What I am trying to achieve right now is to have the board send simple MQTT packets to my computer (like in the STM32H573I exmaple). The board is connected to the router.

I tested a simple MQTT packet sending by doing it from my phone to my computer. Also, connected my phone to the router via an Ethernet cable, and with using the Wi-Fi. In both times, the test was successful, so from that it seems that the problem cannot be in my computer or in the router.

When debugging the program the error I receive is from the App_Link_Thread_Entry. Getting this error after calling nx_ip_interface_status_check -> 0x43 - NX_NOT_SUCCESSFUL.

 

What I have tried in hopes of fixing it:

  • Change Ethernet cables.
  • Create my own DHCP server on my computer and connect the board via Ethernet cable to my computer.
  • Lower the clock speed for the ETH interface (250MHz, 125MHz, 64MHz).

As of right now, I am out of ideas about what to do next. Any help would be greatly appreciated!

1 ACCEPTED SOLUTION

Accepted Solutions
Sander_UP
Associate III

Hello @MOBEJ and @STackPointer64.

Thank You for the suggestions. @MOBEJ Will definitely check out the webpage You provided.

Today I managed to get MQTT working. I removed TLS, Crypto, DNS, SNTP and everything that was dealing with the security part. Also, used the nxd_mqtt_client_connect function instead of the secure one.

After removing some stuff from the project, the function nx_ip_interface_status_check is returning NX_SUCCESS. Maybe the problem was in the DNS, as I had my computer's IP address (digits) in the MQTT_BROKER_NAME string, and DNS might have processed it as it was an actual name, and not as a valid IP address (digits). Right now, I added a function that converts the MQTT_BROKER_NAME string into a hex value, and so far so good.

Although there is one thing when basing the project on the Nx_MQTT_Client example - every time I reset my device I have to disconnect and reconnect the Ethernet cable.

For the next steps, I will start to slowly add back all the things I removed.

View solution in original post

4 REPLIES 4
MOBEJ
ST Employee

Hello @Sander_UP 

I recommend reading the article available in the STCommunity Knowledge Base at the following link:
How to use the LwIP Ethernet middleware on the STM32H5 series

This article provides a clear, step-by-step guide on using LwIP with the STM32H5 series. It demonstrates a simple DHCP connection implementation using the NUCLEO-H563ZI board, covering everything from configuring the basic hardware setup to the complete firmware implementation, ultimately achieving a successful network connection.

br

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
STackPointer64
ST Employee

Hello @Sander_UP,

Have you tried monitoring the traffic using Wireshark to see if the DHCP DORA process (Discover, Offer, Request, Ack) completes or stops at any point? If it completes, two ARP packets following it will reveal the IP address allocated by the DHCP server. Please verify this in your case before we proceed with debugging MQTT.

Best regards,

To improve visibility of answered topics, please click 'Accept as Solution' on the reply that resolved your issue or answered your question.
Sander_UP
Associate III

Hello @MOBEJ and @STackPointer64.

Thank You for the suggestions. @MOBEJ Will definitely check out the webpage You provided.

Today I managed to get MQTT working. I removed TLS, Crypto, DNS, SNTP and everything that was dealing with the security part. Also, used the nxd_mqtt_client_connect function instead of the secure one.

After removing some stuff from the project, the function nx_ip_interface_status_check is returning NX_SUCCESS. Maybe the problem was in the DNS, as I had my computer's IP address (digits) in the MQTT_BROKER_NAME string, and DNS might have processed it as it was an actual name, and not as a valid IP address (digits). Right now, I added a function that converts the MQTT_BROKER_NAME string into a hex value, and so far so good.

Although there is one thing when basing the project on the Nx_MQTT_Client example - every time I reset my device I have to disconnect and reconnect the Ethernet cable.

For the next steps, I will start to slowly add back all the things I removed.

STackPointer64
ST Employee

I think to solve that issue, you need to copy the implementation of the App_Link_Thread_Entry function from the MQTT example into your code. It will keep running as a thread and periodically detect when the link is down.

To improve visibility of answered topics, please click 'Accept as Solution' on the reply that resolved your issue or answered your question.