lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] Lwip on external ram


From: Noam Weissman
Subject: Re: [lwip-users] Lwip on external ram
Date: Mon, 14 Aug 2017 07:19:29 +0000

Hi Milan,

 

I am working with STM32 + FreeRTOS + LwIP for more than 6 years now.

 

From my own experience It works great and almost always if you have problems it is

due to not using the library properly.

 

LwIP 1.41 is rather old and that suggest that the example you use is also a bit old. I can suggest

The following:

upgrade LwIP to 2.02

Check your interrupt definitions vs the OS definitions

 

I have not used any external RAM (so far) and was able to run several modules at the same time.

 

Cortex-M has a bit complicated interrupt mechanism and the FreeRTOS porting is confusing. If your

Interrupts are not properly defined it may cause slowness and even causing the system to stop

working. Check ST latest example and see how they defined the interrupts. It should be something

similar to this:

 

----------------------------------------------------------------------------------------------------------------------------------

 

#define IRQ_SYS_PRIORITY_MODEL  NVIC_PriorityGroup_4

 

 

/* Cortex-M specific definitions. */

#ifdef __NVIC_PRIO_BITS

                /* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */

                #define configPRIO_BITS                             __NVIC_PRIO_BITS

#else

                #define configPRIO_BITS                             4        /* 15 priority levels */

#endif

 

/* The lowest interrupt priority that can be used in a call to a "set priority"

function. */

#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY                                                0xF

 

/* The highest interrupt priority that can be used by any interrupt service

routine that makes calls to interrupt safe FreeRTOS API functions.  DO NOT CALL

INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER

PRIORITY THAN THIS! (higher priorities are lower numeric values. */

#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY   5

 

/* Interrupt priorities used by the kernel port layer itself.  These are generic

to all Cortex-M ports, and do not rely on any particular library functions. */

#define configKERNEL_INTERRUPT_PRIORITY                    ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )

/* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!

See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */

#define configMAX_SYSCALL_INTERRUPT_PRIORITY      ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )

 

 

#define ADC3_DMA_ISR_PRIO      (configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY + 6)

#define ETH_ISR_PRIO           (configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY + 5)

#define IR_TIMERS_ISR_PRIO     (configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY + 2)

#define SERIAL_ISR_PRIO        (configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY + 1)

 

----------------------------------------------------------------------------------------------------------------------------------

In the above code portion ETH and other interrupts have a priority LOWER than the OS time tick. If this

Is not kept any critical section in your code or the OS own code will not mask interrupts properly.

 

Another place to look for problems is your LwIP lwipopts.h file … in short memory settings. You may have

sufficient memory in hardware but if you do not define it in the lwipopts its not usable.

 

Hope the above helped.

 

BR,

Noam.

 

 

 

From: lwip-users [mailto:lwip-users-bounces+address@hidden On Behalf Of Milan V K
Sent: Sunday, August 13, 2017 6:51 PM
To: address@hidden
Subject: [lwip-users] Lwip on external ram

 

Hi everyone,

 

I am trying to develop an Open 62541 OPC UA Server application using LwiP socket Interface. The socket binding works without issues, the Server set up without any issues. But as soon as a Client tries to connect with the Server, the Lwip response becomes slow.(TTL > ~2500). Could it be any memory issues on LwiP? I am not getting any hard fault or stack Overflow. But I wanted to make sure it is not a Memory related issue and tried assiging Attribute : _attribute_((section(“External_Ram“) for ram_heap in mem.h. But then it seems the allocations are not working. What else should I check in this case?

 

My platform Details: STM 32 + 128 K internal RAM + 2 MB external RAM

freeRTOS: 8.0.2 + Lwip 1.4.1(STM port)

 

Thanks in advance.

 

Milan


reply via email to

[Prev in Thread] Current Thread [Next in Thread]