Hello,
I have an MCU connected to a BC66. In normal operation the MCU wakes up the BC66 from sleep. Then the time is synchronised via QNTP. After that a UDP message is sent, and then the BC66 is allowed to go to sleep.
See code below.
Usually the the +QNTP response comes immediately after doing the AT+QNTP command, but sometimes it is delay by 15 seconds or more. Additionaly it sometimes disrupts the sleep cycle (the BC66 can’t go to sleep because of it).
In the below example, the +QNTP response comes after having sent the UDP message.
So my question is: how should I deal with this? How long should I wait for a response from the AT+QNTP command? And is there I way to cancel the AT+QNTP process when it has already been started so that it doesn’t disrupt the sleep cycle of the BC66?
N.b. the AT manual tells us very little about this command.
# Wait for BC66 wake up --
Send interrupt to BC66 PSM_EINT pin
Wake up event!
+CPIN: READY
+QATWAKEUP
AT+QSCLK=0
OK
Time to sleep / wake [ms]: 1212
# Wait for BC66 IP connection--
AT+CGPADDR?
+CGPADDR: 1,XX.XXX.XXX.X
IP opbtained!
# Sync BC66 time with server pool --
AT+QNTP=1,"pool.ntp.org"
OK
# Get date and time.
+QCCLK: 22/08/30,13:44:32+08
OK
# Create Socket --
OK
+QIOPEN: 0,0
AT+QNBIOTRAI=1
OK
AT+QISENDEX=0,51,38363739393730333235353834372C332C3232303833303135343432382C312E32352C3132352E30302C302E30302C302E3030
+QNTP: 0,"22/08/30,13:44:33+08"
OK
SEND OK
# Closing socket --
OK
CLOSE OK
# Wait for BC66 sleep --
AT+QSCLK=1
OK
Deep sleep event!
+QNBIOTEVENT: "ENTER DEEPSLEEP"