Problem with Ethernet on LPC1788

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Problem with Ethernet on LPC1788

1,343 Views
ulyssesfonseca
Contributor II

Hello,

I'm with a problem on ethernet using LWIP on MCUXpresso using the memory, when i use with this way, work perfectly:

pastedImage_1.png

But when i change the order of memory RAM the ethernet stop work.

pastedImage_2.png

What happens with my code to this stop work?

What i do to solve my problem?

Note: I'm using Freertos, my Flash is shifted for bootloader.

Sorry about my terrible english.

6 Replies

1,017 Views
ulyssesfonseca
Contributor II

Hello, a long time after, i solved this problem. At begining, i work with RamPeriph32 first and using multiples ram regions for FreeRTOS on RamLoc64 and SDRAM32, it works but isn't the best solution, because with USB, ethernet doesn't work.

The solution it works at RamLoc64 with USB:

I analyzed all variables alloc at ram spaces and i done some changes it works good for my problem.


At file lpc17xx_40xx_emac.c is need to change the variable:

ALIGNED(8) lpc_enetdata_t lpc_enetdata;

change to:

__attribute__((section(".bss.$RamPeriph32"), aligned(8))) lpc_enetdata_t lpc_enetdata;

At file lwipopts.h comment or disable the follow variables:

//#define MEM_LIBC_MALLOC 1
#define MEMP_MEM_MALLOC 1

At file mem.c change:

u8_t ram_heap[MEM_SIZE_ALIGNED + (2*SIZEOF_STRUCT_MEM) + MEM_ALIGNMENT];

to:

u8_t ram_heap[MEM_SIZE_ALIGNED + (2*SIZEOF_STRUCT_MEM) + MEM_ALIGNMENT] __attribute__((section(".bss.$RamPeriph32")));

Note: this changes at files mem.c can cause other problems, because it is responsable for functions mem_alloc and other functions responsable for allocation of memory used by many other libraries.

1,017 Views
lpcxpresso_supp
NXP Employee
NXP Employee

There is almost certainly a variable (probably an array buffer) being used by the LWIP that has to be located in the peripheral RAM in order for both the ethernet peripheral and the Cortex-M3 processor core be able to access it.

When you order the RAM so that the Peripheral RAM is listed first, all of the variables will be being located in the Peripheral RAM. When you order the RAM so that RamLoc64 is first, all variable will be default be placed there.

You need to identify the ethernet variable , and then use one the the various way MCUXpresso IDE provides to force it to be placed into the Peripheral RAM. See the MCUXpresso IDE v10.2 User Guide for more details of how to do this, in particular section 16.11, "Placement of specific code/data items".

Regards,

MCUXpresso IDE Support

0 Kudos

1,017 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi ulysses fonseca,

    After you modify the ethernet project RAM position, do you also modify the according lib RAM position?

   Take an example, the board and the chip project, modify it the same as your ethernet project, don't just modify one project, the build the two lib and the app project again, otherwise it will have problems.

 


Have a great day,
Kerry

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

0 Kudos

1,017 Views
ulyssesfonseca
Contributor II

Hello Kerry,

Thank you for your answer, i don't know how do this, in my project the application and the libs for the microcontroller are in the same project. Below, the tree about my project:

pastedImage_1.png

0 Kudos

1,017 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi ulysses,

   It seems your project is created by yourself, not the lpcopen code, so maybe the situation is not the same.

   Please check your project, do you have the optimization? Please set the optimization to none in the project property.

  Besides, could you also generate the .map file, then send me the two .map file with two different memory configuration.


Have a great day,
Kerry

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

0 Kudos

1,017 Views
ulyssesfonseca
Contributor II

Hello Kerry,

   

  Besides, could you also generate the .map file, then send me the two .map file with two different memory configuration.

   I send the two files, the ETHERNET_5_RAM_64_FIRST use the RamLoc64 First on the definition:

pastedImage_1.png

The other file, ETHERNET_5_RAM_32_FIRST use the RamPeriph32 first:

   pastedImage_2.png

   Please check your project, do you have the optimization? Please set the optimization to none in the project property.

 Yes, the optimization was none:

pastedImage_4.png

0 Kudos