RTC keeps time between POWER OFF & ON, SD Card at start still needs work -- if card is in the slot, it is not readable until it is pulled on and then inserted.

This commit is contained in:
John Poole 2026-02-13 18:52:17 -08:00
commit 544d459c9b
11 changed files with 1288 additions and 6 deletions

View file

@ -0,0 +1,39 @@
## Exercise 05: SD Card Watcher
This exercise continuously watches SD card presence and prints state-change events.
Watcher behavior:
1. Initializes PMU and enables SD power rail (AXP2101 BLDO1).
2. Polls for card changes with debounced state transitions.
3. Emits events only on change:
- `EVENT: card inserted/mounted`
- `EVENT: card removed/unavailable`
- `EVENT: no card detected`
4. On mount event, prints card info and runs SD write workflow.
5. Every 15 seconds while mounted, runs a periodic write/permission check.
6. Uses fast preferred probe (`HSPI @ 400k`) and occasional full fallback scan.
Files used in this exercise:
- `/Exercise_05_test.txt`
- `/test/testsub1/testsubsub1/Exercise_05_test.txt`
## Build
```bash
source /home/jlpoole/rnsenv/bin/activate
pio run -e node_a
```
## Upload
```bash
source /home/jlpoole/rnsenv/bin/activate
pio run -e node_a -t upload --upload-port /dev/ttyACM0
```
## Monitor
```bash
screen /dev/ttyACM0 115200
```