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.

MSP430 internal Flash InfoB Write error

Genius 4170 points
Other Parts Discussed in Thread: MSP430F5529

Hello,

ok another wired problem with me and my MSP430.

I want to write float and long values into the internal Flas of my MSP430F5529.

I chose to write and read from InfoB memory since I do not have to unlock it like InfoA and  its size should fit my needs, as I only want to store like 10 values:

InfoB has 128Bytes, and I am right now using 9* 4 Bytes = 36 Bytes in use.

Now following issue, I am using the normal standart Flash read write routines as proposed int the code examples and as described in the FamilyUser Guide for Flash memory:

void wrt_long_InfoB_uint32( unsigned long *uint32_Flash_ptrInfoB, unsigned long uint32_temp)
{

  FCTL3 = FWKEY;                            // Clear Lock bit
  FCTL1 = FWKEY+BLKWRT;                     // Enable long-word write
//  FCTL1 = FWKEY+WRT;                     // Enable word write
//  *Flash_ptrInfoB = f32_KalibFaktor;        // Write a word to flas
  *uint32_Flash_ptrInfoB = uint32_temp;
  FCTL1 = FWKEY;                            // Clear WRT bit
  FCTL3 = FWKEY+LOCK;                       // Set LOCK bit
}

this is my long routine i got another one for floats.

And there is the superstrange problem I need Your help with:

InfoB goes from 0x1900 till 0x197F

Now my routine works perfectly from 0x1900 till approx. 0x1921 and in addresses higher than that it will stop working always gives back 0xFFFF as if the memory never was written to , or always is erased.

I did now try to fix this for about 2 days, I am getting nearer, but I think I I cannot solve this last bit, workaround would be to use InfoC also for the values I would normally want to store after address 0x1921.

Any known issues with the silicon of my version, I really have no clue, so I guess it could be a hardware issue of the MSP430F5529, since my programming routines are simply copy and pastet for the different addresses and ones do work and others dont...

Could need your help, thanks in advance,

seb

  • Update1:

    I did do the workaround with writing my other variable to segment: InfoC beginning with 0x1880


    now the msp430 at least does his duty just like I want him to do :)

    still wanting to know why the msp430 has those flash problems mentioned above though...

  • During a flash write, no interrupts may happen. Your flash write function does not disable interrupts. It may be that after writing some data, an interrupt happens, the CPU jumps into the void and never recovers, resetting the MSP or such.

    Just a guess, as I don't know the surrounding code.

  • Ok, nice to know, thanks for Your advice.

    Indeed I am using TimerA as a 1ms Interrupt source, which is running all the time.

    Now what speaks against Your theory is the fact that my code is perfectly running also during and after the Flash-routines, write and read, it just doesnt read out the flash correctly.

    But I will test it hopefully today I will update this post then, when I know if it works.

    Thanks again.

  • seb said:
    it just doesnt read out the flash correctly.

    Well, flash read shouldn't be a problem. The CPU does it permanently, to fetch its instructions. Also, string constants are read from flash by your code all the time.
    So the problem is not in the read (unless you have a big bug in such a simple task) but int he write.

    Why don't you simply disable interrupts at start and re-enable them at end of your write function and see whether the problem goes away?

    If an interrupt occurs during a flash write, this will not necessarily cause a crash. Depending on flash size and position of code in the flash, it may seem as if the device is operating normally. However, it most certainly won't continue writing the rest of the data.

  • Hi, I also met a similar issue with G2744. I can't program correctly on InfoB, but I can on InfoC and InfoD. Have you finally solved this issue? What is the root cause?

    I found this issue on my own board P1. It seems OK on P0.

    Thanks

  • There should be no difference between InfoB and InfoC. Except for the address, of course. If one works, the other should work too. So either you got a chip with bad flash, or your code has a problem (e.g. assuming InfoB at the wrong address)

    What do you mean with P1/P0?

  • P1/P0 are my HW revisions.

    It turned out that fFTG is not set correctly. It should be between 276kHz ~ 476kHz according to datasheet.

    Thanks.

**Attention** This is a public forum