title: msp430 communication with computer
body: <p>I am trying to communicate with my MSP430F5529 LaunchPad which i just got to learn about microcontrollers and having some serious issues.</p>
  
  <p>I downloaded the MSP430 USB Developer Package with examples from Texas Instruments and am using IAR as my IDE.</p>
  
  <p>Inside the examples folder there are the same examples for different protocols it looks like: HID, CDC, Composite, MSC, and SYSBIOS.</p>
  
  <p>I decided to hit HID and inside that folder explored the DataPipe folder and went to H0_SimpleSend which seems like the first and most basic example project.</p>
  
  <p>Inside that it appears to have many folders and files for the project  such as USB_Config, USB_app, IAR, GCC, CCS_GCC, CSS, and the files system_pre_init.c, main.c, hal.h, and hal.c.</p>
  
  <p>Inside the IAR folder is a project and workspace file so i loaded the up the project hoping it was as simple as being able to build the project onto my board and run debug while using Termite to communicate with a COM port.</p>
  
  <p>When i plug in my MSP430F5529LP windows has two COM ports used, one says MSP Application UART1, and one says MSP Debug Interface and they are always consecutive COM ports (either COM11 and COM10, respectively, or COM12 and COM13, respectively.). I assume i want the UART one so i set Termite to communicated with the Application UART1 with 8 bits of data nd 1 stop bit, no parity bits.</p>
  
  <p>Then i built the program, which built fine, and loaded it onto my board.</p>
  
  <p>Stepping through the program it never seems to work. it always gets stuck on this block:</p>
  
  <pre><code>// This function begins the USB send operation, and immediately
  // returns, while the sending happens in the background.
  // Send timeStr, 9 bytes, to intf #0 (which is enumerated as a
  // COM port).  1000 retries.  (Retries will be attempted if the
  // previous send hasn't completed yet).  If the bus isn't present,
  // it simply returns and does nothing.
  if (USBCDC_sendDataInBackground(timeStr, 9, CDC0_INTFNUM, 1000))
  {
  _NOP();  // If it fails, it'll end up here.  Could happen if
  // the cable was detached after the connectionState()
  }           // check, or if somehow the retries failed
  </code></pre>
  
  <p>And sometimes during the debug session windows will say that my device has been disconected.</p>
  
  <p>What am i doing wrong?</p>
  
  <p>I am not sure what all those protocols are, what is CDC or HID and why would i use one over the other. It seems like USB communication is very complex... Energia and Arduino make it seem so easy with Begin.Serial(9600) but I want to learn the "real" way with IAR since i am beginner a career in embedded systems.</p>
  
  <p>Should i try to proceed and make this work? or is there material i need to understand first before I can attempt to get usb communication working?</p>
  
  <p>I don't want to do anything too lofty with the USB, i just want to use the ADC12 to read a signal off a resistive force sensor, and then shoot that data over to the computer.</p>
  
  <p>To see all the code im talking about you can download Texas Instruments example folder <a href="http://software-dl.ti.com/msp430/msp430_public_sw/mcu/msp430/MSP430_USB_Developers_Package/latest/exports/MSP430USBDevelopersPackage_5_00_01.zip" rel="nofollow">here</a> [<strong>Warning</strong>: Link starts download, to see page where i came from go <a href="http://software-dl.ti.com/msp430/msp430_public_sw/mcu/msp430/MSP430_USB_Developers_Package/latest/index_FDS.html" rel="nofollow">here</a>).</p>