USB DEVICE CONTROL in NUT&VOLTS by A.Enzmann

This is the place for any magazine-related discussions that don't fit in any of the column discussion boards below.
copperclad
Posts: 24
Joined: Tue May 30, 2006 11:43 am
Location: rochester ny
Contact:

USB DEVICE CONTROL in NUT&VOLTS by A.Enzmann

Post by copperclad »

hi
i am interested in messing with the PIC to USB interface discussed in the last issue of nuts & volts , i was wondering if anyone else was working on this project too , i have been messing with computers since the 80's and program Atmel chips but PIC programming is new to me as is visual C# , i have downloaded the software and i just ordered a PIC programmer , any help would be great , thanks , dana :smile:
Newz2000
Posts: 507
Joined: Wed May 18, 2005 1:01 am
Location: Des Moines, Iowa, USA
Contact:

Post by Newz2000 »

Fascinating article... I'd definately describe it as "Quick and Dirty."

I've downloaded the zip file and have to admit, it's not immediately clear to me which part goes where.

I'll have to re-read the article and see if I can get the pieces to go together. But, I have all of the parts and tools to build the project and I've been wanting to make a USB device for awhile now and it doesn't look like it gets much simpler than this.

I'll post what I find.
copperclad
Posts: 24
Joined: Tue May 30, 2006 11:43 am
Location: rochester ny
Contact:

Post by copperclad »

hi
i've read through it a few times and am beginning to get a handle on it ( knock knock ) , the files don't line up with the article quite exactly but i think it is just a few small changes made to the VC# window , my programmer arrived today and i have a pic loaded with the hex file , i just have to breadboard it and see if it runs

i have done a lot of interfaces with IBM printer ports and am interested in switching over to USB and this does look promising , dana :smile:
copperclad
Posts: 24
Joined: Tue May 30, 2006 11:43 am
Location: rochester ny
Contact:

Post by copperclad »

hi
i loaded the USBHID.hex file into my programmer and downloaded it to a 18f2455 chip , hooked up a breadboard with it and a max232 chip , and when i run HIDTEST i get nadda :???: , i toggle bit 0 button and no led lights , and with tera term pro running i have nothing to or from the serial port :sad: , there are four flags at the top of HIDTEST window and hitting them gives me " failed to find device "

i've tried it with and without the max232 and i see there is a blink.hex file and i've tried it too with the same results , running HIDTEST behaves the same whether the usb is plugged in or not , have gone over the breadboard and have it setup like in figure 1 sans the ICSP port and port B , dana


Image
Newz2000
Posts: 507
Joined: Wed May 18, 2005 1:01 am
Location: Des Moines, Iowa, USA
Contact:

Post by Newz2000 »

Does the circuit power up when you plug it into the USB? Have you checked the usual culprits, i.e., did you pull MCLR high or disable it, did you disable watchdog, disable brown out? I know my programmer likes to ignore the config options in the hex and I have to be very careful to ensure I've chosen the correct fuses.

Why don't you hook an LED and a 2.2k Resistor up to VBus so you can see if you're getting power. ([5v -1.8v]/.002a = 1.6k ohms)

Also, I don't see the diodes from the schematic on your breadboard. I notice you're not using ICSP, but I wonder if they're still necessary (or at least the VBUS one).
copperclad
Posts: 24
Joined: Tue May 30, 2006 11:43 am
Location: rochester ny
Contact:

Post by copperclad »

hi
i have a diode between VBUS and the 18f2455 , i think it is a problem with the configuration bits too , i just downloaded the pdf file for the 18f2455 data sheet and have been going over what the config bits do , my programmer uses the defult settings and i am guessing that the setup in the article is different , i was thinking the ICSP supplies power during programming and the USP supplies it when the setup is running , so i think it is one or the other , i could be wrong , i checked the power and ground from the USB before i plugged the chip in so the chip has 5 volts and ground , i didn't do anything with MCLR as it looks like it floats withour the ICSP pluged in , it is active low , so i thought it would be ok to leave it open , i will try a few config bit settings and see what i get , thanks for the help , i'll post back if i get anywhere :smile: , dana :smile:
copperclad
Posts: 24
Joined: Tue May 30, 2006 11:43 am
Location: rochester ny
Contact:

Post by copperclad »

hi
i found a comment in PICHID/main.c where he spells out the config bits , and i can see my programmer had a different setup , i havent tried it yet but it looks promising :grin: dana

here is the comment

