Wifi connection porblem on Beaglebone Black

Hello guys,

I have managed to install Debian wheezy 7.5 on my BBB. I have gotten most of everything to work but i am having problems with the wifi connection. I am using an Asus N13 that has the RTL8192 chipset so it is sported by my deiban version, the drivers are already installed.
I modified the interfaces script form /etc/networks to enable wlan0 and inserted the respective user and pas for the modem i was connecting on. I did ifup wlan0 and the first time it worked fine it connected and i pinged google.com and it worked. But the second time when i reset and did ifup wlan0 again it started tying to connect but could not get past DCHODISCOVER and didn’t establish a connection. Next i tried with a different modem and modified the interfaces again. Same story first time worked the next times after that couldn’t connect.

After that i tried enabling the auto wlan0 line in the interfaces script so that it would do this on boot. This seemed to work for the first two times but today i am having yet again the same problem. I managed just a few minutes ago to get the connection up and running yet again ( i don’t know how though it just worked) and this time i checked to see what exactly it connected to:

DHCPOFFER from 192.168.1.1
DHCPACK from 192.168.1.1

Now unfortunately i don’t know how these ip addresses work but i know that 192,168,7.2 is the address i use to connect to the BBB when i do SSH form terminal and 192.168.7.1 is my computer (at least as far as i understand). So i do not know if it is getting internet through the usb cable or the wifi. To be sure i disabled my wifi on the computer and also unplugged my ethernet cable so i shouldn’t be getting internet form anything. I rebooted the BBB and i managed to connect again to wifi. Also to check i did ifconfig and got the following output :

eth0 Link encap:Ethernet HWaddr 90:59:af:5b:44:16
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Interrupt:40

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

usb0 Link encap:Ethernet HWaddr 0e:b5:cf:b9:5a:b0
inet addr:192.168.7.2 Bcast:192.168.7.3 Mask:255.255.255.252
inet6 addr: fe80::cb5:cfff:feb9:5ab0/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:303 errors:0 dropped:0 overruns:0 frame:0
TX packets:246 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:26794 (26.1 KiB) TX bytes:48312 (47.1 KiB)

wlan0 Link encap:Ethernet HWaddr bc:ee:7b:e5:11:90
inet addr:192.168.1.103 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::beee:7bff:fee5:1190/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:250 errors:0 dropped:5 overruns:0 frame:0
TX packets:104 errors:0 dropped:3 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:101359 (98.9 KiB) TX bytes:44326 (43.2 KiB)

From the looks of it usb0 should be my connection to the PC sinc the Inet addr is 192.168.7.2 , wlan0 is transmitting and recieving. But i don’t know exactly , i am a noob at these things.

The problem is that i do not know why it sometimes doesn’t work. The modem i am connecting to has full signal so i don’t think that is the problem. The pass and user have been checked so it should be fine. What i have suspicion for is the power supply. I am using a 4.5V 1A power supply. Most of the times it works with the wifi connected but about 3 times it happened that the whole board just shut down by itself after boot.

I thank you in advance for your responses and sory for the long post i just had to fill you in so it is more easy to see the problem.