| Author |
Message |
|
|
Posted: Dec 26, 2011 - 04:46 AM |
|


Joined: Dec 26, 2006
Posts: 1407
Location: Sydney, Australia
|
|
I have successfully been talking to a 3G usb modem using CDC interface. Problem is after I configure all the settings and APN and then do a dial up and establish an IP session, the port then becomes a data interface. After which I can see all the data transmission and reception etc..
But what if I want to use AT commands while data mode is still active? like say I want to querry the RSSI values etc using AT comands. How do I switch from PPP/data session to AT commands?
I have read about +++, but it doesnt do anything for me...  |
|
|
| |
|
|
|
|
|
Posted: Dec 26, 2011 - 02:13 PM |
|

Joined: Dec 30, 2004
Posts: 8721
Location: Melbourne,Australia
|
|
| The huawei modems have three ports. Also for +++ there is a guardtime before and after the sequence so that the pattern appearing in a valid datastream doesn't cause command mode. |
|
|
| |
|
|
|
|
|
Posted: Dec 29, 2011 - 02:47 AM |
|


Joined: Dec 26, 2006
Posts: 1407
Location: Sydney, Australia
|
|
ok thanks for that. I have managed to talk to the other diagnostics interface on the usb...so I can send commands through that interface (1) while data interface (0) is in use.
The other thing is how can the micro know if the data session is still up? What if for some reason the network disconnects the usb dongle? How will the micro know that? Is there a special char sequence sent to the interface when the modem is hung by network? Or something I could probe every few minutes? |
|
|
| |
|
|
|
|
|
Posted: Dec 29, 2011 - 03:41 AM |
|

Joined: Dec 30, 2004
Posts: 8721
Location: Melbourne,Australia
|
|
| Some timeago, you wanted to know how to talk to these devices and i suggested looking at linux sources. I suggest this again. Benefit from the open source revolution. |
|
|
| |
|
|
|
|
|
Posted: Dec 29, 2011 - 04:09 AM |
|


Joined: Dec 26, 2006
Posts: 1407
Location: Sydney, Australia
|
|
| back in the days when I was writing PPP with usb dongle I did indeed look them codes up. Most of them I found very hard to follow. I do have a successful PPP session written up, I just need to know how to detect a network forced disconnection... I shall google again. |
|
|
| |
|
|
|
|
|
Posted: Dec 29, 2011 - 04:20 AM |
|


Joined: Sep 04, 2002
Posts: 21248
Location: Orlando Florida
|
|
| If its like a modem, the Carrier Detect goes away doesn't it? |
_________________ Imagecraft compiler user
|
| |
|
|
|
|
|
Posted: Dec 29, 2011 - 04:21 AM |
|


Joined: Dec 26, 2006
Posts: 1407
Location: Sydney, Australia
|
|
Its a usb dongle modem. Dont think u can see carrier detect via + and - pins  |
|
|
| |
|
|
|
|
|
Posted: Dec 29, 2011 - 04:23 AM |
|


Joined: Dec 26, 2006
Posts: 1407
Location: Sydney, Australia
|
|
ok according to google... I am supposed to see "NO CARRIER" phrase coming from the usb terminal instead of a packet starting and ending with 0x7E (for ppp data session).
The NO CARRIER should tell me that the data session has ended...or a dial attempt was unsuccessful. |
|
|
| |
|
|
|
|
|
Posted: Dec 29, 2011 - 11:06 PM |
|


Joined: Dec 26, 2006
Posts: 1407
Location: Sydney, Australia
|
|
| Ok after 0x7E I expect a 0xFF (PPP address field) if this is not 0xFF then it would be '\r' char (if its text command response eg OK or NO CARRIER), this is what I catch. I use a state machine. Not sure how to simulate a NO CARRIER condition though to test it....lol I dont control the network! |
|
|
| |
|
|
|
|
|
Posted: Dec 29, 2011 - 11:13 PM |
|

Joined: Dec 30, 2004
Posts: 8721
Location: Melbourne,Australia
|
|
| Poke the dongle into a Coke can! |
|
|
| |
|
|
|
|
|
Posted: Dec 30, 2011 - 12:34 AM |
|


Joined: Jan 23, 2004
Posts: 9816
Location: Trondheim, Norway
|
|
You might also benefit from studying this project:
https://code.google.com/p/avrusbmodem/
Which uses my LUFA project to talk to a 3G modem and establish a PPP session to fetch data remotely (keep in mind that most of these dongles pass through a NAT at the carrier's end, and thus can't act as a server).
- Dean  |
_________________ Atmel Studio 6.1 is now released, grab it here.
Report AS6/ASF bugs here.
|
| |
|
|
|
|
|
Posted: Dec 30, 2011 - 07:46 AM |
|


Joined: Dec 26, 2006
Posts: 1407
Location: Sydney, Australia
|
|
hi Dean thanks...I did indeed look at your PPP stack n all long time ago. Whenever I read someone elses code I find it sucha hibijibi, so I end up writing my own! But it was helpful in understanding a few concepts neverthe less. I now have developed a full blown tcp/ip stack with sockets on UC3A1256. I am just worried about dynamic allocation of memory buffers during socket allocations lol...poor chip only has 64KB memory. I have like 4kb rx and 4kb tx buffer and pretty soon the number of sockets add up when you have HTTP, FTP, DNS etc!
Just now finished DNS code and it works!!! Yeeha!
I am currently using Vodafone SIM with Huawie dongle.. and it seems to give me public IP address, therefore I have managed to get a simple webserver going.
next is NTP!
Kartman, I have wondered about a metal box. Coke can sounds useful... I might give it a go soon. |
|
|
| |
|
|
|
|
|
Posted: Feb 21, 2012 - 08:27 AM |
|


