I want to add the timestamp capability to my FTP server.
So I wrote a NTP client to set the clock of my STM32-E407 board and use the RTC driver
The code is at Github and it work fine... except for two problems:
1) It works with the ChibiOS version 3.0.0p5 but not with 3.0.0p6.
It hangs (led stop blinking) when calling netconn_gethostbyname() at the beginning of function ntpClient() of file ntp/ ntp.c
If I replace the files chibios3\os\various\lwip_bindings\arch\sys_arch.c and sys_arch.h by the ones of version p5, it works.
2) The clock is too fast
It lead 80 seconds every 10 minutes. This is a 13% drift
I see at the RTC driver topic that VVo got a similar problem with an other board. I try to modify some parameters but do not found which one changes the frequency of the clock. I shall post the question on this topic.
NTP client and RTC
- Giovanni
- Site Admin
- Posts: 14892
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: NTP client and RTC
I am not sure about the RTC, is it using the internal oscillator? it is very imprecise.
About lwIP, the change has been minimal, it should better support lwIP. Are you running with debug options enabled? especially the state checker should help.
Giovanni
About lwIP, the change has been minimal, it should better support lwIP. Are you running with debug options enabled? especially the state checker should help.
Giovanni
Re: NTP client and RTC
Hi Giovanni
About the RTC: I solve it and put a reply in the RTC driver topic. (but I am surprised of this enormous value of drift, because the board has an 32768 Hz quartz oscillator)
About netconn_gethostbyname(), I have to make more tests.
Thank you for your fast response.
Jean-Michel
About the RTC: I solve it and put a reply in the RTC driver topic. (but I am surprised of this enormous value of drift, because the board has an 32768 Hz quartz oscillator)
About netconn_gethostbyname(), I have to make more tests.
Thank you for your fast response.
Jean-Michel
Re: NTP client and RTC
The RTC is now more precise and synchronization works fine.
I think the problem with netconn_gethostbyname() was related to the lwip start race condition as related here.
I do not update the corresponding GitHub repository because of the little library for NTP client is part of my Ftp server, updated on GitHub.
The drift over 24 hours is about 10-12 seconds. So I guess the board use a ceramic resonator to generate the 32768 Hz frequency.
I think the problem with netconn_gethostbyname() was related to the lwip start race condition as related here.
I do not update the corresponding GitHub repository because of the little library for NTP client is part of my Ftp server, updated on GitHub.
The drift over 24 hours is about 10-12 seconds. So I guess the board use a ceramic resonator to generate the 32768 Hz frequency.