UC3A flash write function freezes!

Go To Last Post
3 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am using the

#define BOOT_FORCE_DEFAULT_VALUE1	0x929E1424
#define BOOT_FORCE_VALUE1	        ('B' << 24 | 'O' << 16 | 'O' << 8 | 'T')
#define BOOT_FORCE_OFFSET1			0x01FC
flashc_memset32(AVR32_FLASHC_USER_PAGE + BOOT_FORCE_OFFSET1, BOOT_FORCE_VALUE1, 4, TRUE);

to set the user page for the chip. Everything works as expected if I call this function pretty much at the begining of my code from my main loop. But when I call it from another sub function much later in my code, this function freezes the micro.

I traced it further with debug statements and I see the while loop that is inside this flashc_memset32 function is the problem. my print statements up till this while loop shows up. After it doesnt.

Anyone come across this problem?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

have chased it down to this function call now:

void flashc_clear_page_buffer(void)
{
  flashc_issue_command(AVR32_FLASHC_FCMD_CMD_CPB, -1);
}

the micro freezes at the call of flashc_clear_page_buffer() in asf codes...

I get print statements just before the call and not after th call...

at my micro initialization i call this function to set the wait state to 1, i dont think its done anything...

flashc_set_bus_freq(sysclk_get_cpu_hz());
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Stupid ASF code!

looks like the error was in function:

flashc_issue_command()

The function uses flashc_wait_until_ready();
which is defined as:

void (*volatile flashc_wait_until_ready)(void) = flashc_default_wait_until_ready;

After placing instead of it the actual function it points to: flashc_default_wait_until_ready(), the code no longer gets stuck!

I am puzzled however, why the pointer to the function got stuck!! Any clues?