SDRAM configuration on MIMXRT1050-EVK(B) using FreeRTOS

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

SDRAM configuration on MIMXRT1050-EVK(B) using FreeRTOS

ソリューションへジャンプ
4,648件の閲覧回数
henrique_klein
Contributor I

Hello,

Recently I started to work with the MCUXpresso SDK 2.5 on the MIMXRT1050-EVK(B). As a basis for my system I used a FreeRTOS virtual comm example and from there started to customize according to my future application.

As a proof of concept I made some changes to the default configuration of the examples provided by the SDK, such as using QSPI with XIP instead of HyperFlash. In between some changes I anticipated that my application might use a lot of FreeRTOS heap memory (which is considered a global variable, right?), so I changed the configuration of "Global data placement" to the BOARD_SDRAM. After compiling the map succesfully showed that my actual heap and stack were still in my internal memory (SRAM_DTC) while my FreeRTOS heap was in the SDRAM.

Memory region Used Size Region Size %age Used
BOARD_FLASH: 81348 B 8 MB 0.97%
SRAM_DTC: 16 KB 128 KB 12.50%
SRAM_ITC: 0 GB 128 KB 0.00%
SRAM_OC: 0 GB 256 KB 0.00%
BOARD_SDRAM: 72048 B 32 MB 0.21%

When first trying to debug the application resulted in a Hardfault which made me search in the community for answers and found similar problems on the links bellow:

Issue with MIMXRT1050-EVK, FreeRTOS and SDRAM for data storage 

hard fault when FreeRTOS heap is in external SDRAM 

I tried just about everything mentioned in Ed Waldner's thread and had even inferior results than him, not being able to run the code a single time. As for now, I tried to initialize the SDRAM as it is initialized in the evkbimxrt1050_semc example (both in main function as in the ResetISR()) and nothing seems to work.

As of now, my latest version is configured as such:

pastedImage_3.png

pastedImage_4.png

Does anybody know what am I missing? I followed the tutorial on https://community.nxp.com/community/mcuxpresso/mcuxpresso-ide/blog/2017/12/07/overview-of-using-the-...  but that failed too.

Thanks in advance.

0 件の賞賛
返信
1 解決策
3,955件の閲覧回数
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Henrique Klein,

    I have talked your question with one of my colleagues.

    About my iled question, just need to add SKIP_SYSCLK_INIT define, because if don't add it, the SDK will minimize the SEMC frequency.  Then the iled_blinky will work.

   About the usb project, it is special, because the USB buffer is the special area, this area can't be cache, otherwise it will have problems, that's why your usb enumeration have problems.

   Please note these points about your question:

1. define XIP_BOOT_HEADER_DCD_ENABLE

2. define SKIP_SYSCLK_INIT

3. separate the NONCACHEBLE region for the usb buffer.

Wish it helps you!

If you still have question about it, please kindly let me know.


Have a great day,
Kerry

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

元の投稿で解決策を見る

0 件の賞賛
返信
8 返答(返信)
3,958件の閲覧回数
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Henrique,

  Can you also share your problem project, which can reproduce the problem on the MIMXRT1050-EVKB?

 Then I would like to reproduce it on my side at first, then check the details.

Have a great day,
Kerry

 

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 件の賞賛
返信
3,958件の閲覧回数
henrique_klein
Contributor I

Hi Kerry,

Thank you for your response. I was able to make the SDRAM work by following the steps below:

1 - Opening the "evkbimxrt1050_semc" example.

2 - Changing the memory order of the BOARD_SDRAM to be the first memory after the flash.

3 - Defining XIP_BOOT_HEADER_DCD_ENABLE.

Eventually I figured out that the memory initialization script provided in Overview of using the MIMXRT1050-EVK(B) with MCUXpresso IDE  didn't work for me. So I had to use DCD to make it work, just as Ed Waldner. I still don't know why the script didn't work.

It also took me a while because I was trying every combination possible and copying chunks of the "evkbimxrt1050_semc" code into "evkbimxrt1050_dev_dcd_vcom_freertos" instead of doing it the other way around. 

On my other examples, I had to additionally define SKIP_SYSCLK_INIT, so it wouldn't mess up semc clock. And just to be sure I reinitialized semc like in the example "evkbimxrt1050_semc" as soon as the code got into main. Can you confirm if this is the right way to do this?

However one thing still bugs me: My USB high speed stops enumerating if I use the BOARD_SDRAM instead of the SRAM_DTC. Does anybody know any reason why this is happening? I still haven't paid too much attention to it yet, but If anyone have any hints on this subject I gladly appreciate it.

Once again, thank you for your support, Kerry.

0 件の賞賛
返信
3,958件の閲覧回数
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Henrique Klein,

    Thanks a lot for your updated information.

    Yes, if you want to use the SDRAM, you need to make sure the SDRAM is defined in MCU Settings.

pastedImage_1.png

And you also need to define XIP_BOOT_HEADER_DCD_ENABLE as 1.

Actually, the SDK project already contains these configuration, you just need to define XIP_BOOT_HEADER_DCD_ENABLE to 1, then the DCD will be enabled, the SDRAM willl be initialized.

Please check these application note, it will be useful to you, it also have the SDRAM usage examples:

https://www.nxp.com/docs/en/application-note/AN12107.pdf 

https://www.nxp.com/docs/en/application-note/AN12108.pdf 

If you are using the qspi, please refer to AN12108.pdf.

About the IDE, you need to use the newest MCUxpresso IDE version, 10.2 is very old.

About SKIP_SYSCLK_INIT, in your other examples, you can define it.

Another customer also share his solutions, please check his last post:

https://community.nxp.com/message/1102140?commentID=1102140#comment-1102140 

About the USB high speed stops enumerating problem, could you tell which code you are using, the official SDK code? Please tell me the detail project name, I will help you to check it on my side with the SDRAM configuration, please make sure your DCD is enabled.

Have a great day,
Kerry

 

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 件の賞賛
返信
3,958件の閲覧回数
henrique_klein
Contributor I

Hello Kerry,

Thank you for your reply. 

I went back to the basics and used the "evkbimxrt1050_dev_cdc_vcom_freertos" code to reproduce the error.

From the base code I enabled SDRAM (however, I didn't separate a NONCACHEBLE region) and the error occurs.

However, when I change my first ram to SRAM_DTC and recompile, the USB enumerates successfully.

0 件の賞賛
返信
3,956件の閲覧回数
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Henrique Klein,

    I have talked your question with one of my colleagues.

    About my iled question, just need to add SKIP_SYSCLK_INIT define, because if don't add it, the SDK will minimize the SEMC frequency.  Then the iled_blinky will work.

   About the usb project, it is special, because the USB buffer is the special area, this area can't be cache, otherwise it will have problems, that's why your usb enumeration have problems.

   Please note these points about your question:

1. define XIP_BOOT_HEADER_DCD_ENABLE

2. define SKIP_SYSCLK_INIT

3. separate the NONCACHEBLE region for the usb buffer.

Wish it helps you!

If you still have question about it, please kindly let me know.


Have a great day,
Kerry

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 件の賞賛
返信
3,957件の閲覧回数
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Henrigque Klein,

    Thank you for your updated information.

    Could you give me your memory details? Like this picture, I will check it on my side.

   pastedImage_1.png


Have a great day,
Kerry

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 件の賞賛
返信
3,958件の閲覧回数
henrique_klein
Contributor I

Hello Kerry,

My configuration was just as yours, but I changed the ram order:

xpressoConfig.png

I didn't change anything else, except for QSPI XIP, because I already changed my board to boot from there.

Once again, thank you for reply.

0 件の賞賛
返信
3,957件の閲覧回数
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Henrique,

      Thanks for your confirmation.

      I have checked it on my side, actually, it is not only in the usb sample code, even the iled_blinky code, if you modify the SDRAM instead of the DTC, it also have problems.

     I have compared the two link filer:

pastedImage_1.png

   the __base_RAM have the difference, it seems the basic RAM can't use the SDRAM, I will check it from our internal side, then give you reply later.

Best Regards,

Kerry

0 件の賞賛
返信