Marco Jakobs | 28 Feb 16:28 2015
Picon

Re: Increasing LwIP performance

Hi Michal,

there is no general performance issue, I think you have a major programming issue somewhere!

I'm also using Free RTOS + LwIP 1.4.1 in many of our projects in the company, but on AT91SAM7X512 which is much less powerful than your STM32F429. Here at home my complete house is controlled by this combination.

I'm running several IP communications per second with my cabinets PLUS control program interpreter PLUS webserver access PLUS serving up to 5 simultaneous MODBUS TCP connections (1-2 polls per second per client) on this processor with 55MHz, all is fine. Just to give you a picture what you can expect from the combination LwIP plus Free RTOS.

As RAM is very limited I also use excessively external serial SRAM via SPI, not as main program RAM but for serving communication queues.

Do you maybe have a high priority task running somewhere which blocks the whole system? A proper layout of your tasks and priorities is important, and when waiting for something please NEVER do "delay loops" without having the RTOS call "vTaskDelay" in them to give other tasks the opportunity to be processed. Always keep in mind that a task with the same or lower priority will never interrupt your task unless you are using the vTaskDelay's!

Marco


Michał Karczewski <michal.karczewski <at> metronic.pl> , 28.02.2015 6:59:

Hi,
I'm working on project that needs some web functionality. Using STM32F429 + PHY LAN8720 with FreeRTOS and LwIP 1.4.1 raw API. I'm running webserver from SDCard, which is showing numbers generate by microcontroller firmware, and Modbus communication protocol over TCP. As far as I'm testing only one of these functionality, everything works fine - problems starts when I'm trying to run both at once. To be precise:
- webserver site works by sending five requests (one for another value) every one second - javascript deals with it by sending

As I said before, everything works fine until I run both function at once. Then modbus starts losing connection every few (random) seconds, and website overwrite values with much bigger interval than one second. Everything is very unstable.

My question is - is there possibility to increase LwIP performance, and if is, what I should trying to modify to get better results. I'm using also external SRAM memory, but I'm entirely sure how I should apply it to cooperate with LwIP.

_______________________________________________
lwip-users mailing list
lwip-users@...
https://lists.nongnu.org/mailman/listinfo/lwip-users
Michał Karczewski | 27 Feb 14:02 2015
Picon

Increasing LwIP performance

Hi,
I'm working on project that needs some web functionality. Using STM32F429 + PHY LAN8720 with FreeRTOS and LwIP 1.4.1 raw API. I'm running webserver from SDCard, which is showing numbers generate by microcontroller firmware, and Modbus communication protocol over TCP. As far as I'm testing only one of these functionality, everything works fine - problems starts when I'm trying to run both at once. To be precise:
- webserver site works by sending five requests (one for another value) every one second - javascript deals with it by sending

pwmfreq.open("GET", "/pwmfreqget?id=1", true);

and in firmware in fs.c file function fs_open is including

if (strncmp(name, "/pwmfreqget?id=1", 16) == 0)

     {

          static char pcBuf[16];

 

          sprintf(pcBuf, "%f", variable[10].value);

 

          file->data = pcBuf;

          file->len = strlen(pcBuf);

          file->index = file->len;

          file->pextension = NULL;

          return (file);

 

     }
- Modbus TCP is just a simple packet service. In receive callback payload is parsed for modbus frame length, id, function etc. and in return is sending random value (the same value is used in website). I'm requesting for 20 registers information (= 40 bytes) from four different sources every 10 seconds.

As I said before, everything works fine until I run both function at once. Then modbus starts losing connection every few (random) seconds, and website overwrite values with much bigger interval than one second. Everything is very unstable.

My question is - is there possibility to increase LwIP performance, and if is, what I should trying to modify to get better results. I'm using also external SRAM memory, but I'm entirely sure how I should apply it to cooperate with LwIP.

Regards, Michal

_______________________________________________
lwip-users mailing list
lwip-users@...
https://lists.nongnu.org/mailman/listinfo/lwip-users
Jin Won Seo | 26 Feb 19:37 2015
Picon

Fail to get netconn lwip1.4.1+FreeRTOS+TM4C1294

Hi,

 

I am using tm4c1294+lwip1.4.1+FreeRTOS.

As netconn_alloc() is called for socket communication, it allocates an unused semaphore. the number of semaphore is defined as SYS_SEM_MAX, so it can not be over SYS_SEM_MAX. However, as semaphores are allocated continuously it reaches SYS_SEM_MAX and stop working since I gues sys_sem_free() does not deallocate it properly

