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 EMIF problem

Other Parts Discussed in Thread: HALCOGEN

Hello.

I'm porting RM48 project to RM57 and it has been ported mostly. I have a problem with using EMIF, it has worked well on RM48. My system has MRAM and Flash memory and they are set CS2 and CS3 respectively.

I configured EMIF and PINMUX on HALCoGen and generated files. I referred 'example_emif_sdram' and set values for EMIF same with RM48 project. Is there some differences using EMIF in RM57?

It arrives 'dataEntry' when I access external MRAM or FLASH memory.

Regards.

  • Hello Wonjae,

      Can you check what causes the data abort?

  • Hello Charles,

    I don't know the way to check it. Please explain it, I'll do that.

    Thank you.

  • Hi Wonjae,

      since you have the data abort, the CPU will indicate the type of fault (Ex. MPU violation, external error and etc) and the address that caused the fault to happen. Inside the CPU, please look at DFSR (data fault status register) and DFAR (data fault address register). There is also an auxiliary data fault status register if an ECC error is detected in the cache memory. I tend to think the error is more likely due to MPU violation or external error.

  • Hello Charles,

    I checked DFSR and DFAR. The values are changed when It access the external memory.

    DFSR is 0x00000800, DFAR is 0x60000000.

    Thank you.

  • Hi Wonjae,

     This is a MPU background fault. Most likely you have setup a background MPU region with no read/write access for the entire 4GB of space. Normally you will also setup another region to cover the EMIF space starting at 0x60000000. If the EMIF region is not setup then any access to the EMIF space will produce A background MPU violation. Please let me know how you setup the MPU regions. If your MPU regions are setup by HAlcoGen then send me the screenshot of  HalcoGen setting. 

  • Hi Charles,

    It is hard to upload the screenshot because this is an official computer and not permitted capturing my screen and upload it by security s/w. Please understand my situation. I'm using HALCoGen and MPU is set too. I made a project using 'RM57L843ZWT_FREERTOS',  My MPU setting is same with initial state.

    Thank you

  • Hi Wonjae,

      I will try to see if I can reproduce it tomorrow. Will you be able to send your HL_sys_main.c?

  • Hi Charles.

    Thank you. I can't send file.. Why do you need the main.c? Do you want to see my memory access code?

     +) I can send you screenshot or files by email. Please tell me if you need it..

  • Hi Wonjae,

    Please look at the below thread that explains the reason why you are getting abort when accessing EMIF using FreeRTOS. Basically FreeRTOS will restrict access to memory regions other than heap and task owned stack. There is some suggestion in the thread as to create a restricted task that run with privilege protection or not and also with the MPU settings for that task. 

    http://e2e.ti.com/support/microcontrollers/hercules/f/312/p/323853/1237265.aspx#1237265

  • Hi Charles,

    I'm still stuck this problem and don't know how configure MPU settings. I've read the post but I can't understand it. I will read the NMPU part in technical reference manual for RM57. Is it helpful to me? I don't know basic way to setup MPU regions. Please give me a tip. Thank you in advnace.

    Best Regards

    Wonjae

  • Hi Wonjae,

      NMPU is not used by FreeRTOS. So no need to dig into NMPU for your problem. Not sure if you have a chance to go to FreeRTOS webpage at below link that talks about creating restricted tasks. FreeRTOS if run with support for MPU will restrict access to memory regions other than heap and task own stack. EMIF is mapped outside the accessible memory for task code before calling FreeRTOS task schedule. In order to gain access to EMIF from tasks managed by FreeRTOS you need to create task with access privileges. I'm not an expert in FreeRTOS. I have also forwarded your post to one of our experts. I will be out of office next week for your information.

    http://www.freertos.org/FreeRTOS-MPU-memory-protection-unit.html

  • Hi Charles,

    I need not to change the original configuration in MPU tab in HALCoGen? or some options are needed to change..?

    Thank you for your help. I will try it by FreeRTOS privileged access.

    Regards,

    Wonjae.

  • Hi Wonjae,

    4621.RM57_FreeRTOS_EMIF.zip

    There is an issue in 4.01.00 that MPU settings are done twice once in startup which depened on HALCoGen GUI and other one by RTOS. It will work smooth if both settings are same but by default it does not.

    Attached is a FreeRTOS example with EMIF. You can see the MPU setings when you open up the HALcoGen project file.

    You can generate the code using 4.01.00. This version MPU setting is done by FreeRTOS, You have to comment that line since Halcogen mpuInit  done in startup should be sufficient. I recommend you to replace the generated file with the below three files in the attachement.

    os_port_new.c
    os_portasm_new.asm
    os_portmacro_new.h

    We are using higher MPU regions (12, 13 ) for TASK in these file above compared to regions 4, 5 used in default 4.01.00. hence asking to replace above 3 files.

  • Hello Prathap,

    Is it okay to replace the only three files to my exist project? or should I change the configurations in HALCoGen?

    +) It goes to prefetchEntry after the scheduler is excuted. So I changed MPU configuration in HALCoGen same with your example project. But it goes prefetchEntry again..

    Regards.

  • Hi Wonjae,

    Can you please try the Project I sent as is, just to make sure it works fine in your setup.

    You can replace the files and in your HALcoGen project, you must follw the MPU settings done as per the HALCoGen project I sent. ( YOu can open two Instance of HALCoGen side by side and do a compare of the MPU Tab). 

  • Hi Prathap,

    Your project works fine in my environment. I replaced the files and set the MPU values same with your project. But it goes prefetchEntry, it works fine before change it.  I'll try it again..

  • I've checked MPU tab configuration again and again, but I don't know what is different. So I replaced 'os_sys_mpu.asm' to yours. then it works fine. I will find the problem later.

    Thank you.

    Regards.

  • Hello Prathap,

    I'm still can't using the EMIF. I've tried to access the external ram(MRAM), but it goes dataEntry when I write something the address(0x6000_0000) like this way.

    uint16_t *pAddr = (uint16_t*) 0x60000000;

    *pAddr = 0xAABB;

    The external ram has 4MB(0x6000_0000 ~ 0x603F_FFFF). Is it need to configure something in MPU? I've set the values in EMIF tap and PINMUX. This board was used for RM48 and it is changed only MCU to RM57. It has worked well RM48 system and most of environment and configurations are similar with it. I guess that the MPU setting has the problem because only difference is MPU.. or is there any other way to access external memory when it use OS?

    Check this post too, http://e2e.ti.com/support/microcontrollers/hercules/f/312/t/373660.aspx, because I guess it is related to this problem.

    Thank you