// Define configuration registers (fuses)
#if defined(pic18f2550) || defined(pic18f2455) || defined(pic18f4550) || defined(pic18f4455)
#if CLK_48MHZ
code char at 0x300000 CONFIG1L = 0x24; // USB, /2 post (48MHz), /5 pre (20 MHz)
#else
code char at 0x300000 CONFIG1L = 0x3c; // USB, /6 post (16MHz), /5 pre (20 MHz)
// code char at 0x300000 CONFIG1L = 0x34; // USB, /4 post (24MHz), /5 pre (20 MHz)
#endif
code char at 0x300001 CONFIG1H = 0x0e; // IESO=0, FCMEN=0, HS-PLL (40MHz)
code char at 0x300002 CONFIG2L = 0x20; // Brown out off, PWRT On
code char at 0x300003 CONFIG2H = 0x00; // WDT off
code char at 0x300004 CONFIG3L = 0xff; // Unused configuration bits
code char at 0x300005 CONFIG3H = 0x01; // No MCLR, PORTB digital, CCP2 - RC1
code char at 0x300006 CONFIG4L = 0x80; // ICD off, ext off, LVP off, stk ovr off
code char at 0x300007 CONFIG4H = 0xff; // Unused configuration bits
code char at 0x300008 CONFIG5L = 0xff; // No code read protection
code char at 0x300009 CONFIG5H = 0xff; // No data/boot read protection
code char at 0x30000A CONFIG6L = 0xff; // No code write protection
code char at 0x30000B CONFIG6H = 0xff; // No data/boot/table protection
code char at 0x30000C CONFIG7L = 0xff; // No table read protection
code char at 0x30000D CONFIG7H = 0xff; // No boot table protection
copperclad
Posts: 24
Joined: Tue May 30, 2006 11:43 am
Location: rochester ny
Contact:

Post by copperclad »

hi
yep , it was the configuation bits , reset them to the figures A.Enzmann posted in the main.c file and it worked like a charm :grin: , it is a HID USB device , system recognizes it when i plug it in , and the flags at the top return reports , bit 0 controls the LED :grin: , thanks , dana :grin:
copperclad
Posts: 24
Joined: Tue May 30, 2006 11:43 am
Location: rochester ny
Contact:

Post by copperclad »

hi
i still don't have it talking to the rs-232 , i noticed it looks like a typo in the schematic posted , he shows the cap from pin 2 going to ground and in the data sheet it shows it going to power , here's a picture of both ways , dana :smile:

this is the schematic from the article
Image

this is off the data sheet
Image
dyarker
Posts: 1917
Joined: Fri Aug 22, 2003 1:01 am
Location: Izmir, Turkiye; from Rochester, NY
Contact:

Post by dyarker »

Agree, change to match the data sheet.

How's the weather in the Flower City?
Dale Y
copperclad
Posts: 24
Joined: Tue May 30, 2006 11:43 am
Location: rochester ny
Contact:

Post by copperclad »

hi Dale

thanks , yes i have it as the data sheet , and it still won't comunicate , i am looking on the web for just an rs232 app for the 18f2455 see if the problem is in the firmware

we are having a mild winter and dry ( for rochester spring ) the lilacs were about 10 days early , you are a long way from home , thanks again , dana
Engineer1138
Posts: 458
Joined: Thu Feb 05, 2004 1:01 am
Location: Minneapolis, MN
Contact:

Post by Engineer1138 »

This is a bit off topic, but can I ask what you're doing with the I/O? That is, what are you controlling?

Reason I ask is that I have a few left over RS232 power driver output boards I built for a client and I have been trying to figure out a good use for them so I can configure them for a specific task and sell them off. I know what my guy was doing with them, but I don't know what anyone else would.

Is this just for experimenting, or do you have a specific use in mind?
Newz2000
Posts: 507
Joined: Wed May 18, 2005 1:01 am
Location: Des Moines, Iowa, USA
Contact:

Post by Newz2000 »

Well, I don't know what others are going to do, but I, for one, plan to hook a big red button to mine. When you push the red button, the computer screen in Larry's office (the office next to mine) will turn off. Larry will then curse very loud.

I'll call it the "make Larry's face red button."

I can't wait until I get my programmer working. :grin:
zotdoc
Posts: 177
Joined: Tue Jun 17, 2003 1:01 am
Location: Douglas, Georgia
Contact:

Post by zotdoc »

Velleman has a kit that interfaces with a usb port and some software to go with it. I put one together and it works pretty well.
copperclad
Posts: 24
Joined: Tue May 30, 2006 11:43 am
Location: rochester ny
Contact:

Post by copperclad »

hi
i have been interfacing with the parallel port for years and now that USB is the standard port i want to be able to use it instead
i have a plasma CNC cutter i built and a 3D room scanner and various micro controller projects and have used the EPP port on my system , so for instance with my plasma cutter i just have a dedicated 486 laptop to run it , pop a disk with G-code into it and off you go , for me the epp port has been the down and dirty fast way to control just about anything , but i see the end comming and would really like to be able to replace it with a USB setup
with the pic 18f2455 and this software it looks like i can setup about the equivalent of a epp port , 8 bits I/O with 7bits of control , and of coarse there are a bunch more features it will do , but with a setup of 8 I/O and 7 control bits i would have a stock chip i could just drop into a breadboard to give me simple USB control and not have to spend a bunch of time setting up an interface for each project , dana :smile:
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Amazon [Bot] and 42 guests