I got no idea if it helps, but this is Nintendo's official support site thingamajing's explanation:
http://www.nintendo.com/consumer/wfc/en_na/ds/results.jsp?error_code=001-0502&system=3DS&locale=en_US&action2.x=24&action2.y=19If you're not using a hotspot (which I guess you aren't, as you're fiddling with the router to get it to work), the only real options they give you, are these:
Make sure that the Nintendo 3DS system is within 30 feet of the wireless access point and facing in its general direction.
Make sure that any other interfering devices, such as microwaves and cordless phones, are turned off.
Not very helpful, but still worth checking to see if you're close to a microwave, a huge magnet, or other stuff like that.