Jump to content

Weird DSWiFi connection Problem (and a partial solution)


Magin

Recommended Posts

Hi! I have a problem with the DSWiFi, i will post here the data to see if some DSWiFi code guru can see a total solution.

 

Hardware: DS Lite (new), with NinjaDS Stick.

 

Problem: All homebrew programs fails at connecting keeping in shearching AP forever, all Oficial Nintendo DS games work well. Tested with all combinations posible (WEP,DCHP,Etc.)

 

After doing a bit of research in the source of the DSWiFi (all versions included the latest 0.3c) i found that it nevers receives data, to be exact enters in the function Wifi_Intr_ExEnd but never enters in the while, so i tought that the hardware is not correctly initialized, but after doing more research casually found a partial solution:

 

Partial Solution

Compiling the DSWifi lib in the R17 version of DevkitPro works!!!

Compiling it with the /O0 (no optimize) of any Devkitpro version also works!!!

 

So i think is a problem with the new optimitations of GCC 4.1.1 (r18 +) that must do someting bad at initializing the hardware, optimizing part of the code that must not be optimized or making it too fast for Ds hardware accept it well.

 

With recompiling the lib and the homebrew programs works somewhat well but i still have sometimes problems with accept and recv, and the worse of all... i dont have the source code of all homebrew programs (BeUp <_< )

 

My DsWifi and Ds hardware knowdeledge are not enought to solve this problem so please if someone have the same problem please comment!.

Edited by Magin
Link to comment
Share on other sites

  • Replies 23
  • Created
  • Last Reply

Top Posters In This Topic

I have a DS Lite bought in October 06 and I have the same problem, so I'm totally stoked that you've found a clue about it. One correction: You probably meant to write "Wifi_Intr_RxEnd" as the function with the problem, right?

 

You say the loop is never entered, eh? I wish I could help figure it out. WIFI_REG(0x5A) looks like it tells you where to read a packet from, but that's the only reference to WIFI_REG(0x54) I can find in the code at all, so who the hell knows what it is? :P

 

Edit: On further thought, I guess it's supposed to be the end of the packet buffer.

 

BTW, how did you figure this out? I'm a C programmer but I'm totally new to embedded programming in general and DS programming in particular. Can you insert printf's in this code somehow?

Edited by lokicat
Link to comment
Share on other sites

W00T! It works here too. Note that you only need to compile the arm7 part with -O0. I left optimizations on for the arm9 code and it works fine.

 

Now we just need all the homebrew developers to compile their wifi libs that way.... :P

 

Edit: Yowsa! I just used wifi_lib_test in wardriving mode and found *68* access points by just walking around my apartment! :P

Edited by lokicat
Link to comment
Share on other sites

I have a DS Lite bought in October 06 and I have the same problem, so I'm totally stoked that you've found a clue about it. One correction: You probably meant to write "Wifi_Intr_RxEnd" as the function with the problem, right?

 

You say the loop is never entered, eh? I wish I could help figure it out. WIFI_REG(0x5A) looks like it tells you where to read a packet from, but that's the only reference to WIFI_REG(0x54) I can find in the code at all, so who the hell knows what it is? :P

 

Edit: On further thought, I guess it's supposed to be the end of the packet buffer.

 

BTW, how did you figure this out? I'm a C programmer but I'm totally new to embedded programming in general and DS programming in particular. Can you insert printf's in this code somehow?

 

 

Yes i mean Wifi_Intr_RxEnd, the E is the key that is at the side of R and i misstyped it XDDD

Im absolutelly noob on the DS wardware too, i found this only by pure luck, testing apps i found that an older version of wifi_test works (0.2a i think was) and recompiling it didnt work because i was using DevkitproR20, so after digging a bit i found the correct versions the make it work, and etc..

 

There are others homebrew that i tested later and works without recompile:

 

DSorganize (its compiled with R17 version)

DsLinux (they use they own version of dswifi, and can be they corrected something)

wifi_test0.2b or older taken from the page of the autor

 

So if anyone cant conect with other programs and can with these, you have the same problem.

Please add more homebrew if you found it!

 

 

Edit:

To test the the functions in the arm7 code i copy some variables i want to a region in shared memory and modify the arm9 wifi_test app to print out these values. I used some ints for the counts and a small char[64] to look what is doing. You can put more things if you use the FIFO queue properlly but i didnt want to interfere in the wifi_lib work.

Edited by Magin
Link to comment
Share on other sites

this is awesome. i can't wait for my ds lite to have wifi connection. :P

Pointy Remote wifi works for the ds lite which was weird since that was made about a year ago and all the new wifi stuff doesn't work for my dslite

 

