How can I allocate the whole Ethernet to the SRAM and my application to SDRAM?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

How can I allocate the whole Ethernet to the SRAM and my application to SDRAM?

跳至解决方案
1,125 次查看
atm2024
Contributor III

Hi,
I'm trying to build an application that uses FreeRTOS, lwip stack, and mbedtls stack.
I'm using the MIMXRT1064-EVK with version 2.15.000 of the SDK.

I am assigning Heap, Stack, *(NonCacheable.init) and *(NonCacheable) to the SRAM_DTC.
Also, my application requires a lot of working memory, so I allocated the Global data placement to the SDRAM.
Naturally, the following settings have been completed to use the SDRAM.
> add symbols : SKIP_SYSCLK_INIT and XIP_BOOT_HEADER_DCD_ENABLE=1
> modify ethernetif0_init() : SDK_ALIGN to AT_NONCACHEABLE_SECTION_ALIGN

However, as mentioned in the post below, this setup is problematic because there are some troubles when the Ethernet tries to get some resources from the SDRAM. (the SDRAM as BOARD_SDRAM or NCACHE_REGION)
https://community.nxp.com/t5/i-MX-Processors/iMXRT1024-Ethernet-MAC-not-transmitting-data/m-p/177020...

How can I allocate the whole Ethernet to the SRAM and my application to SDRAM?
Also, is it okay to allocate the Ethernet resources to SRAM_OC?

Thanks in advance.

0 项奖励
回复
1 解答
725 次查看
atm2024
Contributor III

To make Ethernet work with SDRAM, the following measures are required:

The ENET_INT pin on the MIMXRT1064-EVK board is pulled up (R309) and down (R152).
In this state, the GPIO1_Combined_0_15_IRQHandler() interrupt will occur at irregular intervals even if nothing is being done.
If you remove R152, the sporadic GPIO1_Combined_0_15_IRQHandler() interrupts will no longer occur.
And the GPIO1_Combined_0_15_IRQHandler() interrupt will only be raised if the Ethernet link is up or down.

在原帖中查看解决方案

6 回复数
1,069 次查看
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @atm2024 

Thank you for your interest in the NXP MIMXRT product, I would like to provide service for you.
Now, which demo you are using in the SDK? This one?
SDK_2_15_000_EVK-MIMXRT1064\boards\evkmimxrt1064\lwip_examples\lwip_httpssrv_mbedTLS\freertos
You want to copy:Heap, Stack, *(NonCacheable.init) and *(NonCacheable) to the SRAM_DTC.
This is easy, you just need to modify the related data aread to the DTCM.
You want to generate your code in the SDRAM, and the data in the internal TCM or OCRAM.
It's OK, but you need to make sure the current internal RAM is enough to put your related data.
Please tell me which IDE you are using now? Then, I can help you to check the details.
Please also tell me your current memory modification or configuration, that will also helps to me to check your situation.
Please also tell me your test result.
About your question:
1.How can I allocate the whole Ethernet to the SRAM and my application to SDRAM?
=>Answer: change the app to internal SDRAM, I don't know which IDE you are using, if it is the mcuxpresso, you can check the linker to RAM.
then in the memory, let the first memory as SDRAM.
Then, to the stack, heap, *(NonCacheable.init) and *(NonCacheable), select the memory to the internal DTC, ITC.
2. Also, is it okay to allocate the Ethernet resources to SRAM_OC?
=>Answer: If the OCRAM is large enough, then you can! Just need to check your code size, I am afraid it is not enough.

Wish it helps you!
Any updated information, please kindly let me know.

Best Regards,

Kerry

0 项奖励
回复
1,064 次查看
atm2024
Contributor III

Thanks for the reply, Kerry

The IDE I'm using is MXUXpresso IDE v11.9.0 [Build 2144].

This is the previous memory configuration.

MCU settings > Memory detailsMCU settings > Memory details

Managed Linker ScriptManaged Linker Script

 

When the Global data placement was set to BOARD_SDRAM, the TLS communication stopped midway after repeating several times. So I set the Global data placement to SRAM_OC2.
This is the current memory configuration.

Managed Linker ScriptManaged Linker Script

The Image built with this configuration has no SDRAM allocated.

ImageInfo.png

 

So I changed my application's send and receive buffers to global variables. And I specified __attribute__((section("SDRAM.bss"))) for those global variables.

ImageInfo_attribute.png

The variables in my communication application were assigned to SDRAM, but the communication stopped midway as before.

 

Is it not possible to allocate not only the lwIP middleware but also my application data related to IP communication to SDRAM?

 

I appreciate your help.

0 项奖励
回复
1,046 次查看
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @atm2024 ,

  As I know, if you put all the lwip to the SDRAM, some data need to use the none cache buffer, you can try to disable the cache on your side, whether it have any improvement or not?

 in the 

void BOARD_ConfigMPU(void)

// SCB_EnableDCache();

// SCB_EnableICache();

Try it again.

 

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

Best Regards,

Kerry

0 项奖励
回复
997 次查看
atm2024
Contributor III

Thanks for your reply, Kerry

when I commented out as per your instructions, it stopped at the Ethernet link up detection in the initial settings.

Unfortunately, my problem could not be resolved.

0 项奖励
回复
967 次查看
atm2024
Contributor III

> The variables in my communication application were assigned to SDRAM, but the communication stopped midway as before.

The cause was that the stack size of my application task was insufficient.

 

I was using event groups for event triggers in my application tasks.

The data in the event group object was corrupted because the application's local array was redundantly allocated to the memory region referenced by the event group object.

When the problem occurred, the Heap Usage (FreeRTOS) display showed that there was sufficient memory.

Be careful with the stack size required by local variables.

 

By modifying it, my application data related to IP communication was placed in SDRAM and it worked properly.

726 次查看
atm2024
Contributor III

To make Ethernet work with SDRAM, the following measures are required:

The ENET_INT pin on the MIMXRT1064-EVK board is pulled up (R309) and down (R152).
In this state, the GPIO1_Combined_0_15_IRQHandler() interrupt will occur at irregular intervals even if nothing is being done.
If you remove R152, the sporadic GPIO1_Combined_0_15_IRQHandler() interrupts will no longer occur.
And the GPIO1_Combined_0_15_IRQHandler() interrupt will only be raised if the Ethernet link is up or down.