Skip to content

Commit 033eac8

Browse files
author
HadoopMarc
committed
Updates Arduino programming docs
1 parent ae44536 commit 033eac8

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

doc/arduino-programming.md

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,26 +28,34 @@ Programming the Arduino Nano should now be so simple as:
2828

2929
## Checking the logs
3030

31-
Once the uploaded program runs, it produces log statements over the serial interface. You can check these by opening the serial monitor of the Arduino IDE (far right button on the taskbar). On powering up the PCB, the GPS-module needs about half a minute to lock on one or more satellites and after that the LCD shutter program needs 10 GPS pulses before generating the second markers in the driver output. During that time the serial monitor only shows:
31+
Once the uploaded program runs, it produces log statements over the serial interface. You can check these by opening the serial monitor of the Arduino IDE (far right button on the taskbar). On powering up the PCB, the GPS-module needs about half a minute to lock on one or more satellites and after that the LCD shutter program needs 10 GPS pulses before generating the second markers in the driver output towards the LCD shutter. During that time the serial monitor only shows:
3232

3333
```log
3434
Configuration of LCD shutter completed.
3535
Stabilizing...
3636
```
37-
38-
After this time the serial monitor shows something like the text below, every second:
37+
After this, the serial monitor shows a few log lines related to the preliminary calibration of the CPU clock frequency relative to the Pulse Per Second (PPS) signal from the GPS module. These lines have the following format:
3938

4039
```log
41-
LCD phase: 0 3 0 12
40+
Micros: 10 10014560
41+
CPU: 16023260
42+
Block: 7822 ticks
4243
```
44+
The CPU frequency should be 16 +/- 0.08 MHz (large error margins because of the cheap ceramic resonator used on the Arduino module). The CPU frequency should only show minor variations during operation. The block ticks refer to the number of required timer events during one half wave (block pulse) of the driver output. This number is derived from the measured CPU frequency and should also show only minor variations.
4345

44-
These are variables used in synchronizing the timer outputs derived from MCU clock with the Pulse Per Second signal from the GPS module. The first and third number should be zero and the second number should be small, indicating that synchronization takes place immediately after the incoming GPS pulse. The difference between the fourth and the second number is the accumulated phase differerence during one second in "ticks" of 4 microseconds, just before synchronization happens. This should be a figure between 0 and 32 ticks (meaning between 0 and 128 microseconds).
46+
The calibration, including logging, is repeated every 60 seconds to account for changes in the operating conditions of the Arduino (power voltage, temperature).
4547

46-
In addition to the logs that occur every second, some more log messages appear every 60 seconds and show the result of recalibrating the MCU clock frequency against the GPS PPS signal. They have the following format:
48+
In addition to the calibration every minute, the serial monitor shows the phase stability of the driver pulse train, relative to the GPS PPS signal. The log lines look something like the text below, every second:
4749

4850
```log
49-
Micros: 60 60087224
50-
CPU: 16023260
51-
Block: 7822 ticks
51+
LCD phase: 0 277 9 1684
52+
LCD phase: 0 3 0 12
53+
LCD phase: 0 4 0 12
5254
```
53-
The CPU frequency should be 16 MHz with an error margin of 0.5% (so large because of the cheap ceramic resonator used on the Arduino module). The CPU frequency should only show minor variations during operation. The block ticks refer to the number of required timer events during one half wave (block pulse) of the driver output. This number is derived from the measured CPU frequency and should also show only minor variations.
55+
56+
These are variables used in synchronizing the timer outputs derived from the MCU clock with the GPS PPS signal. The first and third number should be zero and the second number should be small, indicating that synchronization takes place immediately after the incoming GPS pulse. The difference between the fourth and the second number is the accumulated phase differerence during one second in "ticks" of 4 microseconds, just before synchronization happens. This should be a figure between 0 and 32 ticks (meaning between 0 and 128 microseconds). Only the very first log line shows a large phase difference, because the driver pulse train was not synchronized to the GPS signal before that time.
57+
58+
The logging described above is the logging during normal operation. There are two additional log messages that can occur and they indicate possible failures in the system:
59+
60+
1. "Unexpected GPS pulse arrival. Deviation: 21432 microseconds". This indicates instable operation of the GPS module. This can have all kinds of causes, including a too weak GPS signal, an instable power supply, interference from other systems, hardware failure, etc.
61+
2. "Avoidance triggered". This indicates that synchronization starts before the pulse train of the previous second has finished. Possible causes are a bug in the Arduino script and a hardware failure of the Arduino module.

0 commit comments

Comments
 (0)