[En-Nut-Discussion] (no subject)

Rasmus Aagesen rasmus.aagesen at tonica.dk
Tue Mar 16 12:05:22 CET 2010


Hallo Ole.

I have removed the thread's and calling the function's in the main loop, 
 
for (;;)
    {    
    	NutSleep(40);
    	
// f_etherTX is a flag (it is set every 10ms)
       	if(f_etherTX ==1)
        	{
//Writing data via Ehternet 
        		EtherTX();
        		f_etherTX = 0;
        	}
// f_etherRX is a flag (it is set every 10ms)
       	if(f_etherRX ==1)
        	{
//Reading data via Ehternet
        		EtherRX();
        		f_etherRX = 0;
        	}

    }

Init function for initialization of Ethernet

oid EtherTXRXinit(void)
{

//		TX part		   
	
		
	g_pSockSenderBoardTestChannel = NutUdpCreateSocket(0);
    	if (g_pSockSenderBoardTestChannel != 0)
		 etherTX_ok = 1;
		
//		RX part		


	g_pSockReceiverBoardTestChannel = NutUdpCreateSocket(port);	    
	if (g_pSockReceiverBoardTestChannel != 0) 
		etherRX_ok = 1;
		
}

I read udp as showed 

NutUdpReceiveFrom(g_pSockReceiverBoardTestChannel, &addr, &port,
rxBuff,sizeof(rxBuff),1000);

Global variables:

Timeout is 1000ms
static u_short port = 10041;
static u_long addr;
static unsigned char rxBuff[1024] 

-----Oprindelig meddelelse-----
Fra: en-nut-discussion-bounces at egnite.de
[mailto:en-nut-discussion-bounces at egnite.de] På vegne af Ole Reinhardt
Sendt: Tuesday, March 16, 2010 11:33 AM
Til: Ethernut User Chat (English)
Emne: Re: [En-Nut-Discussion] (no subject)

Hi!

> The NutUdpSendTo()works perfectly but the NutUdpReceiveFrom()does not
work,
> the program stop's the first time it call's this function

You might have two issues:

- NutUdpReceiveFrom will block until you received any data or the
  timeout expired. Which timeout have you given?

- You raised a buffer overflow. Does your buffer have enough space for
  the received data? Have you allocated the buffer correctly or do you
  use a staticaly allocated buffer on the stack space? In this case,
  have you given your thread enough stack space?

Regards,

Ole

-- 

Thermotemp GmbH, Embedded-IT

Embedded Hard-/ Software and Open Source Development, 
Integration and Consulting

Geschäftsstelle Siegen - Steinstraße 67 - D-57072 Siegen - 
tel +49 (0)271 5513597, +49 (0)271-73681 - fax +49 (0)271 736 97

Hauptsitz - Hademarscher Weg 7 - 13503 Berlin
Tel +49 (0)30 4315205 - Fax +49 (0)30 43665002
Geschäftsführer: Jörg Friedrichs, Ole Reinhardt
Handelsregister Berlin Charlottenburg HRB 45978 UstID DE 156329280 

_______________________________________________
http://lists.egnite.de/mailman/listinfo/en-nut-discussion




More information about the En-Nut-Discussion mailing list