FLASH STM32U5 Quad Word Size - Confused!
I'm confused by ST's seeming definition of what they think a QUAD word is....according to most of the planet a WORD is 16-bits, so a QUAD word is 64-Bits. However according to ST a quad word is 128 bits on the STM32U535.
I enclose a section of my code - essentially I want to write 11520 values which are U32's and then read them again when I power it back up, bit its getting confused because I can't get my head around whether there's 64, or 128 bits in a QUAD WORD!
xnLookup[][][] is the Parameter I want to write, and the read back which is a U32
This is the WRITE:
i=0;//Channel 0..3
j=0;//Temperature 0..180 (-50 to +130DegC)
k=0;//Term X0, X1, X2, X3 etc
n=1;//Counter for every 4th flash word
MemCount=0;//Total memory locations
//was 11520 for -50 to +130DegC. change to
for(m=0;m<11520;m++)//Total number of parameters to write - //12160
{
//Copy the polynomial term into the flash array
flashdata32[n-1].l=xnlookup[k][i][j].l;//Put the polynomial term onto the flash array
//Every 4 itterations, write the array to flash
if(n==4)
{
n=0;//reset the counter
HAL_FLASH_Program(FLASH_TYPEPROGRAM_QUADWORD, FLASH_TLOOKUP+MemCount, ((u32)flashdata32));
MemCount=MemCount+16;//Next QUAD word - 16 BYTES
}
//Do the relevant index incrementing - next temperature, next channel, or next term
if(j>=180)
{
j=0;
i++;//i is the channel number 0..3
if(i>=16)
{
i=0;
j=0;
k++;//k goes 0,1,2,3 for each polynomial term
}
}
n++;//n is the Flashword index 0..3 4 words =16 bytes
j++;//j is the temperature index
}
//Now lock the flash
HAL_FLASH_Lock();
}This is the READ:
//Read all of the configuration data
void Read_TLookup(void)
{
u16 i,j,k,l;
u32 MemCount;
l=0;
k=0;
//Read the Polynomial Calibration values
l=0;
for(k=0;k<4;k++)//Polynomial order index (X0, X1, X2, X3)
{
for(i=0;i<16;i++)//channel
{
for(j=0;j<180;j++)//temperature index - was 180, change to 190
{
MemCount=l*4;
xnlookup[k][i][j].l=*(u32*)(FLASH_TLOOKUP+MemCount);//floating point representation
l++;
}
}
}
}
