From 3d946abdfd1cd4536481ff53ed4d0047eb29c447 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Hru=C5=A1ka?= Date: Wed, 10 Jun 2015 02:08:12 +0200 Subject: [PATCH] F_CPU/8 speed for SD card --- lib/sd.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/sd.c b/lib/sd.c index 1fb8462..2ea0e19 100644 --- a/lib/sd.c +++ b/lib/sd.c @@ -45,10 +45,13 @@ bool sd_init() return false; // timeout + // f_cpu/8 speed (-> 2 MHz) + SPSR |= _BV(SPI2X); + SPCR &= 0xFC | _BV(SPR0); + // Set block size to 512 bytes (SD card default) sd_command(SD_SET_BLOCKLEN, 512); - return true; }