2024-04-22 07:45 AM
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!
2024-04-26 05:40 AM
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
2024-04-30 10:04 AM - edited 2024-04-30 10:53 AM
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?
2024-05-07 09:48 AM
Here are some changes I made to the code in an attempt to implement SNTP:
File sntp.c:
File init.c
File sntp_opts.h
File lwipopts_freertos.h
When running the code, I see the following log:
I noticed that when I debug the code, I get stuck on the following:
It's possible that this issue is related to this struct, however, I'm still investigating.