|
From: | Werner Motz |
Subject: | [lwip-users] LWIP RAW API tcpip_callback() |
Date: | Tue, 16 May 2017 16:47:39 +0200 |
Hello, I am using lwip 2.0.2 RAW API + freertos 8.2.3 I am able to establish a connection and I can receive data without any problems. I would like to know what is the best way to send data outside the lwip thread. In my freertos task (outside lwip) I do following: void SEND_TASK(void *pvParameters) { portTickType xLastWakeTime; const portTickType xFrequency = SEND_CYCLE_TIME_MS; //100ms xLastWakeTime = xTaskGetTickCount(); //------------------TASK----------------------- for(;;) { tcpip_callback_with_block(WTF, tcp_active_pcbs, 0); vTaskDelayUntil(&xLastWakeTime, xFrequency); //Pause } } void WTF(void* arg) { struct tcp_pcb *pcb = (struct tcp_pcb*) arg; char ucrecBuff[44] = {0x88}; pcb->flags |= (TF_NODELAY); tcp_write(pcb, ucrecBuff, 44, TCP_WRITE_FLAG_COPY); tcp_output(pcb); } Unfortunatelly I run into Assert function in tcpip_callback_with_block(…) LWIP_ASSERT("Invalid mbox", sys_mbox_valid_val(mbox)); Does anybody know what I am doing wrong? I know that the RAW api is not for Multithreading issues. But I am sure u know a way J Is it legit to call tcpip_callback_with_block(..) outside the lwip thread? What would be the proper architecture to send data? In the examples I only saw callback echo servers but I do not want to write data only after receiving some J I am looking forward to your help. |
[Prev in Thread] | Current Thread | [Next in Thread] |