Part Number: MSP430I2041
Tool/software: Code Composer Studio
I try to use TI example at
but cannot write any thing to flash.
In the example, write to flash at 0x1060, but program cannot write to this address, if I change to wirte to RAM, it's ok.
I see all example not erase the flash segment before write, is it true?
Anyone help me solve this problem.
I only use TI example, not modify any thing!
I don't have the board set up right now to test, but I'm fairly certain I have recently tested the first example you linked and it was working for me. How are you check the flash at 0x1060, did you look at it with the Memory viewer? As for erasing, you are correct that this example doesn't erase the segment. It is writing to the info memory which contains device critical TLV calibration data. Without this data, the device is basically useless, so all software project actually check that it's still intact. If it's missing, then none of our example project will boot.
You can still erase this section if you like, but you have to take extra care in your project to preserve and re-write the TLV data back to where it belongs.
I was recently working on a MSP430I2040 reference design that was storing Calibration data in the info memory. I'll try and share with you my example project. Based on my testing it is successfully saving TLV, erasing the section, and writing a large amount of data. But, no guarantee that the code is perfect and it may be possible to still brick the device, but it definitely erases and writes flash.
I'll find it and share it.
We are glad that we were able to resolve this issue, and will now proceed to close this thread.
If you have further questions related to this thread, you may click "Ask a related question" below. The newly created question will be automatically linked to this question.
In reply to JD Crutchfield:
Here is that project that I was recently working on developing. MSP430I2040_Calibration_Data_Loader.zip
Take a look and let me know if it helps.
Thanks JD Crutchfield,
I use debug to check flash data after write. You can see I write 0xAA to address 0x1060 but the data get back always 0x00.
In reply to huy pham:
You can also look at the memory directly. If you go to View - Memory Browser. There you can just input the address 0x1060 and see all the flash bytes.
Let me know if you get it working with the example I shared.
Hi, There is the memory browser I captured. It shows 0x00 value at 0x1060 in memory.
Note : I debug on the TI Example code to debug the simple program first, not in your code.
Writing flash can't write 1s, it can only change 1s to 0s. Once a flash byte is all 0s it will stay that way until you erase it.
As JD pointed out, erasing the Information Segment is hazardous, and needs to be done carefully. Thus there are limitations to anything a self-contained Example can show you.
It looks as though you have succeeded in writing to flash (since it's 0s now). What is your longer-term goal?
In reply to Bruce McKenney47378:
As you mentioned, the TI example won't work properly and need add some things to work, like add delete before writing.
Is the TI example too obscure for everyone starting with the MSP430i? If "erasing the Information Segment is hazardous, and needs to be done carefully", the example can be try to Read, Write, Erase on others memory location to show full step for writing to flash.
I wonder that TI did not try to run the example before its release.
Maybe. I would say that the Example is limited in what it can actually show you. It does (evidently) write to flash, which is what it claims. Other flash-write Examples have different hazards -- one I recall would wear out your flash if you left it running for a few minutes.
I think JD offered you an alternative Example. Did you look at that?
Thanks Bruce McKenney47378.
I try the JD offered and it's working properly.
My application is an energy measurement and it will write some values to flash when it finds an interrupt on AC current
Glad to hear that it's working.
I want to point out that my example still is not completely fool-proof. There is a small-time window between erasing the info-memory and writing the TLV data back to Flash that the device is vulnerable. If a reset/power cycle happens at this point, the calibration data can be lost and render the MSP430I20xx useless.
You will see I added a 2-3 second delay at the start of the program, and that is because without it when I went to reprogram the device the timing between power and reset from the JTAG/SBW programmer was exactly hitting this window and bricked some devices. So, I added a delay as a quick work around.
Maybe in the future, I can continue to improve it and find a way to protect against power, reset, or programming interruptions.
All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.
TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs andembedded processors, along with software, tools and the industry’s largest sales/support staff.