AnsweredAssumed Answered

Data bus error (solved)

Question asked by Onemars on Jan 31, 2017
Latest reply on Feb 1, 2017 by Onemars

Hello,

on a FRDM-K64F demoboard I get an Hard Fault when reading the flash from 0xFE0C0 to 0xFE0CF and from 0xFF0C0 to 0xFF0CF, any other nearby byte can be read without errors. Reading a byte or a full word gives the same error.

From the CFSR register it seems the fault is caused by a "precise data bus error" and BFAR is at the location I'm trying to read.

This is the code, I'm using KDS with a new clean Kinetis SDK 2.x project:

static uint8_t* ptr;
static uint8_t b;
static uint8_t c[16];

int32_t main(void)
{
    BOARD_InitPins();
    BOARD_BootClockRUN();
    {
        // Ok:
        ptr = (uint8_t*)0xFE0BF;
        b = *ptr;
        c[0] = b;

        ptr = (uint8_t*)0xFE0D0;
        b = *ptr;
        c[1] = b;

        ptr = (uint8_t*)0xFF0BF;
        b = *ptr;
        c[2] = b;

        ptr = (uint8_t*)0xFF0D0;
        b = *ptr;
        c[3] = b;

        // Faults:
        ptr = (uint8_t*)0xFE0C0;
        b = *ptr;
        c[4] = b;

        ptr = (uint8_t*)0xFF0C0;
        b = *ptr;
        c[5] = b;
    }
    for(;;)
        __asm("NOP");
}

Am I doing something stupid or is my flash gone bad?

Thank you

Outcomes