Skip to content

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

Open
@erosenst

Description

@erosenst
  • Development Kit: Wemos D1
  • IDF version (git rev-parse --short HEAD
    ~/esp$ git rev-parse --short HEAD ESP8266_RTOS_SDK/
    fatal: not a git repository (or any of the parent directories): .git
    ~/esp$ git rev-parse --short xtensa-lx106-elf
    fatal: not a git repository (or any of the parent directories): .git
    (done with git clone, about ~2weeks ago)
  • Development Env: nano, make
  • Operating System: Ubuntu 18.04
  • Power Supply: USB

Problem Description

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

  • Wemos D1
  • Deek-Robot ID:8122 (SPI (buffered?) micro SD slot, + I2C RTC)
  • generic 433Mhz board to get(/set) sensor data
  • SSD1306 I2C ~1" oled display (128x32)

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions