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 with TMS570LC43x not working

Part Number: TMS570LC4357
Other Parts Discussed in Thread: TMS570LS3137,

Hello,

I'm using TMS570LC43 HDK board with our software that I ported from TMS570LS3137 and I'm having problem with the F021 API library. In the previous software we used F021 API library from 4/13/2012 (I'm not sure what version it was) Currently, I'm using version 02.01.01. It's the latest version I can find on TI website and it's from 2014. Is this version support TMS570LC43x processor?

When calling Fapi_initializeFlashBanks() function I get return value Fapi_Error_OtpChecksumMismatch.

Ignoring this error I'm trying to erase Sector 6 on Bank 0. Call to Fapi_setActiveFlashBank() returns Fapi_Status_Success, as well as the call to Fapi_issueAsyncCommandWithAddress() for erase operation, but the sector is not erased. Currently, I'm running this code from Bank 1. All this code was working fine in the previous software with TMS570LS3137.

Any ideas that I can try to make it work again?

Thanks,

Alex

  • Hello Alex,

    1. Please check the system clock used in flash bank initialization:

        Fapi_initializeFlashBanks((uint32_t)SYS_CLK_FREQ);   

        The maximum system clock for TMS570LC43x is 150MHz, but it is 180MHz for TMS570LS3137

    2. In flash API 2.01.01, the sectors number in Fapi_enableMainBankSectors(sectors) bit mask. Each bit refers to a single sector where Sector 0 is bit 0 to Sector 15 is bit 15. This function will check the OTP to see if the requested sector exists on the device and will enable it only if exists. 

    3. There are 16 sectors in bank 0 for LC4357, but 15 sectors for LS3137.

  • Hi Wang,

    1. I did setup HCLK to be 150MHZ and I passed 150 to   Fapi_initializeFlashBanks() function, so that was not the problem why it returned Fapi_Error_OtpChecksumMismatch. This is still not resolved.

    2. I noticed that in the SPNU501G section 2.3.3 they say to add "#define _L2FMC" before F021.h, so I did, but it still doesn't work. Per your advice, I also added the call to Fapi_enableMainBankSectors(1 << 6) for sector 6, after call to Fapi_setActiveFlashBank(0) and I see that in FBSE register bit 6 is set (0x0040), meaning the sector is enabled. I also see that FBBUSY register is 7C and FMAC is 0, meaning that block 0 is available. After function call Fapi_issueAsyncCommandWithAddress(Fapi_EraseSector, (uint32*)0x00018000) is executed, I see FBBUSY register is set to 7D and FMSTAT is set to 0x00000990. That means PCV, BUSY, ERS and CSTAT bits are set, which indicate that the erase was unsuccessful. My software is stuck at this point waiting for BUSY bit to clear, which never happens.

    I'm now executing this code from RAM and I disabled MPU and Cache before calling this code. Also IRQ is disabled, but I can't disable FIQ for RTI Compare interrupt, which doesn't do anything when this RAM code is executed. Do you see anything wrong with all that? By the way, I also tried to call Fapi_getBankSectors(), which returns Fapi_Error_FeatureNotAvailable and Fapi_getDeviceInfo, which tells me that I have 4Meg of memory (correct answer).

    Please see if you can provide any farther help. We really need to resolve this.

    Thanks,

    Alex

  • Hello Alex,

    I will write an example for you to try.

  • OK Thanks Wang.

    By the way I checked the sector erase flow in spnu501G and it matches my code. I also checked the additional registers described in spna148 section 2 per the flow in section 3.3.2 and they all seemed to have correct values after Fapi_issueAsyncCommandWithAddress is executed. There should be a reason why the errors are generated in FMSTAT. I'll keep researching, while I wait for your example.

    Thanks again,

    Alex

  • BTW, I want to make sure that you use the correct library for TMS570LC4357:

    F021_API_CortexR4_BE_L2FMC_V3D16.lib

  • Thank you so much Wang! I was using the same library I used for TMS570LS3137. I changed the library and now it works.