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.

SM470R1B1M-HT: SM470R1B1M-SK RAM and FLASH Programming

Part Number: SM470R1B1M-HT

Hello,

I have a SM470R1B1M-SK evaluation kit and I am able to program in FLASH my application (and board examples) but I cannot program it in RAM.

I have used the evaluation board JTAG, J-LINK LITE IAR 091013 REV 8.0 and IAR V9.10.2 with a 14 day license (first day, not expired).

I also tried to program it with J-Link-ARM-KS (IAR JTAG) - also, worked for FLASH but not for RAM.

This is the error that I got:

Thu Oct 14, 2021 00:07:59: Warning: Failed to measure CPU clock frequency
Thu Oct 14, 2021 00:07:59: Could not detect CPU clock speed. Verification of test code downloaded into RAM failed.

I have read on this forum similar problems but without a clear solution.

My best guess is that the JTAG is limited and it cannot program the RAM, although it is more difficult to program the FLASH than the RAM.

For this microcontroller, SM470R1B1M-HT, the IAR is the only compiler/IDE that can program it without spending days to find a solution to program it - I have tried it and gave up. 

Thanks,

Marius Raducanu

  • Hi,

      I have no experience with this device. So I'm learning while talking. I don't think what you are trying to do is possible. After reset, the boot memory which is the flash is mapped to the lower 2GB of the memory map. RAM is not yet configured for its base address. Debugger will not be able to load code to RAM. Reading the System Module reference guide https://www.ti.com/lit/pdf/spnu189, it says that after reset the boot memory (which is the flash) is repeated in the memory map for the lower 2GB. See below. 

    You will need to configure the base address registers to define the starting addresses for other memories (e.g. RAM). Below is an example memory map after configuration. 

    The RAM chip selects are configured using MFBAHR2 and MFBALR2 and MFBAHR3 and MFBALR3. See below. Until they are configured, the RAM is not enabled in the device. Therefore, you cannot load code to it. 

    I think if you want to run code from RAM, you will need to copy code from flash to RAM and set the PC to RAM address. You can not load code directly to RAM using debugger. 

  • Hi Charles,

    Thanks for your fast answer.

    I haven't studied this in detail but I expected the examples that came with the evaluation board to work.

    The SM470R1B1M-SK evaluation board has examples for FLASH and RAM.

    Is it possible that IAR, a respected company, to do such a big mistake? 

    Thanks,

    Marius Raducanu  

  • The RAM chip selects are configured using MFBAHR2 and MFBALR2 and MFBAHR3 and MFBALR3. See below. Until they are configured, the RAM is not enabled in the device. Therefore, you cannot load code to it.

    I'm not an IAR user, but is their any equivalent of the CCS GEL files which could be used at debugger start-up to write to the Memory Base Address Registers to enable RAM before the debugger attempts to download the program to RAM?

  • Hi Chester,

      I'm not familiar with IAR either. I suppose there is also a CS GEL-like equivalent in IAR. 

  • Hi Chester and Charles,

    Thanks for your help.

    Usually, I use CCS but for this microcontroller, the only way to program it, is using IAR. This is a very expensive microcontroller (purchased 9 of them for testing) and not having it covered in CCS is "strange".

    I started testing it in IAR hopping that I don't have to spend too much time configuring the compiler and the IDE (develop a bootloader). At this time, I can program the FLASH but not the RAM. Programming the RAM is not critical but it is the way to test the firmware - theoretically, it takes less time to program it.

    Now, at least, I know that is not a trivial problem and I will spend some time to clarify the problem with program it in RAM.

    Thanks,

    Marius Raducanu

  • The SM470R1B1M-SK evaluation board has examples for FLASH and RAM.

    Using the kickstart (i.e. free code size limited) version of IAR EW for ARM 9.10.2 downloaded the IAR example projects for Texas Instruments devices.

    Imported the Flashing Light example for the IAR SM470R1B1M-SK board.

    Under Projects -> Edit Configurations selected the RAM configuration.

    Under Project -> Options -> Debugger -> Setup there is the setup macro file selected $PROJ_DIR$\..\..\Configuration_Files\B1M_Files\RAMSM470R1B1M.mac :

    That .mac file has a SetupRAM() function containing register writes to activate the RAM regions. E.g.:

      /* activate RAM at 0x00000000 0k that is connected to memory select 1 */
      __writeMemory32(0x00000000, 0xfffffe08, "Memory"); 	 // MFBALR1
      __writeMemory32(0x00000000, 0xfffffe0c, "Memory"); 	 // MFBAHR1
    
    In the .mac file the execUserPreload() function calls SetupRAM().

    I don't have the hardware to check, but expect when the RAMSM470R1B1M.mac file is specified as the setup macro file in the RAM configuration, that when a debugger session is started IAR EW should call the macro file functions which activate RAM in the device, before downloading the program into RAM.

    Whereas if the Flash configuration is selected there is no setup macro file specified in Debugger options.

    With the RAM configuration selected in the project can you confirm if there is a setup macro file specified under Project -> Options -> Debugger -> Setup?

  • Hi Chester,

    I was looking in any possible settings (checking/unchecking) of the project (including RAMSM470R1B1M.mac) and I couldn't make it to work in RAM.

    I have tried different JTAGs with no success. I am able to program only the FLASH.

    Regards,

    Marius

  • Hmm, that suggests the RAM download was OK with IAR4.41, but stopped working with later versions of IAR (e.g. IAR 6.70 and IAR 7.10).

    Are you able to open a support request with IAR?

  • Yes, I will open a support request with IAR after I purchase the compiler - now I am using the 14 day free license. I sent a request for a quote 2-3 weeks ago but got no response yet. I wanted to evaluate what compiler to use but it looks that I have no other choice than IAR.

    Thanks,

    Marius Raducanu

  • Hello,

    I can confirm that the FLASH and RAM programming of the SM470R1B1M-SK evaluation kit, work with I-Jet, IAR JTAG/Programmer.

    Regards,

    Marius Raducanu