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.

RM57 ESM problem with __TI_auto_init()

Other Parts Discussed in Thread: HALCOGEN

Hello.

I'm developing a system using RM57. There is a problem with start up. ESM stat2 has 0x8 and turn on the red led when I turn on the system and it arrive main(). I wrote the post about similar problem at here http://e2e.ti.com/support/microcontrollers/hercules/f/312/t/366644.aspx. I've resolved it to add this code next line to _c_int00(void).

esmREG-EKR = 0xA

esmREG->EKR = 0x0

It works fine before I use the FreeRTOS. I've made a new project with HALCoGen 'RM57_FreeRTOS'. I added above 2 lines code at same place. But led is turned on and ESM stat2 register has 0x8. I tried following the code on debug mode and found the line that make problem. it is __TI_auto_init(), it is occured when the function is executed.

Is it related using FreeRTOS? or what is problem..

Regards,

Wonjae

  • Hello Wonjae,

       You are seeing a 0x8 in the ESM GP2 which indicates a Cortex-R5 AXI bus fault. This is most likely due to an uncorrectable ECC error when reading the L2 SRAM. Can you check if the L2 SRAM is initialized? Open the memory brower and scan through the L2 SRAM region to see if they are initialized to zero? The default HalcoGen startup file is supposed to initialize the memory for you.

      Can you also check the L2RAMW module RAMERRSTATUS register to see if any flags are set?

  • Hello, Charles.

    The L2 SRAM is initialized when the system start up. It has the many values after executing systemInit() in startup procedure. Is it normal..? I don't know how does it checked RAMERRSTATUS register..

    The situation is changed a little. I've got an another reply from here(http://e2e.ti.com/support/microcontrollers/hercules/f/312/t/369528.aspx) I revised it and then it is not turned on anymore at '__TI_auto-init()'. There was a MPU problem. Instead of it, the red LED is turned on when the FreeRTOS scheduler is started..

    There is a strage thing in memory values.. SDRAM region (0x80000000 ~) they use only upper bit (e.g. 0x00009691), there are values in right side 4 byte because it use little endian. This is captured image of memory map.

     

  • Hi Wonjae,

      In the startup code, there is call to _memInit_() which will initialize the L2 SRAM. After power up, if you browse the L2 SRAM starting at 0x0800_0000 you will see random values in the memory. After you initialize the SRAM they should be all zeros. If they are not zeros then it may result as an uncorrectable ECC error to the CPU when the CPU is executing the __TI_auto_init(). This was my first suggestion to look at since you said that running __TI_auto_init() will set ESM group 2 with 0x8 which is a uncorrectable AXI bus fault. RAMERRSTATUS is a status in the L2RAMW module. When you execute __TI_auto_init() it is trying to initialize the global variables which are stored in the L2 SRAM. Checking RAMERRSTATUS register will find out if there is any other issue reading and writing to the L2 SRAM.

      From your newest post, it looks like you are not getting anymore AXI bus fault with the value of 0x8 in the ESM STAT2 register. Can you please confirm this is the case? You think your current problem is due to CPU MPU fault.  However, if you have a MPU fault you will get an abort and there should be no ESM error to assert the LED. Therefore, if you still have the LED turned ON, then it is not related to MPU. Please let me know what ESM is showing. TWhich flag is set in ESM STAT1 to STAT9 registers.

      I'm not too clear on your last problem about the SDRAM. Is 0x9691 what you write to the SDRAM? Could you please elaborate the statement  "they use only upper bit (e.g. 0x00009691), there are values in right side 4 byte because it use little endian."?

  • Hello Charles,

    I'll explain it again more specifically. The above picture is captured when it arrive 'main()' after startup. I've never write something at the addresses. This is changes of value at 0x8000_0000.

    At first, '0000_0000' on _c_int00. It changed to '0000_9393' after systemInit() and still exist until it arrives main().

    LED is not turned off after esmREG-EKR is asserted to 0x0.

    Thank you

     

  • Hi Wonjae,

      Can you upload the picture again? I can not see.

      In CCS you can setup a watchpoint. You can setup to watch for writes to address 0x8000_0000. When the watchpoint is hit, the CPU will be stopped. This way you can find out who is writing to 0x8000_0000.

      For the LED, is it turned ON immediately when you connect to the target? If you see the LED immediately when you connect to the targe tthen you can turn it OFF by writing 0x5 to the esmREG-EKR register. Please see below post.

    http://e2e.ti.com/support/microcontrollers/hercules/f/312/t/366644.aspx

     If you encounter a reset event before you turn off the LED by writing 0x5 to the esmREG-EKR register then you will need to turn off the LED by first writing 0xA to the esmREG-EKR followed by writing 0x0.  You may ask where the reset event is coming from. I think what happen is that once you connect to the taget you may have tried to perform reflash the code. The flash loader will perform a reset to the device. When this happens it clears some of ESM's internal register and the ESM kin of  lost track of an earlier ESM event (the CCM compare  error event when you first connect to the target the first time). So try to clear the ESM by writing 0xA and then 0x0 if this is the case.  

  • Hi Charles,

    The picture I said is in a previous post. It has those values itself after start up. The picture was captured when it stopped at start point of main().

    It is failed to use watchpoint, a breakpoint was set but it was not stopped and passed. But I found what makes the values manual way 'step over'. It has values by 'PINMUX_EMIF_OUTPUT_ENABLE(ON)' in muxInit() first time. The value is 0xFFFF_9691 at 0x8000_0000.

    It will change by 249 line in mapClocks() of HL_system.c. The value is changed to '0x000_9691', lower byte of all values are '0000'. This is end of changing values.

    The ESM LED is not turned on when it through esmREG -> EKR = 0xA; and 0x0;. I think the problem related it is cleared.

     

    I've tested access memory and I found strange phenomenon...The address 0x8000_0000 ~ 0x87FF_FFFF is 128MB SDRAM in my system. I tried to write some values and watch using Memory Browser in CCS.

     

    1. This is the procedure of the test. You can see the code and memory values line by line work. whole values are changing at once. Moreover, it use little endian, but the values are does not make a sense..

    2. It has values what I wrote before reset at 0x8000_0000. I did reset.. but it has some values.. this is captured image when it stopped at start of main()

  • Hi Wonjae,

      I tried to use your code sequence to access the SDRAM and below is the screenshot of my result. I'm able to write to the SRAM properly. I use HalCoGen to first configure the EMIF module. There is an example EMIF_SDRAM for RM57 device. Please make sure the EMIF is properly setup.

    For your second question about why the the SDRAM space at 0x80000000 is displaying your last written value after a reset at the main(), I think the reason is that once you generate a reset you reset the EMIF configuration. All the registers in the EMIF are in the default states. Now the debugger is refreshing the memory browser for the SDRAM space using the default SDRAM configuration and this could lead to the problem you are seeing. Where do you initialize the EMIF? As you can see in my example screenshot the emif_SDRAMInit() is called after the main(). If you were to place a breakpoinit after the emif_SDRAMInit() and then do a reset and run to the breakpoint then you will see the correct values being displayed for the four 16-bit words you just wrote.

  • Hello Charles,

    I've found the reason.. There is some miss in EMIF configuration.

    Thank you.

  • Hello Wonjae,

      Good that your fould the reason. As mentioned, there is a HalCoGen example for using SDRAM for RM57. You can take a look on its EMIF setup for SDRAM.

  • Hello Charles.

    I'll refer it. Thank you for your helps!