This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

“How to Design USB Applications with MSP430 MCUs” webinar

Other Parts Discussed in Thread: MSP430F5529

We (myself and another engineer at my company) watched the webinar and learned about the MCU-side of the development effort. It was very informative, and do appreciate all the latest development tools, including TI-REX integrated in CCS 5.5. However, the PC-side of the development effort was not discussed at all. Do you have any information on this? Do you plan a future webinar on the topic?

Specifically we need to know how to use Microsoft Visual Studio.NET tools, arguably the most prevalent Windows development platform, including C# and VB, to interface to the various USB API interfaces exposed. The Virtual COM Port (CDC) is a no-brainer, as there is a serial port class and serial port control in .NET, however we don’t know how to deal with the other interfaces, and any driver development required. And remember, for Windows 8 Microsoft requires WHQL certification on all custom drivers, including drivers that simply change parameters such as VID and strings.

I know as a chip manufacturer this is not TI’s main concern, but in order to leverage the use of your hardware, developers need to be guided on the PC-side of the development effort. After all, the MCU side is all about the device, but that device needs to be connected to something to make it useful.

Thank you for any assistance in this area.

Ed

  • I want to echo Ed's question about Windows and the CDC driver.

    Keith (TI application engineer) talked about an INF file when using the CDC driver on Windows. In my experience, these need to be signed by Microsoft to get a "silent install" of the hardware driver when plugging a new USB device into a windows box.

    Does this INF need signing on Windows?

    ~Todd

  • Good questions... let me respond to the Visual Studio question first, then the CDC INF. 

    And let me also say that as a chip vendor, we do actually see host software as our problem, for the reason you mentioned.  We try to remain aware of community options, and complement those options -- but certainly when it comes to communications buses, it takes two to talk. 

    With respect to Visual Studio, let me tell you where things are, and the reasons behind what we've been doing.  Then I'm going to ask specific ways this meets or doesn't meet what you need. 

    We basically have two USB packages on the PC side:
    *  the HID Demo App; demonstrates doing HID on the host, with the default configuration set up for HID-Datapipe
    *  the Firmware Updater (for use with the USB BSL)

    (These were both on the slide near the end listing the components of the USB Dev Package.) 

    The assumption is that virtual COM ports and storage volumes (CDC/MSC) aren't a huge challenge, because their PC-side interfaces are so well-established and common.  But HID, being more specific to USB and generally more complex, needs some help. And the Firmware Updater is needed because our bootstrap loader (BSL) has a protocol to follow. 

    Until the last year or so, both these packages were written in Visual Studio.  They were in use since we added USB to MSP430 about four years ago.  As I roughly recall, I think both had an underlying DLL written in C, and then a GUI written in C++. 

    But separately there's a movement in TI toward cross-platform support.  I think the assumption we have is that being cross-platform doesn't lose anything on the Windows side -- it only adds Linux/Mac into the fold.  (Well, moreso Linux, at the moment .) 

    And so the HID Demo App was replaced with a Java project -- a GUI built upon an open-source HID library (built and maintained by someone outside TI).  The Firmware Updater was just recently replaced with a Python project -- again, a GUI built upon an open-source library called python-tools. 

    This was seen as only adding something, not taking it away.  Ed, your question shows you didn't experience it that way.  I'm guessing you have a comfort level with Visual Studio and want to continue using it for that reason.  Can you give other thoughts/reasons to the above and why it doesn't work for you? 

    I think your comments can help us refine our approach.  I can't guarantee any specific action, only that I will take it to the people who can make these decisions. 

    Thanks,
    Keith

  • Thanks for the explanation Keith. I'm really happy that you have gone to a more open source based approach. I have been waiting 2 years to be able to use the CCS 5 I bought for linux. It is only with the release of the USB msp430f5529 lp I can finally use it fully.  Thanks for addressing the licensing and fixing the USB descriptor tool to work properly on linux.

    People developing on windows and Visual Studio already have a wealth of tools and documentation from Microsoft to successfully develop USB code for all their languages.

  • Keith,

    Thank you for your reply to my post. I am glad to hear that you guys at TI do see the PC-side development as your “problem”, too, as it is essential in leveraging the design-in of your MCU’s. Let me answer your questions about my needs specifically.

    I am an EE, not a computer scientist, as I’m sure that the majority of embedded developers are. (“Pure” software guys are virtually clueless in embedded development as they can rightfully say about embedded guys in PC software development. Fair enough.). We are currently using an MSP430 in our products, and are intending to expand its usage in new products currently in various stages of design. We are experienced embedded C developers (I personally started with assembly language before C was available for microcontrollers, but that goes back to the early 1980’s), integrating hardware and software, but have somewhat less experience in PC software. Currently we are using a serial to USB “bridge” with a VCP interface for communication with PCs. (Of course our most of our devices also support a “real” serial port, which are becoming rarer and rarer as time goes on.) The VCP solution has driver issues, as I mentioned, but they are manageable.

    Over 20 years ago I started using Visual Basic (VB3 to VB6) for PC software needs. I also spend several years developing with National Instrument’s LabVIEW. Now using the .NET tools we have transitioned to C# (VB is virtually identical for all intents and purposes). I can’t spend my professional life learning and adapting to new software ecosystems, for lack of a better term. We need to create products, not constantly learn new tools, such as Java or Python. Sure, we have the ability, but tomorrow it will be something else, some “new kid on the block” development environment. (Sorry for the venting!) I also know that TI is a victim of this as much as we are.

    I haven’t downloaded your MSP430 USB Developers Package yet, but intend to, so I don’t know how much the Visual Studio application for the USB Field Firmware Updater will help us. I need to see if it is in C++ or C#.

    Now I know you could simply throw this ball into Microsoft’s court, after it is they are the ones who *should* provide a toolbox control for USB similar to their Serial Port control. But that doesn’t seem to be happening. Currently it looks like the only solution with .NET code is to use Windows API calls. There is also WinUSB, but that’s another learning curve. I also know that Jan Axelson has some example HID code.

    What would be extremely helpful from TI are to provide some reference designs for deveolpers like myself. Is it possible for TI to port over their Java and Python code to C# (and VB)?

    Thanks,
    Ed

  • From the lack of activity on this forum thread, it looks like either 1) not too many people are using the USB capability of the MSP430, or 2) not too many people are interfacing to a PC.

    If 2 is true, then what hosts are they interfacing with and in what language? If 2 is false, then what programming language(s) are people using for the PC? Is anyone using Java or Python (usually used for web development, to my understanding) for desktop apps which can interface with Windows USB (HID) drivers?

    I hope to get replies. Thanks.

    Ed

  • Edward Schwartz said:
    Specifically we need to know how to use Microsoft Visual Studio.NET tools, arguably the most prevalent Windows development platform, including C# and VB, to interface to the various USB API interfaces exposed.

    Why do you ask TI to teach you Microsoft Visual Studio .NET programming using Microsoft Windows API? Better ask Microsoft to teach msp430 programming because operation system without hardware/peripherals is useless. Do you see what I mean?

  • TI has provided VS (C, C++) examples in the past. They are old and require the WDK to be installed on the PC. As Keith said, their current examples are in Java (HID example) and Python (firmware updater). I was simply asking TI if they have those examples in (ported to) C# (and maybe VB.net). I think this is a reasonable query. I believe there are TI-specific things needed to be known in order to make a C# (or VB.net) program work, or am I mistaken (which an example would clear up).

  • And I meant to mention that those old examples are no longer available on their website.

  • Ilmars said:
    Why do you ask TI to teach you Microsoft Visual Studio .NET programming using Microsoft Windows API? Better ask Microsoft to teach msp430 programming because operation system without hardware/peripherals is useless. Do you see what I mean?

    Imars, I need to remind you that Keith said in his first post: "And let me also say that as a chip vendor, we do actually see host software as our problem, for the reason you mentioned.  We try to remain aware of community options, and complement those options -- but certainly when it comes to communications buses, it takes two to talk."

    Do you see what I mean?

    Ed

  • When I looked at using the msp430f55xx USB support a couple of years ago there were many things that stopped me from using it.

    1. The license for the USB driver code was not open source friendly.
    2. The USB descriptor didn't work with linux in spite of it being written in java.
    3. The USB driver code and generated code from the tool didn't work with msp430-gcc

    I came to the conclusion that they really didn't want me to use it for any open source projects. I also came to the conclusion that they really didn't want me to use it with linux or mac or open source toolchains.   Because of these roadblocks I went looking for an alternate solution.

    In my case, I decided to go with an FTDI usb->serial chip solution.  This allowed me to get a quality host driver that is free and FTDI supports it on all 3 platforms (win32/linux/osx). That means I didn't have to write it, I don't have to support it and it just works because there are so many devices using it.  It also means I didn't have to learn anything about the Texas Instruments USB API, I didn't have to write any host drivers and I was able to save flash space because the UART code to interface with the FTDI device is a lot smaller than the USB code that would be needed to replace it. My application can be done effectively with a serial interface and writing my own HID driver really wouldn't buy me all that much.

    I applaud Texas Instrument's push to better support linux and open source. The USB driver code license is now open source friendly, the descriptor tool now works properly on linux.  They have committed to getting the code working properly with msp430-gcc some time in the future. I'll look at it again when that happens. There are other things I'd like to build that would benefit from being "true USB devices" so I'm looking forward to that day and happy that they are listening to customer feedback.

    -rick

  • Hi,

    I have recently been working with the MSP430F551x family and cam across the same problem with the PC end development. Having looked at the options for what I needed I decided that the HID interface was the best way to go, as there is no need for installing drivers, as windows will use its built in HID drivers, so that the MSP430 HIS interface gets automatically enumerated and there is no requirement for the user to take any action.

    I reviewed a number of articles and examples on the web and ultimately found a atricle on "Code Project" at

    http://www.codeproject.com/Articles/18099/A-USB-HID-Component-for-C

    I am not really a PC programmer at all as my main work is in embedded, I am certainly not the most fluent of C# programmers, as I normally use C and have had only a bit of windows experience a few years ago with Delphi, but I managed to get this code talking to the MSP430 reliably.

    The other advantage of the USB interface on the MSP430 is the fact that it is possible to program the device via the USB. There is a tool and source code included in the USB Developers package which implements this.

    I now have a working PC application that allows me to send commands from the PC and to get responses from the MSP430 via the HID interface. With the correct code in the MSP430 I can also re-program it via USB by sending the MSP430 a command to jump to the USB bootloader, and then spawning a cut down version of USB Firmware Upgrade application.

    Hope this may help as a starting point.

    Roy

  • Roy,

    Thank you for your post. I tried to download the C# project source code zip file from the Code Project website (after registering), but it may have been removed because it gives an error message when trying to download and save the zip file that the internet "site is either unavailable or cannot be found".

    Do you have it, and if so, can you attach it (use the Options tab at the top of the reply page) to this post? If not, can you attach some example code that you got working? That would be very helpful.

    We simply need to discover all HID devices matching our VID and PID, and the user would need to select the serial number of the device, just like he selects a COM port for the VCP model. Then we simply need to send character strings and/or data bytes back and forth between the PC C# program and our device.

    Thank you very much,

    Ed

  • Hi Ed,

    This is the code file that I downloaded from Code Project. 

    This can be built with VS 2008 (It will auto convert from 2005) You need to change the Startup APP to UsbApp and then yo should be able to run it. If you then set up the Device Vendor ID to 2047 and the Device Product ID to 0301 it should find the MSP430 provided it is running the HID interface app.

    Hope this helps.

    Roy

    usb_hid.zip
  • Roy,

    Thank you very much. I'll take a look at it.

    (I know this is a question for TI, but does TI assign the PID?)

    Ed

  • Edward Schwartz said:

    From the lack of activity on this forum thread, it looks like either 1) not too many people are using the USB capability of the MSP430, or 2) not too many people are interfacing to a PC.

    If 2 is true, then what hosts are they interfacing with and in what language? If 2 is false, then what programming language(s) are people using for the PC? Is anyone using Java or Python (usually used for web development, to my understanding) for desktop apps which can interface with Windows USB (HID) drivers?

    I am using MSP430F5xx USB family, and software on both sides MSP430 / PC is mine. I write mine own USB stack in assembler, and PC side for WinXP is done in Delphi / Free pascal over Win API. I need speed so for me HID is not interesting. With CDC have rate about 800 KB/s and with generic bulk about 1000 KB/s. Benchmarks can be found here...

    http://forum.43oh.com/topic/2775-msp430-usb-benchmark

    And some calculation related to last version of my USB stack...

    http://forum.43oh.com/topic/3931-native-usb-port-on-lm4f120-board/?p=37130

    I used few years ago PL2303HXD (12 Mbps 3.3V) based USB-UART bridges, but after MSP430F5xx USB experience there is no way back.

  • Hi Ed,

    You can get you own VID from usb.org and then define your own PID, or I believe that it is possible to buy PID from other suppliers who have bought a VID and then sell PIDs to others.

    There is a document at http://www.ti.com/lit/an/slaa457/slaa457.pdf that says:
     

    VIDs are assigned by the USB Implementers Forum (USB-IF), which is the standards body that overseesUSB. The vendor can choose to obtain the VID by joining the USB-IF or to license a VID without joining.At the time of writing, the former costs $4000 annually, and the latter costs $3500 for a two-year license.(See http://www.usb.org/developers/vendor/ for more information.)

    Alternatively, TI will license a PID to MSP430 customers for use with the MSP430 VID (0x2047) as part of

    its VID-sharing program. The license is free, with the basic stipulation that it only be used with TI USB
    devices. The program is intended to ensure that all MSP430 customers have easy access to a VID when
    going to market. To obtain a copy of the license, look for the link for this program at
    http://www.ti.com/msp430usb.

    Roy

  • Edward Schwartz said:

    Imars, I need to remind you that Keith said in his first post: "And let me also say that as a chip vendor, we do actually see host software as our problem, for the reason you mentioned.  We try to remain aware of community options, and complement those options -- but certainly when it comes to communications buses, it takes two to talk."

    Do you see what I mean?

    There's huge difference between programming courses on specific programming language (C# and for god's sake VB!!!) , and providing typical host side drivers and proof of concept (C++) host application for beginners to start with. If you are using C#, VB, Python, Ada or Assembler - it's ok, fine, but then you need to port C++ sample driver and application code yourself.

    Do you see what I mean?

  • Roy,

    Thank you for your information. I appreciate it. The manufacturers of USB to Serial converters/bridges do the same thing. Upon request they will provide you with a PID that you can use with their VID. But that change means you have to submit a "customized" driver package (that is, their driver binaries with your PID and strings) to Microsoft for WHQL testing to work with Windows 8 and up. (For Windows 7 it just gives a warning when the device is connected, but lets you use it.)

    I haven't looked at the example code you provided, but intend to do so shortly. Thanks again.

    Ed

  • llmars,

    No one was asking for "programming courses on specific programming language ". Where did you get that? All I was asking for was "proof of concept" (as you say) on the PC/host side as well as the device side. Their current examples are in Java and Python. They eliminated the C or C++ examples. Plus I simply wanted to know if it can be done in C# (which you probably will also look down you nose upon since it is a C-syntax version of VB.net, Microsoft's answer to Delphi).

    Do you see what I mean?

    Ed

  • zrno soli said:

    I am using MSP430F5xx USB family, and software on both sides MSP430 / PC is mine. I write mine own USB stack in assembler, and PC side for WinXP is done in Delphi / Free pascal over Win API.

    zrno,

    Wow. I give you credit for writing your own MSP430 USB stack in assembler! There are very few people who could (or would) do that.

    On the PC side, does Delphi have USB driver development tools like Microsoft's WinUSB (with examples!)? Will those work above WinXP? Also, WHQL testing will be an issue that is bypassed with HID devices.

    Ed

  • Edward Schwartz said:
    No one was asking for "programming courses on specific programming language ". Where did you get that?

    From what you said:

    Edward Schwartz said:
    Specifically we need to know how to use Microsoft Visual Studio.NET tools, arguably the most prevalent Windows development platform, including C# and VB, to interface to the various USB API interfaces exposed.

  • llmars,

    I think you misunderstood me. All I was asking for was "proof of concept" to use your phrase. That is, to simply discover the device and send data (a byte or char) back and forth between the host and the device.

    Ed

  • Edward Schwartz said:
    I think you misunderstood me. All I was asking for was "proof of concept" to use your phrase. That is, to simply discover the device and send data (a byte or char) back and forth between the host and the device.

    Happily for me I don't need any windows USB sample code, but if you say that there is no any useful, then I support you - TI shall provide samples for C++ instead of python.

  • Edward Schwartz said:

    On the PC side, does Delphi have USB driver development tools like Microsoft's WinUSB (with examples!)? Will those work above WinXP? Also, WHQL testing will be an issue that is bypassed with HID devices.

    For me C is ugly, and if I have possibility to chose, I'm coding in pascal, and Free Pascal compiler works on any platform...

    http://www.freepascal.org

    There is no WinUSB driver source available in pascal, but there is pascal interface to work with WinUSB...

    http://sourceforge.net/projects/winusb-delphi

    What is going on above XP and if my interface (on PC side) will work on Win 2020, and if user during device installation will be forced to press 10 times next button insted of one, I don't care too much. Important is to after some workaroud (if it is needed) should be possible to run application on win / linux / mac.

  • zrno,

    Thank you for your information. However, it doesn't really help with HID interface example code I was looking for. I appreciate your efforts, though.

    Ed

  • Roy,

    I got a chance to look at and try to run the Code Project HID example code. Like you said, I set the Startup App but when trying to run it it could not find UsbLibrary.dll, which is clearly in the project. Is there something (a reference, etc.) I need to change so that dll can be found?

    Also, the help file, Documentation.chm in the documentation folder, opens but apparently it's looking for the contents of the file on the internet, which apparently also has been removed. However, I can expand the tree in the left pane, but when any item is clicked the web page cannot be found. You wouldn't by any chance have a locally-saved version of this help file before the web page was removed?

    In any case, at least I can study the code. Thanks!

    Ed

  • Hi Ed,

    The help file is in the zip usb hid\documentation\documentation.chm

    Within the zip file the dll should be located at \usb_hid\usb hid\UsbApp\bin\Debug

    This is the output directory for the main exe file UsbApp.exe so it should work when you run the application.

    I have been using Visual Studio 2008 and it did automatically upgrade the project when I opened the solution.

    It also appears that when you do a build solution the new dll gets generated under \usb_hid\usb hid\UsbLibrary\bin\Debug, and then gets copied to the same directory as the output file.

    I have also tried it with Visual C# 2010 Express (on Win7). I extracted all the files from the zip. Clicked on the Sniffer.sln file, followed the upgrade wizard, Changed the startup project to UsbApp and hit the run button and it all works.

    Hope this helps

    Roy

  • Roy,

    I have the documentation.chm file, it just doesn't work because the content is linked to a webpage which is no longer present. Does it work for you?

    I'm using VS2010 and it does convert correctly. However when I run it I get an "Argument Exception Unhandled" error message, "...USB HID C#%5CUsbLibrary%5Cobj%5CDebug%5CUsbLibrary.dll' could not be found.  Ensure the path is correct." The file, UsbLibrary.dll, is definitely there. "%5C" is hex for the backslash character, so the path looks to be correct. Any idea what is going on?

    Thanks,

    Ed

     

  • Hi Ed,

    Sorry, I did not read the earlier post correctly. I have tried my chm filer and it is the same as yours, Contents and Index display but there is no info on the main page.

    I note that your path is /obj/Debug rather than /bin/Debug

    To test things the application should run provided UsbApp.exe and UsbLibrary are in the same directory. You can try this outside Visual Studio.

     Provided you can Build the complete solution with no errors, it should be possible to manually copy the dll to UsbApp\bin\Debug, and then use the Start Debugging. to debug the main application.

    When you right click on UsbApp in the Solution Explorer there is a Project Dependencies that should point to UsbLibrary. There is also an Add Reference option. This dialog should show UsbLibrary on the Projects tab.

    Right clicking on either UsbApp or UsbLibrary and selecting properties will allow you to define Build Evenst, so you may be able to use the Pre-buid on UsbApp or the Post-build on UsbLibrary to copy the dll to the output folder of UsbApp.

    Overall it works OK for me following direct extraction from the zip file, so I am not sure what else to advise.

    Regards

        Roy

  • Hi Roy,

    This is strange. The UsbLibrary.dll is in BOTH directories. And when I execute UsbApp.exe from either the \obj\Debug or \bin\Debug folders, they both work. Then I tried to add a reference to \bin\Debug\UsbLibrary.dll, it gives an error saying that "A reference to the component 'UsbLibrary' already exists in the project."! The same thing happens if I try to add it in the \obj\Debug folder.

    UsbLibrary is checked in the dependencies for the UsbApp project, and the buid order is correct (the UsbLibrary is built first). (I had prevously checked this.)

    I tried deleting the UsbLibrary from the reference, then adding it back (I tried to both folders), which it did with no error. But when I click Run, I get the same error message as I told you before, that it cannot find UsbLibrary.dll in the \obj\Debug folder. It is there, and I don't know why it is looking for it there rather than the output directory, \bin\Debug.

    Something must have broke in the conversion process. Let me know if you have any thoughts. I'll keep playing with it. Thanks.

    Ed

     

  • Roy,

    Ok, I got it working. I know I set the startup project as UsbApp, but when I double-checked it it was set to UsbLibrary for some reason. Setting it to the latter gives the error, and setting it to the former runs without the error.

    However, now that it will run there is a warning when I start debugging. A messag box appears that says, "<UsbLibrary.dll> was build either with optimizations enabled or without debug information."

    It says to change the build configuration to Debug mode, which it is. And optimizations are disabled.

    It also says, "To supress this message, disable the 'Warn if no user code on launcg' debugger option." However, I can't find such an option. Oh well... But at least it runs after closing the message box.

    Let me know if you have any further thoughts. Thanks again.


    Ed

**Attention** This is a public forum