We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
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_(); } }
Hello Paul, I have'nt tried it yet by myself, but if you look into folder Keil\C166\Flash\XC16x-16F you will find the file FlashDev.c. This is the source code of the JTAG flash programmer driver, and it works, for sure. Just take a look, maybe you will have the right inspiration... Ciao Bruno
Ah yes, those files should help me a lot. Many thanks, Bruno!