i'm working on a project with LWIP on the stm32f4 discovery. Therefor i have three threads which handles the ethernet connection.
One thread receive packages and put them on can bus. Another receive can packages an send them on udp. A third thread send on udp parallel.
My problem is, when only the can bus threads are active all is working, but when i enable the third thread the other doesn't receive packages any more.
My code for udp is:
UDP receive
Code: Select all
conn = netconn_new(NETCONN_UDP);
if((t = netconn_bind(conn, IP_ADDR_ANY, 1242)) != ERR_OK)
chprintf((BaseSequentialStream *)&SD1, "ERROR %d\r\n", t);
for(;;){
err = netconn_recv(conn, &buf);
...
}
}
UDP send
Code: Select all
conn = netconn_new( NETCONN_UDP );
netconn_bind(conn, IP_ADDR_ANY, 1234 ); //local port
netconn_connect(conn, IP_ADDR_BROADCAST, 1235 );
buf = netbuf_new();
for(;;){
netconn_send(conn, buf);
...
}
UDP send parallel
Code: Select all
conn = netconn_new( NETCONN_UDP );
//netconn_bind(conn, IP_ADDR_ANY, 1240 ); //local port
netconn_connect(conn, IP_ADDR_BROADCAST, 1241 );
buf = netbuf_new();
for(;;){
netconn_send(conn, buf);
...
}
If I enable this code the other thread doesn't receive anything. Without this all is working.
A port scan with nmap shows that the port 1242 is "1242/udp open|filtered unknown".
Christian