MCP2210 Library Reference

I have created a dedicated page for the MCP2210 library documentations. An link to the reference can also be found on the side navigation pane. The Doxygen generated project documentation can be viewed directly here.

Drop me a line if you have any questions or run into any issues.

Be Sociable, Share!

7 Comments

  1. Colin says:

    Hi, I’ve got the MCP2210 and have been playing with it under windows but I need to use it under Ubuntu and came across you library.
    I down loaded the library using git clone git://github.com/kerrydwong/MCP2210-Library.git
    I then did g++ mcp2210.cpp and got the following errors
    I’m now well out of my depth any chance you could help me install the library and walk me though one of the examples pls
    Thanks Colin

    Error msg
    /usr/lib/gcc/i686-linux-gnu/4.6/../../../i386-linux-gnu/crt1.o: In function `_start’:
    (.text+0×18): undefined reference to `main’
    /tmp/ccFHnixl.o: In function `SendUSBCmd(hid_device_*, unsigned char*, unsigned char*)’:
    mcp2210.cpp:(.text+0×23): undefined reference to `hid_write’
    mcp2210.cpp:(.text+0×54): undefined reference to `hid_read’
    mcp2210.cpp:(.text+0x7e): undefined reference to `hid_read’
    /tmp/ccFHnixl.o: In function `EnumerateMCP2210()’:
    mcp2210.cpp:(.text+0x19b0): undefined reference to `hid_enumerate’
    /tmp/ccFHnixl.o: In function `InitMCP2210(unsigned short, unsigned short, wchar_t*)’:
    mcp2210.cpp:(.text+0x19e1): undefined reference to `hid_open’
    /tmp/ccFHnixl.o: In function `InitMCP2210(wchar_t*)’:
    mcp2210.cpp:(.text+0x1a04): undefined reference to `hid_open’
    /tmp/ccFHnixl.o: In function `InitMCP2210()’:
    mcp2210.cpp:(.text+0x1a28): undefined reference to `hid_open’
    /tmp/ccFHnixl.o: In function `ReleaseMCP2210(hid_device_*)’:
    mcp2210.cpp:(.text+0x1a3b): undefined reference to `hid_close’
    mcp2210.cpp:(.text+0x1a40): undefined reference to `hid_exit’
    collect2: ld returned 1 exit status

    • kwong says:

      Hi Colin,

      You should be able to use “make” within the project directory to compile the project (or if you installed NetBeans, you could just open up the project and compile that way).

  2. Colin says:

    Hi,
    Thanks for the pointers, I’ve ran all the make files in ./MCP2210-Library/nbproject but they all return Nothing to be done for “Make-file”
    I’ve installed Netbeans but it can’t find and projects in nbproject!!
    Could you give a step by step guide on how to install (starting with git clone to download your library), compiling the library, and ending with running one of your demos

    My background is in embedded systems where an IDE would be vi to write the c code and and a command line compiler to compile it. ;)

    I currently have a MK808 (Android TV) that I’m going to flash with Ubuntu 12.10 Quantal, conect the MCP2210 to the usb port and a Nordic nRF24LE to the MCP2210 SPI port.
    This will then allow me to use the full power of a linux system to gather real time data from a number of remote sensors.

    I’m currently stuck at step 1 trying to talk to the MCP2210 from a shell script in linux :(

    Thanks for any help
    Colin

    • kwong says:

      No problem. When you open a NetBeans project, you need to use File->Open Project and navigate to the project folder and click open.

      Alternatively, you can just create an empty C++ project and copy the source files into that project directory (in this case they would be hidapi.h/hidapi.c mcp2210.h/mcp2210.cpp). And in the IDE right click on your project and choose add existing item to add those copied files.

      Here is a screenshot of what a test project looks like (the main function is inside mcp2210test.cpp):

      Project Layout

  3. Colin says:

    Thanks, I’ve now got your MCP2210 project working, my main issue was not having the C++ module added to netbeans so could only see Java projects!

    One last question for now, is there a way to create a stand alone executable from within netbeans?

    I can run the project from inside netbeans and get the desired results and I can see all the object files in
    ./MCP2210-Library/build/Release/GNU-Linux-x86

    I can create an executable by running g++ -o ./mcp2210-exe ./*.o -ludev and then running sudo ./mcp2210-exe from the terminal
    but it would be nice to set the executable name and location from within netbeans.
    Again thanks for your help.

    • kwong says:

      Great! Glad to hear you got it to work.

      By default when you compile and build your project, an executable is generated in the following folders:

      {project name}/dist/Release/GNU-Linux-x86/
      {project name}/dist/Debug/GNU-Linux-x86/

      so you don’t have to manually create the binary and should already have the executables.

  4. Colin says:

    That works thanks, there seems to be quite a few out there that didn’t know that.

Leave a Reply