espressif / ESP8266_RTOS_SDK

Latest ESP8266 SDK based on FreeRTOS, esp-idf style.
http://bbs.espressif.com
Apache License 2.0
3.35k stars 1.57k forks source link

How do I.. SD card using example please (GIT8266O-835) #1259

Open erosenst opened 1 year ago

erosenst commented 1 year ago

Problem Description

Hello, bought week ago esp8266 board and like to do datalogger from it with external SD card. Hardware:

I got 433Mhz listening work with timer1. (It need some fix in timer sources to correct some registry problem, was somewhere in github issues). Timer1 seems to run lot faster in FreeRTOS than arduino even 255_div. Basically good for accurate timing. (maybe you fix timer registry problem here too, someone may like it already done in SDK..?)

Now I need to write data to SD card. I use chip select line IO:2 because builtin led to see when card active. Similiar code work in arduino. SD-card filesystem may be FAT, but better if crash tolerant like LittleFS, but files may present lot and 32GB (or more) card may use. MD5 sum from data files is good too, same data may appear many time, so no need save all.. RTC example with internal rtc / external I2C RTC with NTP update..?

Problem: can't find any example how to use SD-card in esp8266 with FreeRTOS. Can you provide simple mount/umount example with write/del file, mkdir/rmdir and check file present/not, fsync?

//Detailed problem description goes here. Google lot, but nothing usable and some relative pages seems to porn sites..

Expected Behavior

examples/ dir should contain ready to use external SD-card example..

Actual Behavior

No findable examples with google / SDK. However sdfat.h seems present..

Steps to repropduce

git clone and look examples dir..

// It helps if you attach a picture of your setup/wiring here.

SPI: D13 (15) MOSI D12 (12) MISO D1 (14) SCK and D9 (2) to SS I2C: D5 SCL, D4 SDA

Code to reproduce this issue

ls examples/ | grep sd