Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

stm32 - STM32F4 LWIP freezes after fixed send number

I'm using nucleo f429zi with LWIP v 2.1.2. Documentation states that for TX buffer PBUF_RAM should be used. In my case whole LWIP stack freeze after 28 send messages. When I change pbuf type to PBUF_POOL, everything works like a charm. Although in the docs it written that this type should be used for RX buffer. Here is my implementation of udp callback function

void
udp_descserver_receive_callback(void *arg, struct udp_pcb *upcb, struct pbuf *p, const ip_addr_t *addr, u16_t port) {

uint8_t triesNumber = 0;
err_t error;    
udp_connect(upcb, addr, port);
pbuf_free(p);
p = NULL;
p = pbuf_alloc(PBUF_TRANSPORT, sizeof(PING_INFO), PBUF_POOL);
if(p != NULL) {
    pbuf_take(p, &pingInfo, sizeof(PING_INFO));
    do {
        error = udp_send(upcb, p);
        triesNumber++;
    } while (error && triesNumber < RESEND_TRIES);
}
pbuf_free(p);
udp_disconnect(upcb);
}

My question is, why the method which is contrary to docs works.

question from:https://stackoverflow.com/questions/65889467/stm32f4-lwip-freezes-after-fixed-send-number

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I found the problem, parameter PBUF_POOL_BUFSIZE was causing the problem, when I increased the value it started to work perfectly.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...