B4R Question Write alot files into SD Card


Active Member
Licensed User
Longtime User

I try to write 1K++ files into SD Card. When run the program, It pop out then error log.

I set the Stack Buffer Size to 20000 but still go error.

Sub Process_Globals
Private sd As SD
End Sub

Private Sub AppStart

For i = 1 To 1500
        If sd.Exists(i) = False Then
            Log("Write ", i)
        End If
End Sub

private Sub SaveData(data As String)
    Dim Buffer() As Byte
    If sd.OpenReadWrite(data) = True Then
        sd.Position = sd.CurrentFile .Size
        Buffer = bc.StringToBytes(data)
    End If
End Sub

Exception (3):
epc1=0x40100221 epc2=0x00000000 epc3=0x00000000 excvaddr=0x4000f210 depc=0x00000000
ctx: cont
sp: 3ffffd00 end: 3fffffd0 offset: 01a0
3ffffea0:  000000ff 00000001 3ffee874 40203e93
3ffffeb0:  00000005 00000001 0000000f 401065b5
3ffffec0:  3ffee8f4 00000000 3ffee874 40203eb6
3ffffed0:  3ffee8f4 00000000 3ffee874 402043ec
3ffffee0:  3ffee8f0 3ffee8f4 00000001 00000467
3ffffef0:  3ffeed08 0000022e 0000022e 4010020c
3fffff00:  3ffee810 3fff058c 3ffee818 401006dc
3fffff10:  3ffee810 3fff058c 3ffee818 40203abc
3fffff20:  3ffee7c8 3fff0580 3ffee85c 40203120
3fffff30:  3ffee810 3fff058c 3ffee85c 40202f00
3fffff40:  3fffff48 3fff0000 00000000 40205520
3fffff50:  3ffee7c8 3ffee7c8 00000000 40202a90
3fffff60:  402060d8 00000000 3ffee85c 0000005d
3fffff70:  00000000 3ffee7c8 3ffee85c 40202f7d
3fffff80:  3ffee810 00000000 0000012c 401004e4
3fffff90:  feefeffe feefeffe 3ffeebc4 3ffeebcc
3fffffa0:  3fffdad0 00000000 3ffeebc4 40203168
3fffffb0:  feefeffe feefeffe feefeffe 40205af0
3fffffc0:  feefeffe feefeffe 3ffe85dc 40100739
 ets Jan  8 2013,rst cause:2, boot mode:(3,7)
load 0x4010f000, len 1384, room 16
tail 8
chksum 0x2d
csum 0x2d

What cause this error.

thank you.
Last edited:


Active Member
Licensed User
Longtime User
Does it log anything except of the error?

Are you able to save a single file?

Yes, I able to save a single file. Save until 800++ record then show out the error log.
When increase Stack Buffer Size , it can save more.
Upvote 0