Post your code. Maybe there is something else.
Post your code. Maybe there is something else.
Dave
Always wear safety glasses while programming.
Here it is:
Code:' USB sample program for PIC18F4550 CDC serial port emulation ' Requires PBP 2.60 or later ' Compilation of this program requires that specific support files be ' available in the source directory. For detailed information, see ' the file PBP\USB18\USB.TXT. Include "cdc_desc.bas" ' Include the HID descriptors Define OSC 48 buffer Var Byte[16] cnt Var Byte OSCTUNE.6 = 1 ' Enable PLL for 18F87J50 family Pause 10 USBInit ' Get USB going ' Wait for USB input idleloop: USBService ' Must service USB regularly cnt = 16 ' Specify input buffer size USBIn 3, buffer, cnt, idleloop ' Message received buffer[0] = "H" buffer[1] = "e" buffer[2] = "l" buffer[3] = "l" buffer[4] = "o" buffer[5] = " " buffer[6] = "W" buffer[7] = "o" buffer[8] = "r" buffer[9] = "l" buffer[10] = "d" buffer[11] = 13 buffer[12] = 10 buffer[13] = 0 outloop: USBService ' Must service USB regularly USBOut 3, buffer, 14, outloop Goto idleloop ' Wait for next buffer
-Bert
The glass is not half full or half empty, Its twice as big as needed for the job!
http://foamcasualty.com/ - Warbird R/C scratch building with foam!
revisied code with a speed test added
the results of the speed test: pin toggles at 3Mhz. To be clear, there is .3333uS between toggles. Now I don't feel like that is correct. lets see: 48Mhz=12Mips. So thats .08uS per instruction? So we are executing 4 instructions? Hmm, that doesn't sound right.Code:' USB sample program for PIC18F4550 CDC serial port emulation ' Requires PBP 2.60 or later ' Compilation of this program requires that specific support files be ' available in the source directory. For detailed information, see ' the file PBP\USB18\USB.TXT. Include "cdc_desc.bas" ' Include the HID descriptors Define OSC 48 trise.3 = 0 buffer Var Byte[16] cnt Var Byte OSCTUNE.6 = 1 ' Enable PLL for 18F87J50 family Pause 10 '***************************************** '--------------Speed test speedtest: toggle porte.3 goto speedtest '--------------End test '****************************************** USBInit ' Get USB going ' Wait for USB input idleloop: USBService ' Must service USB regularly cnt = 16 ' Specify input buffer size USBIn 3, buffer, cnt, idleloop ' Message received buffer[0] = "H" buffer[1] = "e" buffer[2] = "l" buffer[3] = "l" buffer[4] = "o" buffer[5] = " " buffer[6] = "W" buffer[7] = "o" buffer[8] = "r" buffer[9] = "l" buffer[10] = "d" buffer[11] = 13 buffer[12] = 10 buffer[13] = 0 outloop: USBService ' Must service USB regularly USBOut 3, buffer, 14, outloop Goto idleloop ' Wait for next buffer
Ok, I will see if someone else can think better then I this evening
-Bert
The glass is not half full or half empty, Its twice as big as needed for the job!
http://foamcasualty.com/ - Warbird R/C scratch building with foam!
Might be a problem with the buffer size compared to the data being sent. They are different sizes.
Here is an example:
As for your speed test... my brain is ready to fuss out for the day also...Code:Buffer VAR BYTE[16] Cnt VAR BYTE B0 VAR BYTE B1 VAR BYTE ADCON1 = 15 ' Set all I/Os to Digital CMCON = 7 ' Disable Comparators Cnt = 16 for b0 = 0 to 15 lookup b0,["USB CONNECTED!",10,13],B1 BUFFER(B0) = B1 NEXT B0 USBINIT ' Main Program Loop Loop: USBService ' Must service USB regularly USBOut 3, Buffer, Cnt, loop goto loop
Dave
Always wear safety glasses while programming.
Hmmm.. I would think OS should still see it as a new device even if thats the case.
Well I am studing the schematic now, I am not sure I have the "CAP" on Vusb. But I can say this thing works with a USB bootloader no problem. Now does that mean winblows will see it? IDK
I see there are pullups on the data lines. And according to the datasheet, The internal pullups must be disabled. I have been looking at the include file, and I think there are being set.
I am just about to give up on this "pre-configured" answer. After all, it may NOT be the answer for this chip anyway. I will start looking at your solution to see if I can make that work.
-Bert
The glass is not half full or half empty, Its twice as big as needed for the job!
http://foamcasualty.com/ - Warbird R/C scratch building with foam!
The VUSB cap is a must.
I have not used the chip you are using. do you have a 4550 or 2550?
Dave
Always wear safety glasses while programming.
In case any one wants to look, here is the schematic and "manual" seeing how I am having trouble with anything tonight, (the pullups do not exist on the board), Maybe I should give this one a break for a bit.
No, I don't have any of those chips.I was hoping to be able to get this to work on a premade board. Seems like it should be possible. One thing I don't like, with the ready made code provided by melab, It takes more time to chase down what is ( or is not) going on.
Does it make sense that if I can use microchips USB bootloader, the hardware side of things are ok?
-Bert
The glass is not half full or half empty, Its twice as big as needed for the job!
http://foamcasualty.com/ - Warbird R/C scratch building with foam!
Bookmarks