View previous topic :: View next topic |
Author |
Message |
Fabri
Joined: 22 Aug 2005 Posts: 275
|
Does Anybody try EX_USB_SERIAL ? |
Posted: Wed Sep 07, 2005 2:11 am |
|
|
Hi,
As last posted I need information about ex_usb_serial because the PIC receve from USB but don't send back an answer.
Somebody help me on to find a problem?
Thanks, |
|
|
Guest
|
|
Posted: Thu Sep 08, 2005 2:47 pm |
|
|
i used the example and built a usb to 485 converter the programming only took 1/2 hour. if you look througth the files everything is there |
|
|
Guest
|
|
Posted: Fri Sep 09, 2005 12:02 am |
|
|
Hi,
I dont find any USB to 485 converter example in my ccs examples file.
Would you like to confirm me the name of file ?
Thanks, |
|
|
newguy
Joined: 24 Jun 2004 Posts: 1907
|
|
Posted: Fri Sep 09, 2005 7:39 am |
|
|
You don't understand. That person said that they wrote their own USB - RS485 converter based on the examples that CCS provides. |
|
|
Fabri
Joined: 22 Aug 2005 Posts: 275
|
|
Posted: Fri Sep 09, 2005 10:56 am |
|
|
When PIC receve one byte from RS232 save it on buffer and start to send data on USB.
In the follow part of routine the return in my application is "FALSE".
Quote: |
/************************************************************
/* usb_tbe(endpoint)
/*
/* Input: endpoint - endpoint to check
/* ptr - where to save data to local PIC RAM
/* max - max amount of data to receive from buffer
/*
/* Output: returns TRUE if this endpoint's IN buffer (PIC-PC) is empty and ready
/* returns FALSE if this endpoint's IN buffer is still processing the last
/* transmit or if this endpoint is invalid.
/*
/************************************************************
int8 usb_tbe(int8 endpoint) {
int8 st;
st=EP_BDxST_I(endpoint);
if (!bit_test(st,7))
return(TRUE);
return(FALSE);
}
|
endpoint=0x02
st=0x88
What are you think about? |
|
|
drolleman Guest
|
|
Posted: Sat Sep 10, 2005 10:46 pm |
|
|
the usb - 485 converter was built on the serial2 example with only 10 lines of extra code. when the usb sends a char then it puts on the uart to trasmit. and when the uart interups with a char it puts it on the usb. |
|
|
Fabri
Joined: 22 Aug 2005 Posts: 275
|
|
Posted: Sun Sep 11, 2005 12:57 am |
|
|
Hi,
I tryed example2 but the problem is the same. Pic fill the buffer but don't send it on USB. Serial2 use the same routine of Serial so I think it isn't a problem of routines but the configuration of them.
I need to solve a problem in a short time, so do you want help me ?
1) Do you change any data in usb_desc_cdc.h or other routine ?
2) Where I can get inf file to configure virtual com on PC ? Actualy I'm using a file gave me by forum user but he doesn't support me about.
CCS said:
Quote: |
....The USB CDC API that CCS provides will create a virtual UART port....
|
Thanks... |
|
|
drolleman Guest
|
|
Posted: Sun Sep 11, 2005 11:27 am |
|
|
the inf file you can get from microchip's serial example . i modified it for my use the pid/vid were chaned from their example. this will create the "virtual serial port". |
|
|
Fabri
Joined: 22 Aug 2005 Posts: 275
|
|
Posted: Sun Sep 11, 2005 12:54 pm |
|
|
Hi,
I understand you got it somewere, this isn't a help for me.
I searched it on line, I found a copy but I don't understand if the problem is in it. So I need to try an tested version now to understand if the problem is in inf file or not.
1) Would you show me the link were is it and the way to modify it?
As I posted:
Quote: |
/************************************************************
/* usb_tbe(endpoint)
/*
/* Input: endpoint - endpoint to check
/* ptr - where to save data to local PIC RAM
/* max - max amount of data to receive from buffer
/*
/* Output: returns TRUE if this endpoint's IN buffer (PIC-PC) is empty and ready
/* returns FALSE if this endpoint's IN buffer is still processing the last
/* transmit or if this endpoint is invalid.
/*
/************************************************************
int8 usb_tbe(int8 endpoint) {
int8 st;
st=EP_BDxST_I(endpoint);
if (!bit_test(st,7))
return(TRUE);
return(FALSE);
}
|
2) Does an return "FALSE" indicate an error in definition of endpoint ?
As I told you the PIC receve on USB but don't send out the buffer filled?
Thanks, |
|
|
drolleman Guest
|
|
Posted: Sun Sep 11, 2005 1:16 pm |
|
|
usb_cdc_putc(getc()); puts char on the usb up to terminial
usb_cdc_kbhit() tests for is char in recieve buffer?
value = usb_cdc_getc(); gets the charater from the usb
usbview.exe from microsoft shows connected usb devices
download the usb to serial example from microchip
the inf file needs to be changed to your settings vid/pid
the vid and the pid you will get from usbview
here is what i use
[Version]
Signature="$Windows NT$"
Class=Ports
ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318}
Provider=%MCHP%
LayoutFile=layout.inf
DriverVer=08/17/2001,5.1.2600.0
[Manufacturer]
%MFGNAME%=DeviceList
[DestinationDirs]
DefaultDestDir=12
[SourceDisksFiles]
[SourceDisksNames]
[DeviceList]
%DESCRIPTION%=DriverInstall, USB\VID_0461&PID_0033
;------------------------------------------------------------------------------
; Windows 2000/XP Sections
;------------------------------------------------------------------------------
[DriverInstall.nt]
CopyFiles=DriverCopyFiles
AddReg=DriverInstall.nt.AddReg
[DriverCopyFiles]
usbser.sys,,,0x20
[DriverInstall.nt.AddReg]
HKR,,DevLoader,,*ntkern
HKR,,NTMPDriver,,usbser.sys
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
[DriverInstall.nt.Services]
AddService=usbser, 0x00000002, DriverService
[DriverService]
DisplayName=%SERVICE%
ServiceType=1
StartType=3
ErrorControl=1
ServiceBinary=%12%\usbser.sys
;------------------------------------------------------------------------------
; String Definitions
;------------------------------------------------------------------------------
[Strings]
MCHP="Microchip Technology Inc."
MFGNAME="Microchip Technology Inc."
DESCRIPTION="Communications Port"
SERVICE="USB RS-232 Emulation Driver" |
|
|
Guest
|
|
Posted: Mon Sep 12, 2005 1:25 am |
|
|
The inf file is the same I used.
I changed PC, from notebook to desktop, and the example start to work.
On my notebook doesn't work. It's really strange.
In my example PIC send back what it receved on USB.
Anyway after a few transmission the system stop to work also with desktop. The buffer is full of characters. The routine where it stop is the same I posted "int8 usb_tbe(int8 endpoint)()".
When work st=0x40 and endpoint=0x02
When stop to work st=0xc8 and endpoint=0x02
Shall the problem is hardware ?
I'm using PIC18F2455, crystall 16 Mhz with PLL4,CPUDIV1 fuses set.
I don't use any pull-up on USB and no more components at this time.
The CCS compiler is the latest version
Windows version is W2K.
Thank for help. |
|
|
Guest
|
|
Posted: Mon Sep 12, 2005 5:26 pm |
|
|
doesn't sound like the hardware you have to empty the buffer before it overloads. |
|
|
rwyoung
Joined: 12 Nov 2003 Posts: 563 Location: Lawrence, KS USA
|
|
Posted: Mon Sep 12, 2005 5:38 pm |
|
|
Anonymous wrote: | The inf file is the same I used.
I changed PC, from notebook to desktop, and the example start to work.
On my notebook doesn't work. It's really strange. |
Use "usbview.exe" to verify that the device is completing its enumeration. Some notebooks can't supply enough power through their usb ports to even run at the 100mA limit. If this is the case, use a powered HUB between your notebook and your prototype. _________________ Rob Young
The Screw-Up Fairy may just visit you but he has crashed on my couch for the last month! |
|
|
Guest
|
|
Posted: Tue Sep 13, 2005 12:44 am |
|
|
As I can see "USBVIEW" confirm the complete enumeration:
Quote: |
Device Descriptor:
bcdUSB: 0x0200
bDeviceClass: 0x02
bDeviceSubClass: 0x00
bDeviceProtocol: 0x00
bMaxPacketSize0: 0x40 (64)
idVendor: 0x0461 (Primax Electronics)
idProduct: 0x0033
bcdDevice: 0x0100
iManufacturer: 0x01
iProduct: 0x02
iSerialNumber: 0x00
bNumConfigurations: 0x01
ConnectionStatus: DeviceConnected
Current Config Value: 0x01
Device Bus Speed: Full
Device Address: 0x02
Open Pipes: 3
Endpoint Descriptor:
bEndpointAddress: 0x81
Transfer Type: Interrupt
wMaxPacketSize: 0x0008 (8)
bInterval: 0xFA
Endpoint Descriptor:
bEndpointAddress: 0x00
Transfer Type: Control
wMaxPacketSize: 0x0507 (1287)
wInterval: 0x0202
bSyncAddress: 0x40
Endpoint Descriptor:
bEndpointAddress: 0x00
Transfer Type: Bulk
wMaxPacketSize: 0x0000 (0)
wInterval: 0x0000
bSyncAddress: 0x07
|
The PIC18F2455 receve on USB from notebook. I tryed with powered USB hub, the same of Desktop, but doesn't see the new connection and give me an error of connection on all of 4 ports. Anyway notebook see direct the new connection as see above.
Does the problem is on hardware?
I'm using PIC18F2455, crystall 16 Mhz with PLL4,CPUDIV1 fuses set.
I don't use any pull-up on USB and no more components at this time.
What is the meaning of "int8 usb_tbe(int8 endpoint)()" that doesn't permit the send out of tx buffer ?
Thanks |
|
|
drolleman Guest
|
|
Posted: Tue Sep 13, 2005 3:37 pm |
|
|
ost your code the unit is working. there is no need for pullup resistors. the only thing it must be in the code. |
|
|
|