How do I Store variables to FLASH memory of the C2000 F28335 controller using matlab ?
이전 댓글 표시
I want to store the uint16 values received through the SCI block to a Flash memory of the controller.
답변 (1개)
Antonin
2015년 2월 6일
Hi Kamal,
Open the following demo:
c28x_ccp_ert
and click on the info button present in the model, or search for the following sentence in the doc: "CAN Calibration Protocol and External Mode".
Go the following chapter: Signal Logging and Parameter Tuning with External Mode
In this section, we show how to save a parameter in flash and load it to RAM at startup for tuning with External mode.
Once you are happy with the new value, you can re-generate code to save the new parameters in flash.
I understand that this is a little different from what you are asking. One blocker to save one parameter in flash dynamically is the fact that you have to erase an entire flash section, just to save 1 parameter. People usually use an EEPROM to dynamically save calibration parameters. I've seen many interfaced via SPI and accessed with the SPI blocks, that's probably the best solution.
I hope it helps,
Cheers,
Antonin.
댓글 수: 4
Antonin
2015년 4월 1일
Here is a link to the help page of the CAN Calibration Protocol and External Mode example that uses c28x_ccp_ert
Here is a link to another example showing how to store variables to an EEPROM connected via I2C:
I hope it helps,
Antonin.
omer cakmak
2019년 8월 5일
편집: omer cakmak
2019년 8월 5일
Hi Antonin;
I have examined your example "CAN Calibration Protocol and External Mode" in detail. In the "Signal Logging and Parameter Tuning with External Mode" chapter you said:
STEP_PARAM takes advantage of a custom storage class package labeled tic2000demospkg to load the parameters on the flash memory and run them from the RAM for calibration using the ramfuncs section available in the memory map.
Actually I have not used custom storage class package yet, maybe because of this I couldn't understand the example.
But how can you do this exactly, could you please give some information. For example; do we need some blocks in order to implement this demo package. Or where is the code section that write to flash memory? How did this package determine to write STEP_PARAM into flash memory.
I asked this because my aim is writing(or storing) some parameters (for example Kp, Ki of controller) into flash memory at the specified adress such as 0x300000(Section H),once at the initialization and use these parameters whenever code runs. Parameters should be copied/read from flash while code while running. To do this,so far I used "memcopy" and "memory allocate" block but they don't program the flash directly. I attached a simple screen shot about memcopy. When I connect via debugger I saw there was another thing at that adress. Not 13.

In my Code Composer Code there was a section: about "Flash program". Maybe I need this function to be generated. This code section worked well.

As I can understand this example is answer of my question but I couldn't get the idea behind the model.
I looked all of the blocks in the model and I don't have idea about some blocks. So I admit that I should do more research about writing to flash memory. Where should I start? Can you give me some clues?
Thanks in advance;
Best ragards;
Ömer Ç
PS: I do not use any SCI or SPI block in my model. I do not need them.
Hi Omar,
Did you found any solution for your problem? I have the same issue, I want to write a parameter to an specific location of memeory, and use it. The location should be fixed to ensure the boot loader will not effect the fixed parameter during updating the code (over air update.)
Kind regards,
Ehsan
Aditya Padmanabha
2022년 11월 18일
Hi Eshan,
Its better to create a new issue if you need help on anything.
For your question, you can refer to the file exchange example Simulink Reference Application Examples for TI C2000 - File Exchange - MATLAB Central (mathworks.com) to write to Flash memory.
Regards,
Aditya
카테고리
도움말 센터 및 File Exchange에서 Texas Instruments C2000 Processors에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!