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.

TMS570LC4357: F021 API Read Issues After Writing

Part Number: TMS570LC4357

Hi, Dear Ti Team

After using the F021 API to write data to the on-chip flash, when I try to read the data using the F021 API or by retrieving the address, I find that the data is still the same as before. This seems to be a caching issue. How can I resolve this problem? It’s worth noting that I don’t want to disable the cache.

image.png

image.png

  • Hi Shuo,

    Please refer below similar issue thread:

    (+) TMDX570LC43HDK: DMA can't read some data correctly(trying to sci tx) - Arm-based microcontrollers forum - Arm-based microcontrollers - TI E2E support forums

    You can follow one of the workarounds that i mentioned in above thread.

    --
    Thanks & regards,
    Jagadish.

  • Hi, jagadish

    I made the following changes:

    While debugging, I found that the data is present regardless of whether the program is paused or not.


    I then performed an erase operation; the flash contents are FF only during execution; otherwise, they remain the original data:

    At the same time, the content I read from the flash is also raw data. What could be the reason for this?

  • Hi Shuo,

    Few questions.

    Which sectors of flash you are erasing (How many sectors and what are those)?

    Are you not doing any writing after erasing?

    Is it possible to share your code for verification?

    --
    Thanks & regards,
    Jagadish.

  • Hi,jagadish

    The sector I erased was 3, with the corresponding address being 0xC000. The code is running in sector 11. Let me add:

    1. After disabling the cache, the data retrieved is updated in real time.

    2. Even with caching enabled, if I call `_dCacheInvalidate_()` before reading the data, the data I retrieve is still updated in real time.

    However, what puzzles me is that I didn't encounter this issue in my previous test projects.

    As shown below:

  • Hi Shuo,

    Apologies still i didn't get issue yet. Please verify my understanding:

    In this below testing you disabled cache completely and then you could see the data updation in real time.

    However, in below case that is cache enabled and write through configured for RAM, in that case you can't see real time updation in debug window. You can be able to see data only once it pause the debug.

    Can you confirm this, in your second case (cache enabled and write through configured), did UART sending data correctly? Do you have only issue with memory window of debugger?

    --
    Thanks & regards,
    Jagadish.

  • Hi,jagadish

    I may not have explained it clearly.

    Initially, the 0xC000 address contained data. In debug mode, whether the program is running or paused, this data is visible in the memory browser.

    Then I performed a erase operation on the data at address 0xC000.

    In debug mode, you can only see the original data change to 0xFF while the program is running; when paused, the data remains as it was originally.

    At the same time, the data read by the `Fapi_doMarginReadByByte` function is also the original data.

    I'm sorry, but I can't submit my current project to you.

    However, the data retrieved by my previous test code for the F021 API seems to be normal.

    Based on yesterday's testing, I concluded that adding code to disable the cache or clear the D-cache before reading in the problematic section resolved the reading issues.

    I compared the current project that's having issues with the previous F021 API test project, but I'm still not sure where the difference lies.

  • Apologies, The expert is out of office today. Please expect a response by Tuesday

  • Okay, thank you.

  • You are welcome.

  • Hi Shuo,

    Apologies for the delayed response!

    In debug mode, you can only see the original data change to 0xFF while the program is running; when paused, the data remains as it was originally.

    At the same time, the data read by the `Fapi_doMarginReadByByte` function is also the original data.

    After erasing are you not doing any write? Because in this screenshot you shared, i could see flash program api after erase API?

    --
    Thanks & regards,
    Jagadish.

  • Hi,jagadish

    A write operation was performed after the erase operation.

  • Hi Shuo,

    Apologies for the delayed response! I was off for few days due to vacation.

    I am really sorry still i am confused.

    The below is your original question, right?

    Then I performed a erase operation on the data at address 0xC000.

    In debug mode, you can only see the original data change to 0xFF while the program is running; when paused, the data remains as it was originally.

    Here in above you are saying even after erase also you are seeing original data.

    However, in below you are saying you are doing a write operation after erase.

    A write operation was performed after the erase operation.

    So, the data can be present in the memory, right?

    I will be available from 10AM to 7PM IST (Indian Standard Time), so if you are available between them, we can have a call for live debugging.

    Just schedule sometime for meeting on tomorrow and share it with me, i will join and we can have a live discussion.

    --
    Thanks & regards,
    Jagadish.

  • Hi,jagadish

    After I added dcache and ran a cleanup, the issue has been resolved for now. I have other things to attend to at the moment, so I’ll look into this issue later. Thank you very much for taking the time to help me. Thank you.