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.

CSL_USB_CdcExample has issues with driver and code

Setup: C5515 eZdsp USB stick v2, CCS v4.1.3.00034, C55XCSL-LOWPOWER-3.01.00.05.

I finally got the CSL_USB_CdcExample working, so I'm posting what I had to change.

First of all, the driver file doesn't have a 64-bit section.  I ended up with the attached INF file that installed successfully.  (To be honest, I made a few tweaks after it installed successfully; hopefully I didn't break anything!)

; C5515_CDC_ACM.inf
;
; INF file for C5515_USB_CDC_ACM example
;
; 1) Replace VID/PID to your own in [MYCORP] section
;      VID_vvvv&PID_pppp
;          vvvv, pppp: four digit hex number of VID and PID, respectively
;
; 2) Replace 'MYCORP' to your own abbreviated one (without space)
;      ex Silicon Laboratories -> SILABS
;     - Replace all MYCORP in this inf file
;
; 3) Replace 'MYDEV000' to your device model number (without space)
;      ex C8051F320 Development kit -> F320DK
;     - Replace all MYDEV000 in this inf file
;
; 4) Edit the strings in [Strings] section
;

[Version]
Signature="$Windows NT$"
Class=Ports
ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318}

Provider=%TICORP%
;LayoutFile=layout.inf
DriverVer=02/26/2014,1.00.00.001

[Manufacturer]
%TICORP%=TICORP, NTamd64

[SourceDisksFiles]
[SourceDisksNames]

[DestinationDirs]
FakeModemCopyFileSection = 12
DefaultDestDir = 12


;------------------------------------------------------------------------------
;  Windows 2000/XP/Vista-32bit Sections (original INF from TI contents)
;------------------------------------------------------------------------------
[TICORP]
%C5515% = C5515,USB\VID_0451&PID_9010

[C5515.NT]
include=mdmcpq.inf
CopyFiles=FakeModemCopyFileSection
AddReg=C5515.NT.AddReg

[C5515.NT.Services]
AddService = usbser, 0x00000002, Service_Inst

[Service_Inst]
DisplayName = %Serial.SvcDesc%
ServiceType = 1   ; SERVICE_KERNEL_DRIVER
StartType = 3     ; SERVICE_DEMAND_START
ErrorControl = 1  ; SERVICE_ERROR_NORMAL
ServiceBinary = %12%\usbser.sys
LoadOrderGroup = Base

[C5515.NT.AddReg]
HKR,,NTMPDriver,,*ntkern
HKR,,NTMPDriver,,usbser.sys
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
HKR,,PortSubClass,1,01

[Strings]
TICORP = "Texas Instruments Inc."           ; Your company name
C5515 = "C5515 CDC ACM device"              ; Device description
Serial.SvcDesc = "C5515 CDC ACM Driver"     ; Device driver description


;------------------------------------------------------------------------------
;  Vista-64bit Sections
; adapted from <http://www.microchip.com/forums/m666896.aspx>
;------------------------------------------------------------------------------
[TICORP.NTamd64]
%C5515% = C5515,USB\VID_0451&PID_9010

[C5515.NTamd64]
include=mdmcpq.inf
CopyFiles=FakeModemCopyFileSection   ;CopyFiles=DriverCopyFiles.NTamd64
AddReg=C5515.NTamd64.AddReg

[C5515.NTamd64.Services]
AddService=usbser, 0x00000002, Service_Inst.NTamd64

[Service_Inst.NTamd64]
DisplayName = %Serial.SvcDesc%
ServiceType = 1   ; SERVICE_KERNEL_DRIVER
StartType = 3     ; SERVICE_DEMAND_START
ErrorControl = 1  ; SERVICE_ERROR_NORMAL
ServiceBinary=%12%\usbser.sys
LoadOrderGroup = Base
 
[C5515.NTamd64.AddReg]
HKR,,DevLoader,,*ntkern
HKR,,NTMPDriver,,usbser.sys
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
HKR,,PortSubClass,1,01

;[DriverCopyFiles.NTamd64]
;usbser.sys,,,0x20

(Remove .txt extension of attached file to get .INF file.)

Also, the example code is missing the RX work buffer.  The result is reading from and writing to undefined memory.  The symptom was that sending data from the DSP (peripheral) to PC (host) worked fine, but the data transmitted from PC to DSP was clobbered.  I got all the interrupts, buffer sizes were right, etc.  Just the contents were bad.

--- csl_usb_cdc_example.c	2012-12-20 09:55:30.000000000 -0700
+++ csl_usb_cdc_example_fixed.c	2014-02-27 15:15:42.671625300 -0700
@@ -132,6 +132,7 @@
 Uint16	usbDataBufferRx[CSL_USB_CDC_DATA_BUF_SIZE];
 Uint16	usbDataBufferTx[CSL_USB_CDC_DATA_BUF_SIZE];
 Uint16	usbDataBufferTxWork[CSL_USB_CDC_DATA_BUF_SIZE/2];
+Uint16	usbDataBufferRxWork[CSL_USB_CDC_DATA_BUF_SIZE/2];
 Uint16	bytesRem;
 Uint16	devAddr;
 Uint16	saveIndex;
@@ -326,6 +327,7 @@
 	memset((void*)usbDataBufferRx, 0x00, sizeof(usbDataBufferRx));
 	memset((void*)usbDataBufferTx, 0x00, sizeof(usbDataBufferTx));
 	memset((void*)usbDataBufferTxWork, 0x00, sizeof(usbDataBufferTxWork));
+	memset((void*)usbDataBufferRxWork, 0x00, sizeof(usbDataBufferRxWork));
 
 	/* Initializing the pointer to the CDC Handle */
 	CDC_AppHandle.pCdcObj = (void*)&cdcClassStruct;
@@ -353,6 +355,8 @@
 	CDC_AppHandle.txStartIdx = CDC_AppHandle.txEndIdx = 0;
 	CDC_AppHandle.txWorkBufPtr   = usbDataBufferTxWork;
 	CDC_AppHandle.txWorkBufIdx = 0;
+	CDC_AppHandle.rxWorkBufPtr   = usbDataBufferRxWork;
+	CDC_AppHandle.rxWorkBufIdx = 0;
 	CDC_AppHandle.pId    = pId;
 	CDC_AppHandle.vId    = vId;
 

With these changes the CDC connection seems to work great!  My only regret is the lost days it took me to fix the problems with the example!

- Ryan