Skip to main content
BFlin.1
Associate II
November 11, 2024
Question

How to use SNTP over LwIP and RTC with an STM32

  • November 11, 2024
  • 4 replies
  • 2222 views

Hello:
I have followed this exactly...
https://community.st.com/t5/stm32-mcus/how-to-use-sntp-over-lwip-and-rtc-with-an-stm32/ta-p/736706
I am using STM32CubeIDE V1.16.1 with a NUCLEO-H723ZG board.
There are no errors or warnings.
The code runns and I get...

SNTP Client
NUCLEO-H723ZG board
State: Ethernet Initialization ...
State: Looking for DHCP server ...
DHCP Timeout !!
Static IP address: 192.168.0.192

There is no red error light etc..
Can anyone help or perhaps B.Montanari ST Employee, (the author) etc. ?\
Thanks.

4 replies

Andrew Neil
Super User
November 11, 2024

@BFlin.1 wrote:

State: Looking for DHCP server ...
DHCP Timeout !!


So do you have a DHCP server on the network?

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
BFlin.1
BFlin.1Author
Associate II
November 12, 2024

C:\Windows\SysWOW64>ipconfig /all | find /i "DHCP Server"
DHCP Server . . . . . . . . . . . : 10.0.0.1

Andrew Neil
Super User
November 12, 2024

That's the DHCP server that your PC is using.

What about your STM32 ?

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Technical Moderator
November 11, 2024

Hello @BFlin.1 ,

Check your static IP address configurations. Make sure to enable the CPU DCache.

You can try this Nx_SNTP_Client example available in GitHub page and get inspired from this example to use it with Nucleo-H723ZG by following the instructions in the readme file.

"When your question is answered, please close this topic by clicking ""Accept as Solution"".ThanksImen"
BFlin.1
BFlin.1Author
Associate II
November 12, 2024

Maybe please take a look at my set up for issues etc.

Thanks

 

LCE
Principal II
November 12, 2024

So what's your setup, direct connection STM32 ETH to PC ethernet port?

As Andrew says, your STM32 cannot simply connect to some DHCP server via your PC.

Maybe you can find a PC app, or maybe your switch has a DHCP server function?

BFlin.1
BFlin.1Author
Associate II
November 13, 2024

<So what's your setup, direct connection STM32 ETH to PC ethernet port?>

No, I am using straight cable to switch that goes to internet router.

LCE
Principal II
November 14, 2024

Then check if your router has a DHCP server that can be activated.