B4R Question ESP32S, ArrayCopy error

Mostez

Well-Known Member
Licensed User
Longtime User
the sub below reads RFID card number from RDM6300 module, and displays the number on OLED display, I used this code with arduino and leonardo with no errors, i made some modifications to run it on ESP32S, when I use ArrayCopy or ArrayCopy2 I get the error below
I used this simple loop to copy the array, and it worked OK, I don't know is that a bug or my code needs modifications?
B4X:
For X = 0 To BufferLast.Length - 1                ' no erros with this solution, array copy or array copy2 causes ESP32 to reset
    BufferLast(X) = Buffer(X)
Next
RandomAccessFile version: 1.91

load:0x40078000,len:8896
load:0x40080400,len:5816
entry 0x400806ac
Guru Meditation Error: Core 1 panic'ed (InstrFetchProhibited). Exception was unhandled.
Core 1 register dump:
PC : 0x03394639 PS : 0x00060930 A0 : 0x800d2bb6 A1 : 0x3ffc8c10
A2 : 0x3ffc4f44 A3 : 0x3ffba4b8 A4 : 0x8008ea60 A5 : 0x3ffc8b30
A6 : 0x00000000 A7 : 0x3ffc6d20 A8 : 0x800d2b69 A9 : 0x3ffc8bd0
A10 : 0x3ffc4fbc A11 : 0x3ffc4efc A12 : 0x00000022 A13 : 0x00000001
A14 : 0x3ffc8bd8 A15 : 0x3ffc8be0 SAR : 0x0000000a EXCCAUSE: 0x00000014
EXCVADDR: 0x03394638 LBEG : 0x4000c2e0 LEND : 0x4000c2f6 LCOUNT : 0x00000000
Backtrace: 0x03394639:0x3ffc8c10 0x400d2bb3:0x3ffc8c30 0x400d3fd2:0x3ffc8c50 0x400db4c9:0x3ffc8c70 0x4008e84d:0x3ffc8c90
Rebooting...

B4X:
private Sub ReadRFID(Buffer() As Byte)
    Dim tmpBuffer () As Byte
    Dim Str_HexNumber As String
    Dim Int_Number As ULong
    
    If BC.ArrayCompare(Buffer,BufferLast) = 0 Then Return'compare last read card to recent one
    tmpBuffer= BC.SubString2(Buffer,3,11) 'get card bytes only, get ride of checksum and start byte
    Str_HexNumber = BC.StringFromBytes(tmpBuffer)
    Int_Number = Bit.ParseInt(Str_HexNumber, 16) 'convert hex to decimal string
    If Int_Number = 0 Then Return
    Dim Int_Str()As Byte = NumberFormat (Int_Number,10,0)
    
    'OLED.StopScroll
    RandomDisplayTimerTicks = 0                        'avoid screen saver while reading (reset timer)
    NoReadingTimerTicks = 0
    DisplayCardNumber(Int_Str)
    'Log(StackBufferUsage)
    
    'BC.ArrayCopy(Buffer,BufferLast)                    'copy last read to recent one, for next comparison
    'BC.ArrayCopy2(Buffer,0,BufferLast,0,Buffer.Length)
    
    For X = 0 To BufferLast.Length - 1                ' no erros with this solution, array copy or array copy2 causes ESP32 to reset
        BufferLast(X) = Buffer(X)
    Next
    
    If BKP.isConnected Then
        BKP.WriteStr(Int_Str,10)
        BKP.Write(13)
        BKP.Write(10)
        BeepConfirm
    End If
    
End Sub
 

Mostez

Well-Known Member
Licensed User
Longtime User
yes I did, I used values up to 2000 with no success, now i'm trying to use GlobalStore
 
Upvote 0

janderkan

Well-Known Member
Licensed User
Longtime User
How large are your compiled program?
If close to limit you can experiment with Partitionsscheme in 'Board selector'
 
Upvote 0
Top