Joined: Dec 26, 2006
Posts: 1407
Location: Sydney, Australia
|
|
Dean!!!
I have purchased some new modems... Huawei E153 and E160.
So far I had developped my code using E220 and E270 and it worked fine with those two. Both are essentially same and have the same VID PID. Even have the same interfaces!
With the E153 and E160 however things are a little different. For instance E153 it requires a modeswitch, which I have successfully done! But after mode switch it comes up with 5 interfaces!
They are:
Interface 0 class 255, subclass 255 protocol 255
--> 0: Endpoint ID 129, Type: 3
--> 1: Endpoint ID 130, Type: 2
--> 2: Endpoint ID 1, Type: 2
Interface 1 class 255, subclass 255 protocol 255
--> 0: Endpoint ID 131, Type: 3
--> 1: Endpoint ID 132, Type: 2
--> 2: Endpoint ID 2, Type: 2
Interface 2 class 255, subclass 255 protocol 255
--> 0: Endpoint ID 133, Type: 2
--> 1: Endpoint ID 3, Type: 2
Interface 3 class 255, subclass 255 protocol 255
--> 0: Endpoint ID 134, Type: 2
--> 1: Endpoint ID 4, Type: 2
Interface 4 class 8, subclass 6 protocol 80
--> 0: Endpoint ID 135, Type: 2
--> 1: Endpoint ID 5, Type: 2
Interface 5 class 8, subclass 6 protocol 80
--> 0: Endpoint ID 6, Type: 2
--> 1: Endpoint ID 136, Type: 2
Interface 0: is Modem Interface
Interface 1: is 3G Network Card (ethernet interface)
Interface 2: Application Interface
Interface 3: PC UI Interface
Interface 4: Mass storage
Interface 5: Mass storage
I have successfully started an AT command session with the E153. However if I start sending LCP packets to start up PPP session, I get no reply back from the usb! What does that mean? Any ideas? |
|
|
| |
|
|
|
|
|
Posted: Feb 21, 2012 - 11:45 AM |
|


Joined: Dec 26, 2006
Posts: 1407
Location: Sydney, Australia
|
|
Where is Dean?  |
|
|
| |
|
|
|
|
|
Posted: Feb 21, 2012 - 07:16 PM |
|


Joined: Jan 23, 2004
Posts: 9816
Location: Trondheim, Norway
|
|
Working during the day .
Hrm. Are you sure the pipes are binding to the appropriate endpoints in the modem? IIRC even the biggest USB AVR host doesn't have THAT many pipes/endpoints. Are you using some sort of selection criteria to only bind to the interesting endpoints within the device so you don't run out of them?
- Dean  |
_________________ Atmel Studio 6.1 is now released, grab it here.
Report AS6/ASF bugs here.
|
| |
|
|
|
|
|
Posted: Feb 21, 2012 - 07:58 PM |
|


Joined: Dec 26, 2006
Posts: 1407
Location: Sydney, Australia
|
|
yes yes I only bind to interface 0 and interface 3...and yes I can read the diagnostic pc ui interface RSSI values on interface 3...as well as send the AT commands on interface 0. Its just that once you do ATDT*99# on interface 0, it shows CONNECT and it doesnt accept anything else....
Normally with E220 or 270 after displaying CONNECT it starts to accept LCP packets starting with 0x7E....and similarly responds back with such packets...
but this does not happen with E153 on interface 0.  |
|
|
| |
|
|
|
|
|
Posted: Feb 22, 2012 - 07:53 AM |
|


Joined: Dec 26, 2006
Posts: 1407
Location: Sydney, Australia
|
|
I have noticed something...with E153...it comes up with endpoint sizes of 512 on my laptop...so that would be the High speed configuration... there is the "other speed configuration" which keeps all endpoint sizes to 64bytes. Should initialize the usb device with that option?
Does it matter if I keep my endpoint sizes to 64 but the usb device has its end set to 512bytes? |
|
|
| |
|
|
|
|
|
Posted: Feb 22, 2012 - 11:13 AM |
|


Joined: Dec 26, 2006
Posts: 1407
Location: Sydney, Australia
|
|
Ok when you connect it to laptop it shows up endpoints with 512 bytes (high speed configuration 1), but when I connect it to my UC3A it automatically knows that the connection is a full speed, hence shows the end point sizes to be 64 (full speed configuration 1). So end point is not an issue here...
I am still banging my head wondering why after "CONNECT" the interface will not respond to my LCP packets....the usb itself is transfering the LCP requests as I am not getting any NACK or STALL. But just not getting anything back in return to my LCP requests... wat could be wrong?  |
|
|
| |
|
|
|
|
|
Posted: Feb 26, 2012 - 06:03 AM |
|


Joined: Dec 26, 2006
Posts: 1407
Location: Sydney, Australia
|
|
OK!!!!
Finally I have figured out what was wrong!!!
Amazing how things work out.... looks like there was mistakes in my PPP FCS calculation since the beginning. And when I initially developed my code using Huawei E220 and E270, everything worked fine. Proving that those 2 devices do not care if the PPP FCS is not a correct one!!
But when I was trying to work with E153 and lately E173 as well, they both require correct PPP FCS. Otherwise the modems wont respond to any LCP request packets you send. Now I have a working system that is compatible for E220, E270, E153, E173 and E160 (potentially).
I would like to note that E153 requires a mode switch string to be sent, E173 doesnt (just plain set config at 1). Havnt tried E160, but I have a feeling it doesnt require a mode switch string either being a much older device.
Now a 3G modem expert! Until I find other problems
So it seems like the issue I had when I was trying to talk to a ZTE626i modem would have been due to the wrong PPP FCS as well. I just need to add the driver (end point maps) in my code for it to work....  |
|
|
| |
|
|
|
|
|