• AVR Freaks

MCP2200 Effectively Limited to 240000bps

Author
bmwman91
Starting Member
  • Total Posts : 33
  • Reward points : 0
  • Joined: 2007/08/31 08:27:39
  • Location: USA
  • Status: offline
2011/02/21 00:01:14 (permalink)
0

MCP2200 Effectively Limited to 240000bps

This is more of an observation than anything since this isn't really impairing the product I am working on. While experimenting with my MCP2200 demo board, I had my USBee ZX on there to get a feel for timing accuracy. I am pleased that the MCP2200 bit timing is pretty accurate with the standard baud settings, up to 921600 (versus the Prolific USB-serial adapter it was talking to...|error| of >2.5% at the same rates).

Anyway, while the bit timing is dead-on, the actual data throughput rate seems to hit an actual limit at 230400bps (or 240kbps more likely). The linked USBee shots are probably faster to get the message from. In short, setting the baud rate higher than this reduces bit time, but the "stop bit" gets longer as the rate goes up, so byte timing remains the same. I assume the disguised PIC18 badged as the MCP2200 is dealing with "something" internally during this pause. All shots are with the same timescale and trigger position, with 10 bytes of value 0 being sent from the MCP2200.

230400bps


480600bps


921600bps


The prolific device does not have this pause at any baud rate. It just pumps out data bytes back-to-back.

I also noted that at these higher baud rates (230400bps & above), the MCP2200 seemed to "lose" data bytes. I made a VB app to test comm in both directions. I set the number of bytes to transmit, sent a (bytes to transmit)-long byte array out one COM port and counted how many came in the other COM port.
- When the MCP2200 transmitted a packet, the Prolific device generally picked them all up at 230400bps. (10/10, 100/100, 500/500). At 921600bps, it would catch ~490/500 bytes.
- With the Prolific device as the source though, the MCP2200 would consistently miss some at 230400bps (7/10, 96/100, 478/500). Above this baud rate, it all went downhill. At 921600bps, the MCP2200 would pick up ~70/500.

Anyway, this seems to be due to a mixture of the Prolific device's out-of-spec timing, and at higher data rates, primarily the big inter-byte dead space of the MCP2200. I just wanted to share my $0.02. Basically, I am very happy with the MCP2200 at 115200bps. It works like a charm, and I haven't had to mess with any Win7 hotfixes or anything. I installed the Microchip drivers, and it worked right away.
post edited by bmwman91 - 2011/02/21 00:06:04
#1

