cancel
Showing results for 
Search instead for 
Did you mean: 

ETHERNET SEND AND RECEÄ°VE SAME TÄ°ME

TARHAN SAMAH
Senior
Posted on March 09, 2018 at 16:36

We are trying to establish and send and receive Project through an ethernet connection .we use Nucleo f429ZI,

We have our nucleo with

static  ip 10.1.1.2 mask  255.255.255.0 gateway 10.1.1.1 using cubemx ,PHY 0,

pc is used az destination having adress 10.1.1.3 using Hercules application

 

tcpip like a transport protocol.

 

i can ping my cart using comand mode no prblm.

 

 

-i can send by

 /* init code for LWIP */

  MX_LWIP_Init();

nc=netconn_new(NETCONN_TCP);//create new network  connection TCP TYPE

res=netconn_bind(nc,&local_ip,0);        //ASSCOCIATE STM MAC ADRESS TO AN IP.--->10.1.1.2 here 0 means any port number so we can accept any port

res=netconn_connect(nc,&remote_ip,23);       //connect to remote ip remote port--->our pc server application wireshark for exmple 139

sprintf(send_buffer,'hello from STM32f429 port 23\n\r');

res=netconn_write(nc,send_buffer,strlen(send_buffer),NETCONN_COPY)

-Ä° can receive by

netconn_accept(nc,&in_nc);

                              

res=netconn_recv(in_nc,&nb);//nc the network connection  from which to receive data, nb network buffer

netbuf_copy(nb,buffer,len);

len=netbuf_len(nb);

printf('Received %d bytes:\r\n %s\r\n',len,buffer);

netbuf_delete(nb);//delete data buffer

buffer[len]=0;

               

but if i put both of them send and receive my prgm bugs and i dont have any reaction

im using FRTOS default task for the moment .i also tried withous frtos. No improvement and also tried to increase the mem size reserved to the thread no difference.

 

osThreadDef(defaultTask, StartDefaultTask, osPriorityIdle, 0,256);---à1000

defaultTaskHandle = osThreadCreate(osThread(defaultTask), NULL);

so:

-should i use different ports one for receiving one for sending or i can use one port for both?.

-should i create  two connections nc , two bindings one sending one for receiving  , or one is enough?

-demos are done in a complex way so that i decided to find a simplest way is there a good example or doc using LWÄ°P /netconn functions            ?

-serverdemos Works with both straight and cross cable which one is the right ??

-is Ethernet fullduplex ? is there an option i need to add in cubemx to have data both sides going?

 

Thanks

0 REPLIES 0