Getting started with SD card Arduino Library

I got it working but here’s what I found out.

I failed to get an ATtiny3226 to work with the SD library. This seems a common problem in some of the threads I read.

I ended up using an Arduino ProMini - this has a ATMEGA328 processor - just like an Arduino Uno.

This has 32K Flash and 2K SRAM.

I had to force PlatfirmIO to use a working version of SD.h by adding it as a library under the PIO Home | Libraries menu - this loaded the line below into my platformio.ini

lib_deps = arduino-libraries/SD@^1.3.0

Even so the small test sketches from Arduino examples took a bunch of RAM and Flash - see the compile output.

Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/pro16MHzatmega328.html
PLATFORM: Atmel AVR (5.1.0) > Arduino Pro or Pro Mini ATmega328 (5V, 16 MHz)
HARDWARE: ATMEGA328P 16MHz, 2KB RAM, 30KB Flash
DEBUG: Current (avr-stub) External (avr-stub, simavr)
PACKAGES: 
 - framework-arduino-avr @ 5.2.0 
 - toolchain-atmelavr @ 1.70300.191015 (7.3.0)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 6 compatible libraries
Scanning dependencies...
Dependency Graph
|-- SD @ 1.3.0
|-- SPI @ 1.0
Building in release mode
Checking size .pio/build/pro16MHzatmega328/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [=====     ]  46.3% (used 949 bytes from 2048 bytes)
Flash: [=====     ]  47.0% (used 14434 bytes from 30720 bytes)

I still need a RTC and still want it to be battery powered so I think I’ll use a 3.3v ProMini at 8MHz and an SD card reader that works directly to 3.3v (mine had a level shifter in the way which I read hogs the SPI bus).