This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

wl1837 clock sync problem

Other Parts Discussed in Thread: WL1837, WL1837MODCOM8I, WL18XXCOM82SDMMC

Hi all:

I am using wl1837 to do some tests, mainly want to evaluate its clock sync feature; my goal is to get the time offset value between Sta and AP; the document says wilink8 can accomplishes a time accuracy of less than 20 μsec between devices connected to the same AP/Router.

I have two wireless devices;

D1:     AM57x-EVM + WL1837MODCOM8I 

D2:      Freescale imx6qp-sabresd + WL18xxCOM82SDMMC(adaptor card) + WL1837MODCOM8I

I want to sync above two wireless devices,  I use below link as a reference

I only need to implement the ap and master sta as the link says;

but the time offset between two devices is  tens of milliseconds; it seems that the time sync feature did not be enabled;

i don't know what's wrong,can someone provide me some guide to make the time sync feature work;

thank you very much(BTW: if needed ,i will provided my detailed implementation process )

  

  • I read the wilink8 linux driver, and i know that the time sync part of the driver code just to output an GPIO pulse to GPIO11 of wl1837 chip periodically;
    what does this mean? this will sync STA with AP?
    i guess ,maybe,the gpio pulse just trigger the wilink8 chip to capture and register the precise arrival time of the AP's beacons; then, the wl18xx driver will get the arrival time in interrupt handler; but, i don't find the wilink8 driver to change the STA's local time? If the STA don't change its local time,,how STA sync with AP?
    can someone help me ?
    thank you!

  • There are two parts to getting the sync to work as described in that wiki article. From your comments I think you have only looked at the first part.

    - The low layer in the wilink8 driver is the part you've been looking at. The gpio pulse is used to generate in the raw data which gives the local linux time and the AP TSF time at the instance the gpio was toggled. This information is stored in the sysfs.

    - The application (NTP) is responsible for taking this data and using the error between the local kernel and TSF time to update the local kernel time.

    I'd start with the AM57xx EVM as that will be closer to the AM335x implementation that's been done. The steps to do will be:

    - add device tree support for a GPIO for time sync

    - download the R8.7 wi-fi driver, apply the patches and then build and install

    - NTP build and patch should apply cleanly as it is processor independent.

    At run time you also need to run some scripts to enable the wilink driver as shown in enable_sync.sh in the patch set.

    Iain

  • Thanks for your response;

    i am not familiar with NTP app; i want to confirm something;

    From my understanding,The reference ntp demo provide below design:

    Three Slaves STAs sync with Master Sta through NTP dameon; so i can understand the three slaves' ntp dameons would change their linux local time; but  i am not sure whether the ntp dameon runs on the Master STA will change the master's local time?????  

    i do not want to use NTP;  below is my target design:

    I just want to make all my  STAs to sync with AP(also wilink8 device) within 20us, how can i implement this?

    thank you very much .

    sorry for my poor english  -_-!

  • Hi,

    I have expanded your diagram to make it clearer what the different operations are in the system.

    There are two blocks of code running. There is the control loop which takes the reference and estimated times and then updates the linux clock on the host to move the estimate towards the reference time. In this case NTP is used as the control loop as it is an off the shelf solution. The WL18xx driver is used to generate the reference and estimate times to give to the control loop.  Each device runs its own control loop (ie NTP) to manage its own clock. 

    Looking first at the master the WL18xx driver provides 3 pieces of information.

    - The TSF time from the AP at the last sync pulse on the GPIO (TSF time is time since AP was switched on)

    - The offset between TSF time and real time as given by first time NTP connected to an internet server to get an accurate time reference when driver was started. This TSF Offset is then stored by the master and added to each new TSF time value it gets from the WL18xx driver to get the reference for "real time" to feed to the control loop.

    - The linux time at the point the TSF time was taken. This is the estimate for real time that is fed to the control loop.

    The key difference on the slave is that it receives the TSF offset from the master. The assumption is that all stations are locked to the same TSF so by sharing a single offset value from the first device to connect (the master) there is the best reference.

    In your case if you don't want to use NTP then you need to write your own control loop that will take the reference and estimate times and use them to decide how to update the linux clock using the ntp_adjtime() function.

    Iain 

  • thank you for your detailed explanation.
    i know what to do next;

  • Hi Iain Hunter:

    I  have  implemented  your reference design, I use imx6qp-sabresd+wilink8 as AP  and  am57x-evm + wilink8 as Master STA. then i get the time offset between them; below is my results:

    It seems that it worked well; right?

    but as you said, the design feature of ntp leads to slow convergence time;If i want to make the  convergence time as short as possible, how can i achieve this? by modify ntp controler code??

    i hope you can give me some advice,thank you.

  • Hi,

    That is about the performance I am seeing as well. You would need to tune the NTP algorithm to make it converge faster.

    In ntpd/refclock_wl8.c you could increase PRECISION value from 13. This is assumed accuracy of measured clock - I have it set to 2 power (-13) which is 122us. Increasing the value and thus telling algorithm that the measured clock is of tighter accuracy should speed up the convergence.

    I deliberately did not adjust any of the control loop parameters in NTP as i wanted it to be "standard"

    Iain