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 first flash

I ran into an issue flashing a factory-new TMP570LC4357A for the very first time.  My debugger reported that it was unable to load its flash loader into SRAM.  In a lower-level mode of the tools, I found that while I could connect to the target, alter execution, and change core registers, I could not write new values into the SRAM.  It was as if it was write-protected somehow.  The initial state of the SRAM seemed to be random (as expected on initial power-up), and the flash was not quite erased.

On a guess, I discovered that if I cleared the sram to zero using the MINITGCR and MSIENA registers, that flash erase and loading could proceed normally.  My guess is that the SRAM's ECC was wrong, and therefore byte-wise or word-wise writes could not proceed.  However, I could not find anything in the manuals to support my guess.  On the contrary, the TRM suggests that double-bit errors are ignored on writes from the debug port.

So why couldn't SRAM writes work initially, and why does clearing the SRAM work around the problem?

  • Jonathan,

    Do you have the Hercules Feature Patch installed?  

    Since this device is a cached R5 - the issue you are seeing may be related to the issue this patch fixes.  (some chance, not sure how likely or not).

  • I'm using a third-party debugger.
  • Jonathan,

    I'm not sure why you weren't able to write to RAM, suppose it could be the ECC.

    With CCS I've not seen this issue before.

    But before programming starts, some registers are written by the debugger, which you can find in
    <ccsv6>\ccs_base\hercules\flash\configs\TMS570LC43xx.xml (or RM57L8xx.xml) - and meminit is at the top of the list.

    <Initialization>
    <InitRegisters Register="0xffffff5C" Value="0x0000000A" Comment="Enable meminit"/>
    <InitRegisters Register="0xffffff60" Value="0x00000001" Comment="Initialize data RAM"/>
    <InitRegisters Register="0xfffff538" Value="0x00000005" Comment="reset ESM"/>
    <InitRegisters Register="0xffffff50" Value="0x00000207" Comment="select clock source 7 for RTICLK (Disable DWD)"/>
    <InitRegisters Register="0xffffffd0" Value="0x01010000" Comment="Disable peripherals"/>
    <InitRegisters Register="0xffffffd0" Value="0x01010100" Comment="Enable peripherals"/>
    <InitRegisters Register="0xfffffa00" Value="0x00070085" Comment="disable RTP"/>
    <InitRegisters Register="0xfffff700" Value="0x00010005" Comment="disable DMM"/>
    <InitRegisters Register="0xfffff000" Value="0x00000000" Comment="disable DMA"/>
    <InitRegisters Register="0xffffff00" Value="0x00000000" Comment="disable ECLK output"/>
    <InitRegisters Register="0xfff7A400" Value="0x00000000" Comment="disable HTU"/>
    <InitRegisters Register="0xfff7A014" Value="0x00000000" Comment="disable FTU"/>
    <InitRegisters Register="0xffffffc0" Value="0x00000000" Comment="Set RAM wait states to 0"/>
    <InitRegisters Register="0xfff87000" Value="0x00000303" Comment="enable prefetch for both portA and portB and RWAIT=3"/>
    <InitRegisters Register="0xfff87288" Value="0x00000005" Comment="enable write to EWAIT register"/>
    <InitRegisters Register="0xfff872B8" Value="0x00080000" Comment="EWAIT=8"/>
    <InitRegisters Register="0xfff87040" Value="0x0000ffff" Comment="force active mode for all banks"/>
    <InitRegisters Register="0xffffffc4" Value="0x0a0a0a0a" Comment="MEMSW='1010' => Flash at 0x00000000, RAM at 0x08000000)"/>
    </Initialization>
  • That answers it well enough for me. Thanks!