- 
                Notifications
    You must be signed in to change notification settings 
- Fork 17
Closed
Description
I'm using a struct (~272 byte) to manage my data. Within the struct there are two two-dimentional float arrays each 128 Byte.
when I read out the struct, some data (always [3][4]) of one array is corrupt - showing "-inf".
When I access the dedicated corrupt entry directly the value is read out correctly. ( reading single bytes in the suspected area did als not show any wrong data ...
Are there limitations when using arrays ?
I'm using 24LC256
initalisation:
        myMem.setMemoryType(256); // Valid types: 0, 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1025, 2048   // 21kByte
        myMem.setPageSizeBytes(64);          // 64 Bytes pro Page 
        myMem.setAddressBytes(2);            // 2 Byte Addressierung (16 Bit) für >16 kbit
typedef struct                
{
    uint8_t version;             // 1 byte
    uint8_t reserved[3];       // 3 Byte  padding
    bool   cal_A[4];      // 4 Byte
    bool   cal_B[4];      // 4 Byte
    float   korr_B[4][8];   // 128 Byte
    float   korr_A[4][8];   // 128 Byte
    uint16_t reserved2;        // 2 Byte
    uint16_t crc;              // 2 Byte        
} calstruct;
// TEST read out [3][0] to [3][7] - > value of [3][4] corrosponts to test array[4] is correct
float   mem_valuefloat;
float   test_array[8];
float  test_value2;
offset = offsetof(calstruct, korr_A[3][0]);
for (int i = 0; i < 8; i++) {
       myMem.get((LOCATION_CAL_LIPO + offset + i*(sizeof(float))), mem_valuefloat);  
      test array[i] =  mem_valuefloat;  
}
test_value2 = korr_A[3][4];    -> corrupt data "-inf"
Metadata
Metadata
Assignees
Labels
No labels