Closed ethanjli closed 3 years ago
Attached are the instructions @mathengejob found to work in setting up the MAX3231 RTC. I will try to follow these instructions on my own Raspberry Pi with my own MAX3231 module and report my findings; afterwards, we can work on making a script to automatically apply these setup steps.
My findings from trying to follow Job's instructions:
/boot/config.txt
before following the remaining instructions. Initially I tried following all the instructions at once before rebooting, but then I realized that I can't initialize the time on the RTC until after I reboot once.sudo hwclock -w
, turning off wifi, shutting down the RPi and booting it up a few minutes later, the system time was still correct (this is not true without the RTC module enabled). I did not need to perform steps 6 or 7 - it looks like step 6 is for pre-systemd versions of Raspbian.Right now our deployment scripts are not really designed to have the system restart in between. I think what we could do is have a setup_rtc.sh
script which runs at the start of the deployment pipeline (maybe even before install.sh
) and can be run multiple times (detecting what it needs to do based on what's inside /boot/config.txt
) so that we don't try to run install.sh
multiple times - as that would slow down the deployment process by causing yarn build
to be run twice. Another option is to move yarn build
into deploy.sh
instead of install.sh
which could make more sense; then we could run setup_rtc.sh
at the start of deploy.sh
instead. This is probably the best option.
The other option is to include something to track and check the phase of the deployment process in a file on the filesystem, but that seems like it could be more error-prone in edge cases.
Well noted,
Steps 1-6 will be done before the creation of the OS- image
Step 7 is to be run during , by the end user using an interface, only once when commissioning, assuming the Wifi feature will be turned off.
We will need to support a hardware RTC module on the Raspberry Pi so that it can keep accurate time even when the RPi is shut off and disconnected from wi-fi. This will be either an I2C or SPI device and we will need to have a kernel module driver supporting it so that it adjusts the RPi's system time.