8 Replies Related Threads

    chinzei
    Super Member
    • Total Posts : 2250
    • Reward points : 0
    • Joined: 2003/11/07 12:39:02
    • Location: Tokyo, Japan
    • Status: offline
    Re:MCP2200 Effectively Limited to 240000bps 2011/02/21 03:34:05 (permalink)
    0

    Thanks for your share of your observations.
    With your scope picture, MCP2200 firmware supplies data to its UART at the speed of around 40 us/byte. It takes around 500 instruction cycles to process 1 byte.
    It's too slow process speed for PIC18F14K50 (MCP2200 is considered to be based on PIC18F14K50). Microchip should tune the firmware more to get better performance on RX/TX.

    Tsuneo
    #2
    sborden
    Super Member
    • Total Posts : 1932
    • Reward points : 0
    • Joined: 2010/08/05 02:12:53
    • Location: 0
    • Status: offline
    Re:MCP2200 Effectively Limited to 240000bps 2011/02/21 12:40:44 (permalink)
    0
    You realize, I hope, that most adapters request you use hardware handshaking at rates over 115200.  The problems I have found is the USB itself, depending on packet configuration.  As Tsuneo mentions, it is possible the MCP device is missing during the USB transfer part.
    #3
    bmwman91
    Starting Member
    • Total Posts : 33
    • Reward points : 0
    • Joined: 2007/08/31 08:27:39
    • Location: USA
    • Status: offline
    Re:MCP2200 Effectively Limited to 240000bps 2011/02/21 20:36:06 (permalink)
    0
    I can see good reasons for why handshakes are needed at >115200bps.

    Yes, it would be nice if the PIC18F14K50's firmware was tweaked a little. I don't know much of anything about the USB protocol, so I won't go making demands in that respect!

    Oh, one other thing...
    Is it possible to (through visual basic) detect the presence of the MCP2200? It is fine to have a new COM port pop into the Windows' device manager, but if I could poll the device for its PID/VID that would be great. Otherwise, with multiple devices connected it can get to be a chore to keep them sorted!
    post edited by bmwman91 - 2011/02/21 20:37:59
    #4
    chinzei
    Super Member
    • Total Posts : 2250
    • Reward points : 0
    • Joined: 2003/11/07 12:39:02
    • Location: Tokyo, Japan
    • Status: offline
    Re:MCP2200 Effectively Limited to 240000bps 2011/02/21 21:13:39 (permalink)
    0

    Is it possible to (through visual basic) detect the presence of the MCP2200?

    This code scans virtual COM ports for specified VID/PID
    Change the VID/PID to those of MCP2200
    http://www.microchip.com/forums/fb.ashx?m=365029

    Here is similar code for SiLabs CP210x, for C++ and C#
    It is applied to Microchip MCP2200, when just VID/PID is changed.
    http://www.cygnal.org/ubb/Forum9/HTML/001659.html

    For VC++
    CString deviceID( _T("USB\\VID_04D8&PID_00DF&MI_00\\") );

    For C#,
    String deviceID = @"USB\VID_04D8&PID_00DF&MI_00\";

    Tsuneo
    #5
    bmwman91
    Starting Member
    • Total Posts : 33
    • Reward points : 0
    • Joined: 2007/08/31 08:27:39
    • Location: USA
    • Status: offline
    Re:MCP2200 Effectively Limited to 240000bps 2011/02/22 23:28:06 (permalink)
    0
    Thanks for the helpful pointers. They led me in the right direction. I found that using System.Management.dll, which is included in the .NET framework 2.0 & beyond allows for effortless parsing of hardware devices. In this case, I have a loop that is looking specifically for devices with the right VID/PID in the PnpDeviceID string.

    Here is some code illustrating how I am doing this. In this case, it just adds lines to a listbox control so I can see what all the properties of devices are. After running this with the MCP2200 connected, the listbox contains these 3 string-items.
    "PNPDeviceID: USB\VID_04D8&PID_00DF&MI_00\6&D11F8C0&0&0000"
    "Name: USB Serial Port (COM5)"
    "Status: OK"
    This looks like everything one would need to check connectivity. Using the Win32_PnPEntity class instead of the Win32_SerialPort class lets you get at the Manufacturer of the device too, but you need a bit more filtering since the MCP2200 enumerates to 4 devices with the same VID/PID. You'd need to make sure that the device name contained "Port (COM" or something like that.

      
    Public Class Form1

        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Dim PnpDeviceClass As New System.Management.ManagementClass("Win32_SerialPort")
            Dim PnPDevCollection As System.Management.ManagementObjectCollection = PnpDeviceClass.GetInstances()
            Dim PnPDevice As System.Management.ManagementObject

            For Each PnPDevice In PnPDevCollection
                If PnPDevice.GetPropertyValue("PNPDeviceID").ToString.Contains("VID_04D8&PID_00DF") Then
                    ListBox1.Items.Add("PNPDeviceID: " & PnPDevice.GetPropertyValue("PNPDeviceID").ToString()) ' This contains the VID & PID values you want to look for
                    ListBox1.Items.Add("Name: " & PnPDevice.GetPropertyValue("Name").ToString()) ' This has the description you see in Win device manager, including COM#
                    ListBox1.Items.Add("Status: " & PnPDevice.GetPropertyValue("Status").ToString) ' Will return "OK" if device is functioning properly
                End If
            Next
        End Sub
    End Class


    If you are interested in other hardware stuff you can get at, look up the Win32 class on MSDN. "Win32_SerialPort" is one of its MANY hardware-related subclasses.

    Just add a reference to your project to System.Management.dll which is located in \Windows\Microsoft.NET\Framework\[VERSION], or \Windows\Microsoft.NET\Framework64\[VERSION]. It has many useful methods, although MSDN doesn't document them as well as I'd like! Thankfully, the internet seems to have all the answers with a little looking.

    I wonder if this would be more useful to everyone in a thread that wasn't titled like a complaint...I have hijacked myself!
    post edited by bmwman91 - 2011/02/23 10:55:43
    #6
    bmwman91
    Starting Member
    • Total Posts : 33
    • Reward points : 0
    • Joined: 2007/08/31 08:27:39
    • Location: USA
    • Status: offline
    Re:MCP2200 Effectively Limited to 240000bps 2011/02/23 10:51:43 (permalink)
    0
    Quick update...there's an even simpler way to do it.

     
    Imports System
    Imports System.Management

    Public Class Form1

        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

            Dim searcher As New ManagementObjectSearcher("SELECT * FROM Win32_SerialPort WHERE Status='OK'") ' Only want functioning serial ports

            For Each moDevice As ManagementObject In searcher.Get()
                If moDevice.GetPropertyValue("PnPDeviceID").ToString().Contains("USB\VID_04D8&PID_00DF&MI_00") Then ' Does the device info contain the MCP2200 'signature'?
                    ListBox1.Items.Add("PnPDeviceID: " & moDevice.GetPropertyValue("PnPDeviceID").ToString()) ' Has the sought VID/PID info in the string
                    ListBox1.Items.Add("Name: " & moDevice.GetPropertyValue("Name").ToString()) ' Get COM# from here
                End If
            Next

        End Sub
    End Class


    Search Tags:
    Visual Basic .NET MCP2200 USB COM Serial Port Number DeviceID PnPDeviceID Name VID PID Windows Identify Locate Locating Finding System.Management.dll Managementobject

    post edited by bmwman91 - 2011/02/23 11:27:04
    #7
    sborden
    Super Member
    • Total Posts : 1932
    • Reward points : 0
    • Joined: 2010/08/05 02:12:53
    • Location: 0
    • Status: offline
    Re:MCP2200 Effectively Limited to 240000bps 2011/02/27 18:32:33 (permalink)
    0
    Hey!  We're confirmed!  This arrived in my regular "notifications" from MCP:
    MCP2200 Speed Errata
    #8
    jaxlau
    New Member
    • Total Posts : 6
    • Reward points : 0
    • Joined: 2007/08/15 10:44:08
    • Location: 0
    • Status: offline
    Re:MCP2200 Effectively Limited to 240000bps 2011/03/31 21:47:24 (permalink)
    0
    Hello, I have a similar problem when using the stock USB CDC stack with a 18f26j50 device. When I try to run the device at 921600bps, I get a few errors here and there. Could it be that the same silicon errata applies to the 26j50 device, even though nothing is mentioned in the official document? Is there any firmware patch that you know that would make the CDC stack or I the UART quicker to response?

    Thanks!
    #9
    Jump to:
    © 2019 APG vNext Commercial Version 4.5