Hard fault accessing flash config register (mkl26z)

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Hard fault accessing flash config register (mkl26z)

Jump to solution
629 Views
joeygouly
Contributor IV

Hi all,

I'm trying to refactor some code, and I'm hitting an issue but I can't figure out why.

I have the following code:

void hard_fault_isr() { uart0_putc('1'); }
void flash_erase_sector(uint32_t flashaddr) {
  uart0_putc('u');
  uart0_hex32(flashaddr);
  uart0_hex32(FTFL_FSTAT);
  //*(uint32_t *)&FTFL_FCCOB3 = 0x09000000 | flashaddr;
  [.. snip ..]
}

For some reason I'm getting a hard fault when I try to access FTFL_FTSTAT, or when I try to write to FTFL_FCCOB3. This is code that I have copied from another (working) project of mine.

What am I missing?

Labels (1)
0 Kudos
1 Solution
490 Views
joeygouly
Contributor IV

I had forgotten to gate (?) the FTFA module!

SIM_SCGC6 |= SIM_SCGC6_FTFL;

Fixes my issue!

View solution in original post

0 Kudos
1 Reply
491 Views
joeygouly
Contributor IV

I had forgotten to gate (?) the FTFA module!

SIM_SCGC6 |= SIM_SCGC6_FTFL;

Fixes my issue!

0 Kudos