2021-06-27 06:20 AM
Hi there
I want to do a write operation on ST10 flash. I'm using a example code from its datasheet. here is the code:
FCR0H|= 0x1080; /*Set DWPG, SMOD*/
FARL = 0x0000; /*Load Add in FARL*/
FARH = 0x0000; /*Load Add in FARH*/
FDR0L = 0x0000; /*Load Data in FDR0L*/
FDR0H = 0x0000; /*Load Data in FDR0H*/
FDR1L = 0x0000; /*Load Data in FDR1L*/
FDR1H = 0x0000; /*Load Data in FDR1H*/
FCR0H|= 0x8000; /*Operation start*/
I couldn't find the definition of these registers in any library. the I defined them. (below code):
uint16_t* FARH = (uint16_t*)0x000E0012; /* Flash Address Register High 0000h */
uint16_t* FARL = (uint16_t*)0x000E0010; /* Flash Address Register Low 0000h */
uint16_t* FCR0H = (uint16_t*)0x000E0002; /* Flash Control Register 0 - High 0000h */
uint16_t* FCR0L = (uint16_t*)0x000E0000; /* Flash Control Register 0 - Low 0000h */
uint16_t* FCR1H = (uint16_t*)0x000E0006; /* Flash Control Register 1 - High 0000h */
uint16_t* FCR1L = (uint16_t*)0x000E0004; /* Flash Control Register 1 - Low 0000h */
uint16_t* FDR0H = (uint16_t*)0x000E000A; /* Flash Data Register 0 - High FFFFh */
uint16_t* FDR0L = (uint16_t*)0x000E0008; /* Flash Data Register 0 - Low FFFFh */
uint16_t* FDR1H = (uint16_t*)0x000E000E; /* Flash Data Register 1 - High FFFFh */
uint16_t* FDR1L = (uint16_t*)0x000E000C; /* Flash Data Register 1 - Low FFFFh */
uint16_t* FER = (uint16_t*)0x000E0014; /* Flash Error Register 0000h */
uint16_t* FNVAPR0 = (uint16_t*)0x000EDFB8; /* Flash Non Volatile Access Protection Reg. 0 ACFFh */
uint16_t* FNVAPR1H = (uint16_t*)0x000EDFBE; /* Flash Non Volatile Access Protection Reg. 1 - High FFFFh */
uint16_t* FNVAPR1L = (uint16_t*)0x000EDFBC; /* Flash Non Volatile Access Protection Reg. 1 - Low FFFFh */
uint16_t* FNVWPIRH = (uint16_t*)0x000EDFB6; /* Flash Non Volatile Protection I Reg. High FFFFh */
uint16_t* FNVWPIRL = (uint16_t*)0x000EDFB4; /* Flash Non Volatile Protection I Reg. Low FFFFh */
uint16_t* FNVWPXRH = (uint16_t*)0x000EDFB2; /* Flash Non Volatile Protection X Reg. High FFFFh */
uint16_t* FNVWPXRL = (uint16_t*)0x000EDFB0; /* Flash Non Volatile Protection X Reg. Low FFFFh */
uint16_t* XFICR = (uint16_t*)0x000EE000; /* XFlash Interface Control Register 000Fh */
and to use them,
*FCR0H|= 0x1080; /*Set DWPG, SMOD*/
*FARL = 0x0000; /*Load Add in FARL*/
*FARH = 0x0000; /*Load Add in FARH*/
*FDR0L = 0x0000; /*Load Data in FDR0L*/
*FDR0H = 0x0000; /*Load Data in FDR0H*/
*FDR1L = 0x0000; /*Load Data in FDR1L*/
*FDR1H = 0x0000; /*Load Data in FDR1H*/
*FCR0H|= 0x8000; /*Operation start*/
but it didn't work. could you please tell me, what I should do?
thanks in advance.