Chat freely about anything...

User avatar
By pvvx
#8237
Code: Select allstatic void ICACHE_FLASH_ATTR
espconn_sclose_cb(void *arg)
{
   espconn_msg *psclose_cb = arg;
    if (psclose_cb == NULL) {
        return;
    }

    struct tcp_pcb *pcb = psclose_cb ->pcommon.pcb;
    espconn_printf("espconn_sclose_cb %d %d\n", pcb->state, pcb->nrtx);
    if (pcb->state == CLOSED || pcb->state == TIME_WAIT) {
       psclose_cb ->pespconn ->state = ESPCONN_CLOSE;
      /*remove the node from the server's active connection list*/
      espconn_list_delete(&plink_active, psclose_cb);
      espconn_tcp_disconnect_successful(psclose_cb);
    } else {
      os_timer_arm(&psclose_cb->pcommon.ptimer, TCP_FAST_INTERVAL, 0);
    }
}

While running timer, Lwip delete and free pcb! espconn_sclose_sb() has a pointer to the old pcb!
Espconn use old pointer of tcp struct! Bad algo = many errors!
Dismiss Espressif programmer!
User avatar
By sej7278
#8248
pvvx wrote:system restart() and software reset() non stop LwIP -> eternal crash, not reset, not deep_sleep, .... :lol:
many errors ... bad product.


i'm sure espressif would appreciate a pull request
Last edited by sej7278 on Tue Jan 27, 2015 6:55 am, edited 1 time in total.
User avatar
By jackon
#8293
pvvx wrote:
Athena wrote:And RTC memory is 4Bytes as a count .. 64 means 64 X 4 =256 bytes..

For users - the following 512 bytes for "system area" of 256 bytes.
108*4 = 432. 0x60001048 + 432 = 0x600011F8 :)
espconn_tcp_set_max_con write dword 0x600011FC (des_addr rtc_mem = 109), deep_sleep write 0x600011F8 (des_addr rtc_mem = 108)?
Code: Select allsint8 ICACHE_FLASH_ATTR espconn_tcp_set_max_con(uint8 num)
{
   if ((num == 0) || (num > 5)) // corrected PV` -> remot_info premot[5] -> max 5!!!
      return ESPCONN_ARG;

   MEMP_NUM_TCP_PCB = num;
   return ESPCONN_OK;
}

ASM (liblwip.a):

espconn_tcp_set_max_con:

   beqz.n   a2, _38f
   l32r   a3, 37c ; [0x60000e00]
   memw
   s32i   a2, a3, 0x3fc ; 0x60000e00+0x3fc = 0x600011FC
   movi.n   a2, 0
   ret.n
_38f:
   movi.n   a2, -12
   ret.n

lwipopts.h:
Code: Select all/**
 * MEMP_NUM_TCP_PCB: the number of simulatenously active TCP connections.
 * (requires the LWIP_TCP option)
 */
#ifndef MEMP_NUM_TCP_PCB
#define MEMP_NUM_TCP_PCB                (*(volatile uint32*)0x600011FC)
#endif

and more errors....
Give SDK 0.9.5. patch2! patch3! patch4! ... :lol:


There are 1KB RTC memory, addr: 0x60001000~0x600013FF.
The system_rtc_memory_write/read can operate 0x60001100~0x60001FFF, total 768B(256B+512B).
0x60001100~0x600011FF(256B) is reversed for sdk internal use, it's 'system area'. You can operate this area, but sdk uses some addresses in this area also, it may cause fatal error.
0x60001200~0x600013FF is for users.
The first param of system_rtc_memory_write/read is des_addr, range 0~191, map to 0x60001100~0x600013FF, 768B.
If you want to save your data in RTC memory, you can use last 512B.
system_rtc_memory_write/read(0, ......) will operate 0x60001100
system_rtc_memory_write/read(64, ......) will operate 0x60001200

espconn_tcp_set_max_con --- des_addr = 63 --- 0x60001100 + 63 * 4 (where does 109 come from?)
deep_sleep --- des_addr = 62 --- 0x60001100 + 62 * 4 (where does 108 come from?)
where does the address 0x60001048 come from?

You don't need to know the absolute address of RTC memory.
You use a good tool, you can use it to test again.