some homebrews that don't work for my DS lite (even with 0.3d/0.3e wifi update)

-Bunjallo: new DS browser with simple browser stuff (no special html stuff, no pics, flash, etc)

http://code.google.com/p/quirkysoft/

 

-dsAIM: AIM instant messenger

http://forum.gbadev.org/viewtopic.php?t=10...c&start=240 <-- its somewhere in the forum

 

-Beup

 

 

-DSFTP 2.4

 

btw,

will there be a place where i can dl ur updated version of the homebrew or will u give it to the developers to distribute?

Edited by Greed0
Link to comment
Share on other sites

Hiya Magin,

This is an interesting discovery but also very strange, as the apps I have compiled with devkitpro R20 using -O2 do indeed work correctly on my DSlites (though they're the older kind.)

I can think of a few places in the code where optimization might cause problems... but if it were a bad problem I would have noticed, instead it seems like it might be a timing issue or maybe very specific to the new hardware?

If you have a chance, can you test the wireless lib test app I've compiled, at http://akkit.org/dswifi/wifi_lib_test.nds -- this *is* compiled with devkitpro R20, using -O2... but so far, from what I know it does work for everyone.

 

Thanks,

-Stephen

Link to comment
Share on other sites

Hiya Magin,

This is an interesting discovery but also very strange, as the apps I have compiled with devkitpro R20 using -O2 do indeed work correctly on my DSlites (though they're the older kind.)

I can think of a few places in the code where optimization might cause problems... but if it were a bad problem I would have noticed, instead it seems like it might be a timing issue or maybe very specific to the new hardware?

If you have a chance, can you test the wireless lib test app I've compiled, at http://akkit.org/dswifi/wifi_lib_test.nds -- this *is* compiled with devkitpro R20, using -O2... but so far, from what I know it does work for everyone.

 

Thanks,

-Stephen

 

Tested: No AP found as always, no packet received.

Better if lokicat test it too.

Thanks for taking a look at it anyways!!!

Link to comment
Share on other sites

Magin, lokicat; I think this is probably more likely related to the flashcard you're using to run the wifi apps - can you tell me what flash card you're using? There may be a hidden problem with the lib that doesn't show up except under very specific timing, which is triggered by the way the flashcard boots or something... but if I can't duplicate it, it's a lot more difficult to fix.

 

-Stephen

Link to comment
Share on other sites

Magin, lokicat; I think this is probably more likely related to the flashcard you're using to run the wifi apps - can you tell me what flash card you're using? There may be a hidden problem with the lib that doesn't show up except under very specific timing, which is triggered by the way the flashcard boots or something... but if I can't duplicate it, it's a lot more difficult to fix.

 

-Stephen

 

1. I'm using an ezflash 5 with a Japanese Kingston 1GB microSD.

 

2. Your wifi_lib_test doesn't work for me. When I recompile it against my -O0 arm7 dswifi lib then it works.

 

However, the -O0 trick doesn't seem to be a cure-all. I got DSFTP compiled against my dswifi (which was *not* fun, by the way) and it basically works, but it tends to crash pretty often. I suspect you're right about the timing issue, though I don't understand how the flashcard figures into it. (like I said, I'm a bit of a newbie) Maybe I'll try fiddling with the ez5 memory timing settings...

 

Edit: I tried speds 2, 5, 7, and 10 with the same results. No access points detected. B)

Edited by lokicat
Link to comment
Share on other sites

lokicat: thanks - I'll look into it further.

Please note that the -O0 'trick' is just that, it's not changing anything except for how optimized the code is - if there are timing-specific problems, it has the potential to change them, but it is generally not fixing anything unless the compiler is broken... which it's not.

I still don't know what the problem is, but I'll do what I can to find out...

 

-Stephen

Link to comment
Share on other sites

lokicat: thanks - I'll look into it further.

Please note that the -O0 'trick' is just that, it's not changing anything except for how optimized the code is - if there are timing-specific problems, it has the potential to change them, but it is generally not fixing anything unless the compiler is broken... which it's not.

I still don't know what the problem is, but I'll do what I can to find out...

 

-Stephen

 

 

I use a NinjaDS Stick version tested with bios 1.03 and 1.05 and SD speeds 1, 2, 3

 

About the -O0 trick note that the R17 (gcc 4.1.0) version compiles without problems and the laters (gcc 4.1.1) needs the -O0 so must be something about the news optimitations of this version.

 

 

If you wish you can write a little app to show the registers and i will execute and copy the results, to look what registers are wrong set or something, for my is too hard to program it at my level XDD

 

 

Very much thanks for the annoyance!!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...