Here is function that creates a semaphore implemented in sys_arch.c


err_t sys_sem_new(sys_sem_t *sem, u8_t count) { void *temp; u32_t i; /* Find a semaphore that is not in use. */ for(i = 0; i < SYS_SEM_MAX; i++) { if(sems[i].queue == 0) { break; } } if(i == SYS_SEM_MAX) { #if SYS_STATS STATS_INC(sys.sem.err); #endif /* SYS_STATS */ return ERR_MEM; } /* Create a single-entry queue to act as a semaphore. */ #if RTOS_FREERTOS sem->queue = xQueueCreate(1, sizeof(void *)); if(sem->queue == NULL) { #endif /* RTOS_FREERTOS */ #if SYS_STATS STATS_INC(sys.sem.err); #endif /* SYS_STATS */ return ERR_MEM; } /* Acquired the semaphore if necessary. */ if(count == 0) { temp = 0; xQueueSend(sem->queue, &temp, 0); } /* Update the semaphore statistics. */ #if SYS_STATS STATS_INC(sys.sem.used); #if LWIP_STATS if(lwip_stats.sys.sem.max < lwip_stats.sys.sem.used) { lwip_stats.sys.sem.max = lwip_stats.sys.sem.used; } #endif #endif /* SYS_STATS */ /* Save the queue handle. */ sems[i].queue = sem->queue; /* Return this semaphore. */ return (ERR_OK); }
Here is another function that frees semaphore implemented in sys_arch.c

void sys_sem_free(sys_sem_t *sem) { /* Clear the queue handle. */ sem->queue = 0; /* Delete Sem , By Jin */ vQueueDelete(sem->queue); /* Update the semaphore statistics. */ #if SYS_STATS STATS_DEC(sys.sem.used); #endif /* SYS_STATS */ }

Whenever netconn_free() is called sys_sem_free() deallocates the semaphore, but it does not free the semaphore assigned in sem[] array.

I added vQueueDelete(sem->queue); that was suggested by someone, but still all same.

Not only functions creates/frees semaphore but also functions handling mbox are same as functions above, so functions handling mbox could be wrong as well.

Someone already reported this issue to TI, but it seems they have not solved the problems yet.

Therefore, I may need to implement my own functions handling semaphore/mbox in sys_arch.c, but I don't have any clues so far.

Can anyone give me any ideas? or anything?

Thanks, Jin



_______________________________________________
lwip-users mailing list
lwip-users@...
https://lists.nongnu.org/mailman/listinfo/lwip-users
Charles Yarnold | 26 Feb 13:17 2015
Picon

Obtaining destination ip address from udp callback

Hello all,

I'm currently trying to expand energia's implementation on lwip for the tiva c ti launchpad to allow for reading of the destination IP of a udp packet. (https://github.com/energia/Energia/blob/master/hardware/lm4f/libraries/Ethernet)

Reading through lwip's udp.h and udp.cpp I'm unable to find where I could pull this information from when the udp recv callback is triggered. It seems to pass the source ip and port but not the destination ip. Destination ip also doesn't seem to be included in the udp_pcb struct, only ports.


Ideally I'm trying to extend the engergia ethernet library to include a function to return the destination ip of the packet, i.e. 192.168.1.50 or 192.168.1.255 to allow for filtering on the application layer of packets based off content and if the packet was boradcast or not.

I hope this makes some sense, I must admit this is overreaching some what for me with my current abilities, but if you don't try you won't learn I guess. Any pointers or reading materials would be most welcome, I'm not asking someone to code this for me.

All the best,

Charles
_______________________________________________
lwip-users mailing list
lwip-users@...
https://lists.nongnu.org/mailman/listinfo/lwip-users
Mohsin | 24 Feb 13:32 2015
Picon

How to manually set static IPv6 address?

Hi, 

I'm trying to implement IPv6 in my device. 

I've configured linklocal IP6 address using
netif_create_ip6_linklocal_address() function in my device.

But I want to assign static IPv6 address to my device. For this, I just know
how to configure it which I does as follows:

{
ip6_addr_t &private_addr;

IP6_ADDR( &private_addr, 0, 0xFD, 0xA8, 0x06, 0xC3);
IP6_ADDR( &private_addr, 1, 0xCE, 0x53, 0xA8, 0x90);
IP6_ADDR( &private_addr, 2, 0x00, 0x00, 0x00, 0x00);
IP6_ADDR( &private_addr, 3, 0x00, 0x00, 0x00, 0x08);
			
ip6_addr_copy(netif->ip6_addr[1], ip_addr); 			
netif_ip6_addr_set_state(netif, 1, IP6_ADDR_TENTATIVE);	
}

But where to set above parameters and call netif_ip6_addr_set_state()
function that I'm not getting.

So can any one please tell me?

Any help would be highly appreciated.

Thanks & Regards,
Mohsin

--
View this message in context: http://lwip.100.n7.nabble.com/How-to-manually-set-static-IPv6-address-tp23974.html
Sent from the lwip-users mailing list archive at Nabble.com.
rohanm | 24 Feb 09:58 2015

DNS host not resolving using lwip_gethostbyname function.


i have received IP address and  link is connected.but  i have another
issue.once link is connected.i am calling 'lwip_gethostbyname' function to
resovle dns host name.i want to post data on this host.but this function is
returining 'NULL'.GPRS is working in sim card.so do u have any idea whats
wrong. pls help.

--
View this message in context: http://lwip.100.n7.nabble.com/DNS-host-not-resolving-using-lwip-gethostbyname-function-tp23972.html
Sent from the lwip-users mailing list archive at Nabble.com.
Grzegorz Niemirowski | 20 Feb 02:47 2015
Picon

Filtering ICMP packets in ping example

Hello all.
While working with ping example from contrib I noticed strange effect: there 
was no timeout when an unreachable address was pinged and the while loop 
inside ping_recv was constantly executing  It turned out that it was because 
the device was constantly pinged from a PC to check if the TCP/IP stack is 
working. Therefore the socket was not receiving replies from pinged address 
but it was receiving echo requests from PC.
So here is my question: is it possible to filter out ICMP packets which are 
not from pinged address? Or I need to stop relaying on the SO_RCVTIMEO 
timeout associated with a socket and measure elapsed time with additional 
code?

Grzegorz Niemirowski
http://www.grzegorz.net/ 
Jin Won Seo | 19 Feb 19:30 2015
Picon

Fail to get netconn TM4C1294

Hi.

I am using tm4c1294+lwip1.4.1+FreeRTOS.

the modules that I tested were working well in lwip1.3.1
However, allocating netconn reaches to SYS_SEM_MAX/SYS_MBOX_MAX described in sys_arch.c without freeing it.

I added vQueueDelete() in sys_mbox_free()/sys_sem_free(), but it did not work.

It seems to have something to do with other functions like sys_mbox_set_invalid(),  sys_sem_valid(), sys_sem_set_invalid() since netconn_allocate()/netconn_free() call those in api_msg.c

So I implemented three functions like below:

sys_mbox_set_invalid(sys_mbox_t *mbox)
{
    mbox->queue = SYS_MBOX_NULL;
//    mbox = SYS_MBOX_NULL;
}

int
sys_sem_valid(sys_sem_t *sem)
{
  /*Check if a semaphore has been created*/
  if(sem->queue == SYS_SEM_NULL){
      return 0;
  }
  else{
      return 1;
  }
}

void
sys_sem_set_invalid(sys_sem_t *sem)
{
    sem->queue = SYS_SEM_NULL;
//    sem = SYS_SEM_NULL;
}

It seems sys_sem_free()/sys_mbox_free() are not working properly. How can I fix them?

Thanks,
Jin

_______________________________________________
lwip-users mailing list
lwip-users@...
https://lists.nongnu.org/mailman/listinfo/lwip-users
E. Pooch | 18 Feb 14:37 2015
Picon
Picon

Re: Assertion Programmer violates API

I assume you are using the httpdserver_raw code?
Verify that the fs_file structure that is prepared in your fs_open_custom() has properly allocated and valid data pointed to by the data member (i.e.: file->data). This data should be permanent, either at a ROM address, or allocated somewhere. 
If (fs_file *)file->length is set, but (fs_file *)file->data == NULL, you will get this error.

Are you using  LWIP_HTTPD_DYNAMIC_FILE_READ? what options do you have set that affect httpd.c?

On Feb 18, 2015, at 4:44 AM, Dennis Schäfer <Dennis.Schaefer <at> motec-cameras.com> wrote:

I am currently working on a project based on the LWIP-Stack (1.4.1).

The goal is to create a working webserver-interface on a NIOS development board.

I am failing for a long time on fixing a problem with the HTTP implementation which causes an assertion 
(Assertion "tcp_write: arg == NULL (programmer violates API)" failed at line 384 in src/core/tcp_out.c).
This makes it impossible for me to start a working Webserver and to go on with my project.
It seems for me as if the pointer referring to the outgoing data is wrong while the sent data has nothing in common with the HTML documents I created in the fsdata.cpp. 
Is this a known problem and in case yes is the a fix available already? I wasn’t able finding a solution myself or by web-research.



 

<image001.png>

 
Motec GmbH

Dennis Schäfer

 
Dualer Student

Oberweyerer Straße 21

65589 Hadamar-Steinbach

GERMANY

 
Phone:  +49 6433 9145-DW

Fax:       +49 6433 9145-DW

 
 
Managing Directors: Michael Weber, Dr. Christoph Loos
Local Court: Limburg HRB 2605
VAT Number: DE113866472


Please consider the environment before you print this email.

This electronic mail and any files transmitted with it may contain information proprietary to Motec GmbH and are intended solely for the use of the individual or entity to whom they are addressed, shall be maintained in confidence and not disclosed to third parties without the written consent of the sender. If you are not the intended recipient or the person responsible for delivering the electronic mail to the intended recipient, be advised that you have received this electronic mail in error and that any use, dissemination, forwarding, printing, or copying of this electronic mail is strictly prohibited. If you have received this electronic mail in error, please immediately notify the sender by return mail.

 
_______________________________________________
lwip-users mailing list
lwip-users-qX2TKyscuCcdnm+yROfE0A@public.gmane.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

_______________________________________________
lwip-users mailing list
lwip-users@...
https://lists.nongnu.org/mailman/listinfo/lwip-users
rohanm | 18 Feb 14:56 2015

ppp over serial using gsm modem getting config acknowledgement reject packet.

hii,
i am trying to implement ppp over serial using lwip version 1.4.1 for our
project.i am working on this from last 15 to 20 days.i have first
initialized gsm modem SIM900D and dial using ATD*99# command and once it
gets connected call below code .

 tcpip_init(lwIPInit,NULL);
xTaskCreate(vPPPApplication, "vPPPApplication", configMINIMAL_STACK_SIZE,
NULL, tskIDLE_PRIORITY, NULL );

i am confuse about gsm_init function call so i have made dummy function .
err_t GSM_init( struct netif *pxNetIf )
{

    return ERR_OK;
}

void lwIPInit( void *pvArgument )
{

ip_addr_t xIPAddr, xNetMask, xGateway;
static struct netif xNetIf;

	( void ) pvArgument;

	SysConfigGetLocalIPAddress(&ipAddr1, &ipAddr2, &ipAddr3, &ipAddr4);

//	 Set up the network interface.
	ip_addr_set_zero( &xGateway );
	ip_addr_set_zero( &xIPAddr );
	ip_addr_set_zero( &xNetMask );

	LWIP_PORT_INIT_GW(&xGateway);
	LWIP_PORT_INIT_IPADDR(&xIPAddr);
	LWIP_PORT_INIT_NETMASK(&xNetMask);

	netif_set_default( netif_add( &xNetIf, &xIPAddr, &xNetMask, &xGateway,
NULL,GSM_init, tcpip_input ) );//ethernetif_init
	netif_set_up( &xNetIf );

}

vPPPApplication code is as follows:

u8_t buffer[PPPOS_RX_BUFSIZE];

void vPPPApplication(void)
{
  ppp_pcb *ppps;
  char *username = "test";
  char *password = "test";

  int connected = 0;
  int pd;

  ppps = pppapi_new();

  /* set the method of authentication. Use PPPAUTHTYPE_PAP, or
   * PPPAUTHTYPE_CHAP for more security .
   * If this is not called, the default is PPPAUTHTYPE_NONE.
   */
  pppapi_set_auth(ppps, PPPAUTHTYPE_NONE, username,
password);//PPPAUTHTYPE_PAP

  pppapi_over_serial_create(ppps, 0, linkStatusCB, NULL);

  pppapi_open(ppps, 0);
  while(1)
  {
    int len;
    memset(ppp_rcvbuffer,0,sizeof(ppp_rcvbuffer));
    len = sio_read(0, ppp_rcvbuffer, PPPOS_RX_BUFSIZE);
    if(len <= 0) {
          vTaskDelay(10/portTICK_RATE_MS);
    } else {
      pppos_input(ppps, ppp_rcvbuffer, len);
    }

  }
}

u32_t sio_read(sio_fd_t fd, u8_t *data, u32_t len)
{
#if 1
    int ret;
    u8_t* Rec_Buf1 = (u8_t*)data;
    unsigned int Val = 0;
    u32_t k = 0;
    // latch the Queue count
    Val = UART_Queue[GSM_QUEUE].QCount;
    //	Total = Total + Val;
    for(k=0;k<Val;k++){
        // cannot copy more than the input buffer size
        if(k >= len){
                break;
        }
        Rec_Buf1[k] =
UART_Queue[GSM_QUEUE].QBuf[UART_Queue[GSM_QUEUE].QGet];
//	Print_Byte(ptr_Rec->Rec_Buf[i]);
        UART_Queue[GSM_QUEUE].QGet++;
        if(UART_Queue[GSM_QUEUE].QGet >= MAX_SERIAL_Q_SIZE){
                UART_Queue[GSM_QUEUE].QGet = 0;
        }
    }
    //RM
fd=(sio_fd_t)UART_Queue[GSM_QUEUE].QBuf[UART_Queue[GSM_QUEUE].QGet];
    //No of bytes read = i;
    if(k > 0){
        // the count value should not be changed during decrementing it's
value as below
        // the count value is expected to change only when there is some
data entry - serial port
        // therefore the interrupt is disabled which will not allow the
serial port to read the data
        // and hence the count will not be SET

        // TBD : user enter critical section
        INTDisableInterrupts();
    //		DisableSerialInterrupt2();
        UART_Queue[GSM_QUEUE].QCount -= k;
        // after decrement, again enable the interrupts to receive the data
from serial port
        INTEnableInterrupts();
    ///		EnableSerialInterrupt2();
  }
    return k;//RM For testing
#endif
}

linkStatusCB code ...
void linkStatusCB(void *arg, int errCode, void *ctx)
{

   int *connected = (int *) ctx;

   struct ppp_addrs *addrs = arg;

   if (errCode == PPPERR_NONE) {
       /* We are connected */
       *connected = 1;

   } else {
       switch(errCode)
       {

           case PPPERR_PARAM:

           break;
           case PPPERR_OPEN:
           break;
           case PPPERR_DEVICE:
           break;
           case PPPERR_ALLOC:
           break;
           case PPPERR_USER:
           break;
           case PPPERR_CONNECT:
           break;
           case PPPERR_AUTHFAIL:
           break;
           case PPPERR_PROTOCOL:
           break;

       }

   }
}

using this code i have  getting Config reject packet continuously.
is there any thing wrong with the code or i need to do some initlaization
before calling tcp thread and ppp serial thread.or there is any thing wrong
with gsm modem dialing.??
pls help me on this ....
thank you.  

--
View this message in context: http://lwip.100.n7.nabble.com/ppp-over-serial-using-gsm-modem-getting-config-acknowledgement-reject-packet-tp23912.html
Sent from the lwip-users mailing list archive at Nabble.com.
Dennis Schäfer | 18 Feb 13:44 2015

Assertion Programmer violates API

I am currently working on a project based on the LWIP-Stack (1.4.1).

The goal is to create a working webserver-interface on a NIOS development board.

I am failing for a long time on fixing a problem with the HTTP implementation which causes an assertion
(Assertion "tcp_write: arg == NULL (programmer violates API)" failed at line 384 in src/core/tcp_out.c).
This makes it impossible for me to start a working Webserver and to go on with my project.
It seems for me as if the pointer referring to the outgoing data is wrong while the sent data has nothing in common with the HTML documents I created in the fsdata.cpp.
Is this a known problem and in case yes is the a fix available already? I wasn’t able finding a solution myself or by web-research.



 

 

Motec GmbH

Dennis Schäfer

 

Dualer Student

Oberweyerer Straße 21

65589 Hadamar-Steinbach

GERMANY

 

Phone:  +49 6433 9145-DW

Fax:       +49 6433 9145-DW

 

dennis.schaefer-HReUJIt81eItIb2A2jOBDAC/G2K4zDHf@public.gmane.org

www.motec-cameras.com

 

Managing Directors: Michael Weber, Dr. Christoph Loos
Local Court: Limburg HRB 2605
VAT Number: DE113866472


Please consider the environment before you print this email.

This electronic mail and any files transmitted with it may contain information proprietary to Motec GmbH and are intended solely for the use of the individual or entity to whom they are addressed, shall be maintained in confidence and not disclosed to third parties without the written consent of the sender. If you are not the intended recipient or the person responsible for delivering the electronic mail to the intended recipient, be advised that you have received this electronic mail in error and that any use, dissemination, forwarding, printing, or copying of this electronic mail is strictly prohibited. If you have received this electronic mail in error, please immediately notify the sender by return mail.

 

_______________________________________________
lwip-users mailing list
lwip-users@...
https://lists.nongnu.org/mailman/listinfo/lwip-users

Gmane