Skip to main content
Visitor II
April 22, 2024
Question

NTP using STM32CubeExpansion_Cloud_AWS_H5_V1.0.0 example

  • April 22, 2024
  • 1 reply
  • 1200 views

Hello, I hope you are well.

I'm working with a project, where the base code is the example "STM32CubeExpansion_Cloud_AWS_H5_V1.0.0", I need the current time somehow. So I thought about SNTP, however, I don't have much knowledge on the subject, I would like to know if there is any simple way to get the time using the connections that the example makes with AWS.

Can anyone help me? Thanks in advance!

    This topic has been closed for replies.

    1 reply

    ST Employee
    April 26, 2024

    Hi @ffjunq,

    the LwIP middleware library integrated in this package provides an SNTP client example.

    Alternatively, you may find more convenient to simply parse the unix timestamp passed by AWS IoT Core in some message metadata (see for instance the device shadow service: https://docs.aws.amazon.com/iot/latest/developerguide/iot-device-shadows.html).

    Cheers

     

     

    ffjunqAuthor
    Visitor II
    April 30, 2024

    Thank you for your support @grd

    I really need it to be SNTP. However, I am facing difficulties, I am not familiar with the LwIP stack.

    I tried some ways, for example: https://community.st.com/t5/stm32cubeide-mcus/lwip-sntp-what-does-it-actually-do/td-p/319642/page/2, where it was cited by @Piranha: https://stackoverflow.com/questions/61932743/how-does-the-sntp-app-of-the-lwip-component-set-the-time-it-receives. When I run this example the code crashes. I don't know how to continue, can you help me?