Problems latest devkitARM and WIFI

Post Reply
MrAndini
Posts: 21
Joined: Mon Dec 08, 2008 12:32 am

Problems latest devkitARM and WIFI

Post by MrAndini » Wed Jan 07, 2009 1:07 am

Just want to knoiw if anyone else has issues with TCP socket locking up with latest release of devkitARM and wifi.

I have an application which I use the DS as a key entry terminal and connect via a TCP socket.
For test purposes I have a simple ping, reply test which I run for reliability.
With the previous devkitARM and wifi it will run all night with no hiccups.
However when I run with the latest devkitARM and wifi it hangs somewhere between 1 to 5 hours.

I am trying to find out exactly what hangs, but basically it appears like everything has locked.

I alternate back to previous version of devkitARM and it works all night again, come back to latest and hangs.

My ping test only sends one packet ever second with small patload, so shouldn't be any sort of buffer issue.

WinterMute
Site Admin
Posts: 2003
Joined: Tue Aug 09, 2005 3:21 am
Location: UK
Contact:

Re: Problems latest devkitARM and WIFI

Post by WinterMute » Tue Jan 13, 2009 2:03 am

Could you show us some code for the ping test, on both DS and host side. It's kind of hard to know where to start without being able to reproduce the problem.
Help keep devkitPro toolchains free, Donate today

Personal Blog

MrAndini
Posts: 21
Joined: Mon Dec 08, 2008 12:32 am

Re: Problems latest devkitARM and WIFI

Post by MrAndini » Wed Jan 14, 2009 1:09 pm

Thanks for the reply
I am still trying to work it out myself.

I did three minor changes
1 - Changed from just the arm9 code to use the default project with arm7 and arm9
2 - Added in a user fifo to allow me to set a lower backlight brightness
3 - Updated my flash to a later version of M3DSreal and sakura

Now all runs correctly with no hang up - have tried 3 times, on battery and on charger and goes like it used to on the old libnds.

This is all I added to default arm7 - would be easy to add to the default powermanagement fifo

Code: Select all

//---------------------------------------------------------------------------------
static void backlightMsgHandler(u32 command, void* user_data) 
{
	switch (command)
	{
		case 0:		writePowerManagement(PM_DSLITE_REG, 0);	break;
		case 1:		writePowerManagement(PM_DSLITE_REG, 1);	break;
		case 2:		writePowerManagement(PM_DSLITE_REG, 2);	break;
		case 3:		writePowerManagement(PM_DSLITE_REG, 3);	break;
	}
}

void installUserFIFO(void) 
{
	fifoSetValue32Handler(FIFO_USER_07, backlightMsgHandler, 0);
}

My Arm9 code has not changed apart from installation of the other end of the fifo

Which leaves me with either
Sakura as the culprit or perhaps issue re backlight being on high for too long with wifi continous


WIFI code itself is just using recv to get a packet (Contents of TCP packet is simply "PING\r")
Response back is just "PONG\r" using send

Standard WIFI connect
Wifi_ConnectAP(&myAccessPoint.AccessPoint, myAccessPoint.wepmode, myAccessPoint.wepkeyid, myAccessPoint.wepkeys[0]);

tcpSocket = socket(AF_INET, SOCK_STREAM, 0);
if (tcpSocket > 0)
{
	memset(&tcpAddr, 0, sizeof(tcpAddr));
	tcpAddr.sin_family= tcpHostEntry->h_addrtype;
	tcpAddr.sin_addr.s_addr = *((unsigned long *)(tcpHostEntry->h_addr_list[0]));
	tcpAddr.sin_port = htons(myAccessPoint.destPort);
	if (connect(tcpSocket, (struct sockaddr *)&tcpAddr, sizeof(tcpAddr)) < 0)
	{
	    printbtm(0, 6, "Connect failed");
	   tcpSocket = 0;
	}
	else
	{
	   i = 1;
	   ioctl(tcpSocket, FIONBIO, &i); 	// set non-blocking
	}
}

i = recv(tcpSocket, tcp_temp, 255, 0);
send(tcpSocket, data, strlen(data), 0);
Last edited by MrAndini on Sat Jan 17, 2009 3:06 pm, edited 1 time in total.

MrAndini
Posts: 21
Joined: Mon Dec 08, 2008 12:32 am

Re: Problems latest devkitARM and WIFI

Post by MrAndini » Wed Jan 14, 2009 1:56 pm

Further info - Flash Change to

M3 iSakuReal v1.3 (12-24-08)

M3/G6 English Firmware v4.2c (TouchPod)
iTouchDS English Loader v2.3c
Unofficial M3 Sakura Region-Free v1.12+1 (English)
Narin's CHEAT.db (12-21-08)

was

Sakura Unofficial Fully Translated Hacked English v1.10Narin's CHEAT.db (11-15-08)

Now retesting updated firmware on the older flash to see if this is the issue, will let you know the result.
Any idea why the charging light on the DS lite never goes back to green whilst it is turned on?

MrAndini
Posts: 21
Joined: Mon Dec 08, 2008 12:32 am

Re: Problems latest devkitARM and WIFI

Post by MrAndini » Sat Jan 17, 2009 3:05 pm

Narrowed it down.
I don't know if it is just my DS, but with the backlight on the sakura default (I think brightest), the hardware simply locks up when I run the wif for any reasonable period of time. I know this because I simply commented out my code to drop the backlight down and viola, it locked after approx 60mins. This same code ran non stop for 14 hours when I had calls to user fifo drop the backlight down. I left all the actual code to do the backlight in and initialise the USER07 FIFO, just commented out my code to pass the message into the FIFO.

After this had crashed twice, I left the same code in the uniut but shut the lid (I have the sleep disabled in my main)

Code: Select all

fifoSendValue32(FIFO_PM, PM_REQ_SLEEP_DISABLE);
and my lid closed function does.

Code: Select all

powerOff(PM_BACKLIGHT_BOTTOM | PM_BACKLIGHT_TOP);
then lid open does

Code: Select all

powerOn(PM_BACKLIGHT_BOTTOM | PM_BACKLIGHT_TOP);
Do this and it runs fine for hours on end as long as I have the lid is closed.
Open the lid and have the backlight back on full - hangs after 1 or 2 hours.

or if I add back in my calls to the user 07 FIFO to drop the backlight and once again it will run for hours with the lid open.

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests