Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

How to organize & build this Dangerous Protytpes USB demo project?

Status
Not open for further replies.

Mike - K8LH

Well-Known Member
Hi guys,

I'm trying to build the 18F2550 USB demo project described in this Dangerous Prototypes article but no luck so far. I've never worked with projects that have multiple files so I'm not sure where to place the files.

Can anyone build that sample project and tell me how to setup the files and project, please? I'd really prefer if it were someone other than the official greeters and first responders (Jon, Ian, and Nigel).

Thanks in advance.

Cheerful regards, Mike
 
Hi Burt,

I believe that particular project includes the USB files. Here's what I've done... I placed all of the project files into an "18F2550 USB Demo" folder. Then I placed the "dp_usb" folder in the "18F2550 USB Demo" folder. When I first opened the project I had to let the project manager know where two of the source files (from the "dp_usb" folder) were. Now when I try to build the project it reports that it can't find yet another file that resides in the "dp_usb" folder.

Code:
Clean: Deleting intermediary and output files.
Clean: Deleted file "C:\Users\Michael\Documents\PIC Projects\18F2550 USB Demo\PIC18F18250BB_USB_BASE.mcs".
Clean: Done.
Executing: "C:\Program Files (x86)\Microchip\mplabc18\v3.42\bin\mcc18.exe" -p=18F2550 "main.c" -fo="main.o" -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa-
C:\Users\Michael\Documents\PIC Projects\18F2550 USB Demo\main.c:9:Error [1027] unable to locate '..\dp_usb\usb_stack_globals.h'
MPLAB C18 v3.42 (evaluation)
Copyright 2000-2011 Microchip Technology Inc.
Days remaining until evaluation becomes feature limited:  60
Halting build on first failure as requested.
----------------------------------------------------------------------
Release build of project `C:\Users\Michael\Documents\PIC Projects\18F2550 USB Demo\PIC18F18250BB_USB_BASE.mcp' failed.
Language tool versions: mpasmwin.exe v5.45, mplink.exe v4.43, mcc18.exe v3.42, mplib.exe v4.43
Fri Jun 15 20:28:51 2012
----------------------------------------------------------------------
BUILD FAILED

I've attached a zip of my project folder if you or someone else would like to take a stab at it...
 
Last edited:
Mike you placed your files like this
Organization

The USB stack is organized like this.

..\[project folder]\
..\[usb stack folder]\
The goal is to completely separate the stack and the project that uses it.

Project folder
The project folder requires these files that are referenced by the usb stack:

prj_usb_config.h -- Unique to each project. For the PIC18F14K50 the cdc bulk endpoint size specified in prj_usb_config.h needs to be set to 32 as there is not enough usb ram for the cdc double buffering otherwise.
descriptors.h -- For the most it is the same file for all projects with only the strings changed. However this could need to be changed at anytime so I did it this way for forward compatibility.

And set the path like this pic it should work it did for me when I was playing with the USB stuff

View attachment 64939
 
Last edited:
Ah, that was the missing piece. I had to include a search path under <project><build options...>.

Thank you.

Now, how do I get a .LST file? It's been so long since I did anything with C18 I just can't remember what I had to do to get the project to generate a .LST file.

Regards, Mike
 
Google helped. It seems you need to check the "use alternate settings" check box within <project><build options...><Project> under the MPLINK Linker tab and then add a -i in the alternate settings text box. Now I'm getting the .LST file...
 
thats a bit of luck i am trying that project along with one other usb at the moment so will keep in touch as i am using C18 also. ive had usb working once before but it was a mare!!!
 
thats a bit of luck i am trying that project along with one other usb at the moment so will keep in touch as i am using C18 also. ive had usb working once before but it was a mare!!!

Yes, please keep in touch. I'm anxious to see how these open source USB drivers work. I'd also like to use the same board to test the Pinguino software and the UBW 'Bit Whacker' software. I just need to find a cap' for the VUSB pin (220 to 470 nF) before I get started.

Cheerful regards, Mike
 
Last edited:
i am away for a day or so but when i get back i will post what ive found out. wich version of the stack you working with?
 
which version of the stack you working with?

I haven't found the version number yet.

Just burned the program into an 18F2550 tonight and my Windows 7 Device Manager shows a "CDC Test" device listed under Other Devices after I plug into the USB port, but the device status is;

Code:
The drivers for this device are not installed. (Code 28)

To find a driver for this device, click Update Driver.

Windows can't find a device driver when I click the Update Driver button so at this point I'm wondering if I've missed a step.

More later... Mike
 
Last edited:
I always have to point windows driver.inf file

Hi Burt,

Are you referring to what's necessary to get this particular Dangerous Prototypes project running? Because that's specifically what I'm looking for...

Thanks... Mike
 
Last edited:
You can use the one from Microchip If you have it

Just add some defines for it
Here are the main USB configuration options and where to find them.

USB VID/PID
#define USB_VID (0x4d8)
#define USB_PID (0x000a) // Microchip CDC
#define USB_DEV 0x0002
Every USB device must have a unique vendor ID and product ID. Enter them at the top of prj_usb_config.h. These should be unique to your device, a custom PID for an initial production of 10,000 units is available free from Microchip for use with PIC microcontrollers. Microchip's CDC demo PID is shown here as an example, it cannot be used in a released firmware.

You can edit this one and make it work
Code:
; Windows USB CDC ACM Setup File
; Copyright (c) 2000 Microsoft Corporation
; Copyright (C) 2007 Microchip Technology Inc.

[Version] 
Signature="$Windows NT$" 
Class=Ports
ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318} 
Provider=%MFGNAME% 
LayoutFile=layout.inf
CatalogFile=%MFGFILENAME%.cat
DriverVer=11/15/2007,5.1.2600.0

[Manufacturer] 
%MFGNAME%=DeviceList, NTamd64

[DestinationDirs] 
DefaultDestDir=12 


;------------------------------------------------------------------------------
;  Windows 2000/XP/Vista-32bit Sections
;------------------------------------------------------------------------------

[DriverInstall.nt] 
include=mdmcpq.inf
CopyFiles=DriverCopyFiles.nt
AddReg=DriverInstall.nt.AddReg 

[DriverCopyFiles.nt]
usbser.sys,,,0x20

[DriverInstall.nt.AddReg] 
HKR,,DevLoader,,*ntkern 
HKR,,NTMPDriver,,%DRIVERFILENAME%.sys 
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider" 

[DriverInstall.nt.Services] 
AddService=usbser, 0x00000002, DriverService.nt

[DriverService.nt] 
DisplayName=%SERVICE% 
ServiceType=1
StartType=3
ErrorControl=1
ServiceBinary=%12%\%DRIVERFILENAME%.sys 

;------------------------------------------------------------------------------
;  Vista-64bit Sections
;------------------------------------------------------------------------------

[DriverInstall.NTamd64] 
include=mdmcpq.inf
CopyFiles=DriverCopyFiles.NTamd64
AddReg=DriverInstall.NTamd64.AddReg 

[DriverCopyFiles.NTamd64]
%DRIVERFILENAME%.sys,,,0x20

[DriverInstall.NTamd64.AddReg] 
HKR,,DevLoader,,*ntkern 
HKR,,NTMPDriver,,%DRIVERFILENAME%.sys 
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider" 

[DriverInstall.NTamd64.Services] 
AddService=usbser, 0x00000002, DriverService.NTamd64

[DriverService.NTamd64] 
DisplayName=%SERVICE% 
ServiceType=1
StartType=3
ErrorControl=1
ServiceBinary=%12%\%DRIVERFILENAME%.sys 


;------------------------------------------------------------------------------
;  Vendor and Product ID Definitions
;------------------------------------------------------------------------------
; When developing your USB device, the VID and PID used in the PC side
; application program and the firmware on the microcontroller must match.
; Modify the below line to use your VID and PID.  Use the format as shown below.
; Note: One INF file can be used for multiple devices with different VID and PIDs.
; For each supported device, append ",USB\VID_xxxx&PID_yyyy" to the end of the line.
;------------------------------------------------------------------------------
[SourceDisksFiles]
[SourceDisksNames]
[DeviceList]
%DESCRIPTION%=DriverInstall, USB\VID_04D8&PID_000A 

[DeviceList.NTamd64] 
%DESCRIPTION%=DriverInstall, USB\VID_04D8&PID_000A 


;------------------------------------------------------------------------------
;  String Definitions
;------------------------------------------------------------------------------
;Modify these strings to customize your device
;------------------------------------------------------------------------------
[Strings]
MFGFILENAME="mchpcdc"
DRIVERFILENAME ="usbser"
MFGNAME="Microchip Technology, Inc."
INSTDISK="Microchip Technology, Inc. Installation Disc"
DESCRIPTION="Communications Port"
SERVICE="USB RS-232 Emulation Driver"
 
Last edited:
Has anyone gotten this specific Dangerous Prototypes project running, and if so, can you tell me what you did to get it running?

Thank you in advance.

Cheerful regards, Mike
 
I didn't look in the file But if you don't tell it what to load it's not going to happen those defines point the OS to the CDC.inf that you need to use to find what drivers are loaded.

If you have Microchips USB Stack it has the drivers in it and will load them for you once you point where there at. You can use Dangerous Prototypes divers too but there not in the files you posted.

Now if you would of saved the file I posted make it match the defines in your code it then points where to find that when windows loads the driver you should be able to use your usb peripheral.

Have you read this http://dangerousprototypes.com/2012/06/06/open-source-usb-echo-demo-wiki/

Here where My drivers are that's used with this
View attachment 65337
 
Last edited:
Update - someone over on the Dangerous Prototypes Forum pointed me to the Windows driver files located **broken link removed** and I've been able to bring up the USB Echo Demo.

Cheerful regards, Mike
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top