Monday, 12 November 2012

Getting TPLink MA180 to work on PIC24FJ256GB106

For this project will use the Microchip USB host driver. To get it to work, need to create new driver to first switch to USB modem mode, setup the endpoints to transfer the AT command to the endpoints.

Try to send some AT commands.
so far so good!
Next will pop in a valid SIM Card and check if I could send and receive SMS using PIC24FJ256GB106 with a TP Link MA180 USB 3G Modem.


  1. Could you sample this step?
    I don't understand what's this program where I can download it ... etc

  2. My idea of current usage is to remote controll some equipment using SMS messages. This solution will not use any computer but micro controller with GSM module. GSM module is expensive and difficult to get here so USB 3G is used instead.

    I just got the USB driver to work on pic24fj256gb106. Still working on the at command parser.

  3. Thanks for your reply,

    I know all of it and I need to interface a 3G USB modem with MCU in my project to send and receive data from web server.
    I have downloaded the usb view and have known all the information for my 3G USB Modem.
    I appreciate your work here, and hope you simplify and explain the next step starting with this step.

    1. So far I never tried the 3G data transfer but it seems interesting to me. So let 's try first. Before begin maybe you can tell me more about your 3G USB modem? Also the micro controller you are planning to use.

      Most USB modem connect by USB CDC class. For my case it is using serial CDC class. This USB class is provided by Microchip USB stack.

      Before my USB can enter this CDC mode, it needs to switch the mode. Each USB dongle needs to handle this differently. Please google usbmodeswitch to find more about your USB 3G to see if it require this step or not.

    2. Ok Cthun,
      That's my progress till now.
      as you know I need to interface 3G USB Modem to MCU in my case I'm using Arduino Mega (AVR Atmega 2560) (which doesn't have USB OTG or Host controller)
      so I thought in the usb host shield but it's unfortunately unavailable here in Egypt.
      I had searched a lot in this topic and I found a chip called VNC1L (that's usb host controller)
      I made its module (PCB design) but I found it will need to be programed firstly.
      I searched in its website and found the exactly firmware which will be suitable for my application.
      it's VCDC Communication Device Class Firmware (as the 3G USB modem its category CDC).
      unfortunately this firmware is unavailable & I must to Request from Vinculum Support (I've already requested it but no answer till now) :(

      So I searched about a MCU which has built in USB Host controller, I found PIC24F has this feature :)
      Thus I'm trying to interface my USB Modem with PIC24F.
      My USB modem it Huawei E303

      so I'm gonna to start this from the beginning :(

    3. I searched about usbmodeswitch as you said and undertand what you mean, my Huawei E303 USB Modem have two modes (1) USB flash memory storage (2) USB Modem.

      when I put a memory Card in it, it's shown as a USB flash memory storage else USB Modem whatever I put a SIM card or not.

      so I think in my software I should be aware to this point and force my USB modem to run as Modem (CDC)

    4. If you found that your USB Modem need to perform modeswitch to ended Modem mode, then you need to find out the command sequence.

      I found mine by examine the usbmodeswitch debug log in a linux system. Then later I found the same information on the internet. The message content is the data sequence we need to send to the USB to switch it to modem mode.


      # TP-Link MA180
      InquireDevice = 0
      DefaultVendor= 0x2357
      DefaultProduct= 0x0200

      TargetVendor= 0x2357
      TargetProduct= 0x0201

      CheckSuccess= 10


    5. Once you have the pic24 OTG system, I can send you my code as a reference and try to get your USB 3G to work.

    6. ok, I'll install Linux and check my modem

    7. unfortunately, I didn't find PIC24FJ256GB106 or any MCU whatever PIC or AVR which has USB OTG :(

      whatever I got the firmware CDC for VNC1L, I'm gonna to figure out that.

      Hope to know from you the steps which I'll follow them to success in interface my USB modem with Arduino.

      Thank you very much for your helpfulness and kindness.

  4. This comment has been removed by the author.

  5. Hello Cthun,
    I hope you are fine.

    It has been time since I communicate with you, the good news I'm on my way to connect my modem with Arduino, but need a little help from you.
    I'm using Arduino Mega + USB Host Shield + Huawei k3770

    I have searched about AT Commands for Huawei k3770, I found this command
    AT^SETPORT="A1,A2;1,2,3,7" - Disable CD+SD after modeswitch
    and use this example

    but in the USB desc it's still a mass storage (0×08)

    By examine the usbmodeswitch debug log in a linux system I found

    DefaultVendor= 0x12d1
    DefaultProduct= 0x14d1
    TargetVendor= 0x12d1
    TargetProduct= 0x14c9
    TargetClass= not set

    MessageEndpoint= not set

    so I think the important details is
    DefaultVendor= 0x12d1
    DefaultProduct= 0x14d1
    TargetVendor= 0x12d1
    TargetProduct= 0x14c9

    Could you tell me how I can make some coding in my software to switch Huawei k3770 to modem mode firstly before I sent AT Commands?

    1. In the current default vendor and product id, just send the message content data to the input end points. If done correctly the USB device will disconnect and reconnect with the target vendor and product I'd.

  6. Hello all,
    I'm looking for the AT command line manual for the MA180, any idea where I could find it ? I'm browsing since hours without any success,

  7. Hello Cthun,
    Thanks for the great work. Could you please post your c or mplab code to use as reference? Thanks

  8. Hi,

    Can you please help me out in initiating a mode switch ... I have no idea where to configure it in a PIC24f Microchip host driver

    Ash Indiano

  9. Hi,
    Hey i have bought a PIC24 starter kit 1 with USb host capability.Can you please send me your code for interfacing a USB GSM dongle with PIC24 a s host.I need to fire some AT commands using the USB GSM dongle via the PIC24 controller.


  10. Can you send me the code and schematics for your design ? i have tested a few builds and have some problems with own code, it would be better to use ready to go fetid chips, but i have already got 5 pieces of PIC24 so i'll try to make use of them.

    Your design would be useful for reference.