Skip to content

SD card access via SDMMC on ESP32-S3 #31

Description

@etnt

Hi,

I just started to play around with the AtomVM; got the erlang/blinky example to work , \o/
on my Freenove ESP32-S3 WROOM. But then I also got a 1 GB SD card that I plugged in...
...after a long session with Copilot , where we patched the AtomVM storage_nif.c code,
"we" got it to work. Don't ask me about the details... :-) I just want to point to my commit in
case it could be helpful for someone else:

etnt@2d240c1

AtomVM init.
I (698) sys: Loaded BEAM partition main.avm at address 0x250000 (size=1048576 bytes)
Starting application...

=== AtomVM SD Card Example ===

Mounting SD card via SDMMC (1-bit mode)...
  CLK=GPIO39, CMD=GPIO38, D0=GPIO40
I (728) storage_nif: SDMMC mount: base_path='/sdcard' clk=39 cmd=38 d0=40 width=1
I (778) storage_nif: SDMMC mount result: 0 (ESP_OK)
I (778) storage_nif: stat('/sdcard') from C: res=0 errno=0 mode=0x41ff
I (778) storage_nif: opendir('/sdcard') from C: ptr=0x3fcb7768 errno=0
  Mount successful!

--- stat /sdcard ---
posix_stat: path='/sdcard' len=7 ok=1
posix_stat: res=0 errno=0
  Type: directory
  Mode: 777
  Size: 0 bytes

--- Writing /sdcard/hello.txt ---
  Wrote 46 bytes

--- Reading /sdcard/hello.txt ---
  Content: Hello from AtomVM!
SD card access is working.


--- Directory listing: /sdcard ---
  TEST3.TXT
  HELLO.TXT

Unmounting SD card...
Done.
Return value: ok
I (868) AtomVM: AtomVM application terminated.  Going to sleep forever ...

Cheers, T.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions