This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

msp430f5528: Strange Flash Memory Value - Please help!

Part Number: MSP430F5528


Hello everyone!

I'm having trouble writing and reading flash meory. The below is the code to write and read values.

Writing code:

Flash_ptrBfloat=(float *) 0x1900;
FCTL3 = FWKEY;                            // Clear Lock bit
FCTL1 = FWKEY+ERASE;                      // Set Erase bit
*Flash_ptrBfloat = 0;                          // Dummy write to erase Flash seg
FCTL1 = FWKEY+BLKWRT;                     // Enable long-word write

Flash_ptrBfloat=(float *) 0x1904;
*Flash_ptrBfloat = nPipeDia;                      // Write to Flash
Flash_ptrBfloat=(float *) 0x1908;
*Flash_ptrBfloat = nTravelDistance;                      // Write to Flash
Flash_ptrBfloat=(float *) 0x190C;
*Flash_ptrBfloat = nStaticDistance;                      // Write to Flash
Flash_ptrBfloat=(float *) 0x1914;
*Flash_ptrBfloat = nScaleFactor;                      // Write to Flash

Flash_ptrBuint32_t = (uint32_t *) 0x1918;
*Flash_ptrBfloat = nSerialNo;                      // Write to Flash

FCTL1 = FWKEY;                            // Clear WRT bit
FCTL3 = FWKEY+LOCK;

Reading code

  Flash_ptrBfloat=(float *) 0x1904;
  nPipeDia=*Flash_ptrBfloat;

  Flash_ptrBfloat=(float *) 0x1908;
  nTravelDistance=*Flash_ptrBfloat;

  Flash_ptrBfloat=(float *) 0x190C;
  nStaticDistance=*Flash_ptrBfloat;

  Flash_ptrBfloat=(float *) 0x1910;
  nScaleFactor=*Flash_ptrBfloat;

  Flash_ptrBuint32_t=(uint32_t *) 0x1914;
  nSerialNo=*Flash_ptrBuint32_t;

The wrting and reading until 0x190C works fine. But from 0x1910, strange values are written and read. What am I doing wrong?

Plese help me.....

Sukho


                                                Flash_ptrBfloat=(float *) 0x1900;
                                                FCTL3 = FWKEY;                            // Clear Lock bit
                                                FCTL1 = FWKEY+ERASE;                      // Set Erase bit
                                                *Flash_ptrBfloat = 0;                          // Dummy write to erase Flash seg
                                                FCTL1 = FWKEY+BLKWRT;                     // Enable long-word write

                                                Flash_ptrBfloat=(float *) 0x1904;
                                                *Flash_ptrBfloat = nPipeDia;                      // Write to Flash
                                                Flash_ptrBfloat=(float *) 0x1908;
                                                *Flash_ptrBfloat = nTravelDistance;                      // Write to Flash
                                                Flash_ptrBfloat=(float *) 0x190C;
                                                *Flash_ptrBfloat = nStaticDistance;                      // Write to Flash
                                                Flash_ptrBfloat=(float *) 0x1914;
                                                *Flash_ptrBfloat = nScaleFactor;                      // Write to Flash

                                                Flash_ptrBuint32_t = (uint32_t *) 0x1918;
                                                *Flash_ptrBfloat = nSerialNo;                      // Write to Flash

                                                FCTL1 = FWKEY;                            // Clear WRT bit
                                                FCTL3 = FWKEY+LOCK;

**Attention** This is a public forum