Hi Everyone, Is anyone familiar with the flash programming procedure on the XC164 derivatives? I'm trying to implement a small piece of code that will live in sector 0 of my XC164. At the moment, all I'm trying to do is erase sector 5. I have the following piece of test code:
// Try a little flash programming (erasing sector 5) { // Set some pointers to register locations unsigned int* reg_a = (unsigned int*)(0xfff0AA); unsigned int* reg_b = (unsigned int*)(0xfff054); unsigned int* reg_c = (unsigned int*)(0xff8000); unsigned int* reg_d = (unsigned int*)(0xfff000); // Clear status bits *reg_d = 0x0000; // Clear status bits printf( "Flash status is %x \n", *reg_d ); // Command sequence to erase sector 5 *reg_a = 0x0080; *reg_b = 0x00AA; *reg_c = 0x0033; // Check status bits again printf( "Flash status is %x \n", *reg_d ); // Wait for flash to be no longer busy while( *reg_d & 0x0001 ) { _nop_(); } }