OpenQNX :: The QNX Community Portal

Oct 12, 2008 - 05:41 PM
Google
  Web openqnx.com   
     Create an account Home · Submit News · QNX Forums · QNX Download · Search   
_
Main Menu
Who's Online
There are 18 unlogged users and 0 registered users online.

You can log-in or register for a user account here.

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
Fred P.
Post subject: [USB DDK] usbd_urb_status == EBUSY forever  PostPosted: Jul 06, 2004 - 11:36 PM
Guest





Hi everyone,

I'm writing a USB device driver for an FTDI USB->Serial chip:
[0x6001,0x0403],
http://www.ftdichip.com/ based on the USB DDK Printer driver example,
since it has bulk in/out and some control setup.

I'm able to make the test LED going on and off
to the serial test board plugged to the FTDI in bitbang mode,
but usbd_urb_status == EBUSY and never return.

If I skip the bulk_wait part, I'm able to send data packets of 64 bytes to
the FTDI target,
but I'm unable to read anything.

bulk_cbf() is called only when I press CTRL-C, if I leave the bulk_wait().

Basically, I send a 5 bytes packet with the following decimal values
[18,27,68,18,69]
and I should retrieve a 2 bytes packet with the following decimal values
[71,13]
from a "pure serial port" point of view.

For instance, I'm getting the following decimal values in my usbd_alloc(64)
read_data:
[33,96,144, 71,141,0...] or [0,0,0, 0,0,0...] garbage
instead of [71,13,0, 0,0,0...]

# io-usb -duhci
# usb -vvv
USB 0 (UHCI) v1.10, v1.01 DDK, v1.01 HCD
Control, Interrupt, Bulk, Isoch, Low speed

Device Address : 1
Upstream Host Controller : 0
Upstream Device Address : 0
Upstream Port : 0
Upstream Port Speed : Full
Vendor : 0x0403
Product : 0x6001
Device Release : r2.00
USB Spec Release : v1.10
Serial Number : N/A
Class : 0x00 (Independant per interface)
Max PacketSize0 : 8
Languages : No string descriptors
Current Frame : 929 (1024 bytes)
Configurations : 1
Configuration : 1
Attributes : 0x80 (Bus-powered)
Max Power : 90 mA
Interfaces : 1
Interface : 0 / 0
Class : 0xff (Vendor-specific)
Subclass : 0xff
Protocol : 0xff
Endpoints : Control + 2
Endpoint : 0
Attributes : Control
Max Packet Size: 8
Endpoint : 1
Attributes : Bulk/IN
Max Packet Size: 64
Endpoint : 2
Attributes : Bulk/OUT
Max Packet Size: 64

=================

program with fprintf log file for bulk_wait() enabled code:

inserted [8055f20][8055f8c]
{
devno 1 inserted
Read #0 = NULL
{
bLength[12],bDescriptorType[1],bcdUSB[110],bDeviceClass[0],
bDeviceSubClass[0],bDeviceProtocol[0],bMaxPacketSize0[8],
idVendor[403],idProduct[6001],bcdDevice[200],iManufacturer[1],
iProduct[2],iSerialNumber[3],bNumConfigurations[1]
}
Found CONTROL LINE - EndPoint#[0] - Max Packet Size [8]
Control pipe opened
Found BULK - EndPoint#[1]
BULK IN - Max Packet Size [64]
Input pipe opened
Found BULK - EndPoint#[2]
BULK OUT - Max Packet Size [64]
Output pipe opened
parse successful
Do something...
Initializing FTDI structure
Opening a FTDI device
usb_control_msg: setup...
urb[805a014], flags[2], request[0], request_type[40],value[0], index[0],
size[0], timeout[5000]
BYTES[0]=NULL or size[0]=0
CTRL_STATUS1[0]CTRL_STATUS2[0]usb_control_msg: setup...
urb[805a014], flags[2], request[3], request_type[40],value[4138], index[0],
size[0], timeout[5000]
BYTES[0]=NULL or size[0]=0
CTRL_STATUS1[0]CTRL_STATUS2[0]ftdi open succeeded: 0
enabling bitbang mode
usb_control_msg: setup...
urb[805a014], flags[2], request[b], request_type[40],value[1ff], index[0],
size[0], timeout[5000]
BYTES[0]=NULL or size[0]=0
CTRL_STATUS1[0]CTRL_STATUS2[0]sleep 1 seconds...
disabling = Red Light
usb_bulk_write: bulk_io...
usb_bulk_io
usb_bulk_io: usbd_setup_bulk
usb_bulk_io: BEFORE BUFFER[^R^ESCD^RE] LENGTH[5]
{[0x12][18][_],[0x1b][27][_],[0x44][68][D],[0x12][18][_],[0x45][69][E],[0x0]
[0][_],[0x0][0][_],[0x0][0][_],}
usb_bulk_io: usbd_io
usb_bulk_io: AFTER BUFFER[^R^ESCD^RE] LENGTH[5]
{[0x12][18][_],[0x1b][27][_],[0x44][68][D],[0x12][18][_],[0x45][69][E],[0x0]
[0][_],[0x0][0][_],[0x0][0][_],}
usb_bulk_io: usbd_io: if(status[0]) bulk_wait...
usb_bulk_wait
usb_bulk_wait: Inside sleepon_lock()
usb_bulk_wait: Inside while... sleepon_wait()
usb_bulk_wait: urb_status[10],status[0],len[0],EBUSY[10]
]
{[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x
0][0][_],[0x0][0][_],}
usb_bulk_io: usbd_io
usb_bulk_io: AFTER BUFFER[] LENGTH[5]
{[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x
0][0][_],[0x0][0][_],}
usb_bulk_io: usbd_io: if(status[0]) bulk_wait...
usb_bulk_wait
usb_bulk_wait: Checking status[0].
enabling = Green Light
usb_bulk_write: bulk_io...
usb_bulk_io
usb_bulk_io: usbd_setup_bulk
usb_bulk_io: BEFORE BUFFER[^R^ESCE^RE] LENGTH[5]
{[0x12][18][_],[0x1b][27][_],[0x45][69][E],[0x12][18][_],[0x45][69][E],[0x0]
[0][_],[0x0][0][_],[0x0][0][_],}
usb_bulk_io: usbd_io
usb_bulk_io: AFTER BUFFER[^R^ESCE^RE] LENGTH[5]
{[0x12][18][_],[0x1b][27][_],[0x45][69][E],[0x12][18][_],[0x45][69][E],[0x0]
[0][_],[0x0][0][_],[0x0][0][_],}
usb_bulk_io: usbd_io: if(status[0]) bulk_wait...
usb_bulk_wait
usb_bulk_wait: Checking status[0].
usb_bulk_read: bulk_io...
usb_bulk_io
usb_bulk_io: usbd_setup_bulk
usb_bulk_io: BEFORE BUFFER[!] LENGTH[2]
{[0x21][33][!],[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x0][0][_],[
0x0][0][_],[0x0][0][_],}
usb_bulk_io: usbd_io
usb_bulk_io: AFTER BUFFER[!] LENGTH[2]
{[0x21][33][!],[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x0][0][_],[
0x0][0][_],[0x0][0][_],}
usb_bulk_io: usbd_io: if(status[0]) bulk_wait...
usb_bulk_wait
usb_bulk_wait: Checking status[0].
disabling = Red Light
usb_bulk_write: bulk_io...
usb_bulk_io
usb_bulk_io: usbd_setup_bulk
usb_bulk_io: BEFORE BUFFER[^R^ESCD^RE] LENGTH[5]
{[0x12][18][_],[0x1b][27][_],[0x44][68][D],[0x12][18][_],[0x45][69][E],[0x0]
[0][_],[0x0][0][_],[0x0][0][_],}
usb_bulk_io: usbd_io
usb_bulk_io: AFTER BUFFER[^R^ESCD^RE] LENGTH[5]
{[0x12][18][_],[0x1b][27][_],[0x44][68][D],[0x12][18][_],[0x45][69][E],[0x0]
[0][_],[0x0][0][_],[0x0][0][_],}
usb_bulk_io: usbd_io: if(status[0]) bulk_wait...
usb_bulk_wait
usb_bulk_wait: Checking status[0].
usb_bulk_read: bulk_io...
usb_bulk_io
usb_bulk_io: usbd_setup_bulk
usb_bulk_io: BEFORE BUFFER[!] LENGTH[5]
{[0x21][33][!],[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x0][0][_],[
0x0][0][_],[0x0][0][_],}
usb_bulk_io: usbd_io
usb_bulk_io: AFTER BUFFER[!] LENGTH[5]
{[0x21][33][!],[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x0][0][_],[
0x0][0][_],[0x0][0][_],}
usb_bulk_io: usbd_io: if(status[0]) bulk_wait...
usb_bulk_wait
usb_bulk_wait: Checking status[0].
enabling = Green Light
usb_bulk_write: bulk_io...
usb_bulk_io
usb_bulk_io: usbd_setup_bulk
usb_bulk_io: BEFORE BUFFER[^R^ESCE^RE] LENGTH[5]
{[0x12][18][_],[0x1b][27][_],[0x45][69][E],[0x12][18][_],[0x45][69][E],[0x0]
[0][_],[0x0][0][_],[0x0][0][_],}
usb_bulk_io: usbd_io
usb_bulk_io: AFTER BUFFER[^R^ESCE^RE] LENGTH[5]
{[0x12][18][_],[0x1b][27][_],[0x45][69][E],[0x12][18][_],[0x45][69][E],[0x0]
[0][_],[0x0][0][_],[0x0][0][_],}
usb_bulk_io: usbd_io: if(status[0]) bulk_wait...
usb_bulk_wait
usb_bulk_wait: Checking status[0].
usb_bulk_read: bulk_io...
usb_bulk_io
usb_bulk_io: usbd_setup_bulk
usb_bulk_io: BEFORE BUFFER[!] LENGTH[2]
{[0x21][33][!],[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x0][0][_],[
0x0][0][_],[0x0][0][_],}
usb_bulk_io: usbd_io
usb_bulk_io: AFTER BUFFER[!] LENGTH[2]
{[0x21][33][!],[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x0][0][_],[
0x0][0][_],[0x0][0][_],}
usb_bulk_io: usbd_io: if(status[0]) bulk_wait...
usb_bulk_wait
usb_bulk_wait: Checking status[0].
sleep 1 seconds...

disabling bitbang mode
usb_control_msg: setup...
urb[805a014], flags[2], request[b], request_type[40],value[0], index[0],
size[0], timeout[5000]
BYTES[0]=NULL or size[0]=0
CTRL_STATUS1[0]CTRL_STATUS2[0]insertion: closed.

=================

program with fprintf log file for bulk_wait() disabled code:

inserted [8055f20][8055f8c]
{
devno 1 inserted
Read #0 = NULL
{
bLength[12],bDescriptorType[1],bcdUSB[110],bDeviceClass[0],
bDeviceSubClass[0],bDeviceProtocol[0],bMaxPacketSize0[8],
idVendor[403],idProduct[6001],bcdDevice[200],iManufacturer[1],
iProduct[2],iSerialNumber[3],bNumConfigurations[1]
}
Found CONTROL LINE - EndPoint#[0] - Max Packet Size [8]
Control pipe opened
Found BULK - EndPoint#[1]
BULK IN - Max Packet Size [64]
Input pipe opened
Found BULK - EndPoint#[2]
BULK OUT - Max Packet Size [64]
Output pipe opened
parse successful
Do something...
Initializing FTDI structure
Opening a FTDI device
usb_control_msg: setup...
urb[805a014], flags[2], request[0], request_type[40],value[0], index[0],
size[0], timeout[5000]
BYTES[0]=NULL or size[0]=0
CTRL_STATUS1[0]CTRL_STATUS2[0]usb_control_msg: setup...
urb[805a014], flags[2], request[3], request_type[40],value[4138], index[0],
size[0], timeout[5000]
BYTES[0]=NULL or size[0]=0
CTRL_STATUS1[0]CTRL_STATUS2[0]ftdi open succeeded: 0
enabling bitbang mode
usb_control_msg: setup...
urb[805a014], flags[2], request[b], request_type[40],value[1ff], index[0],
size[0], timeout[5000]
BYTES[0]=NULL or size[0]=0
CTRL_STATUS1[0]CTRL_STATUS2[0]sleep 1 seconds...
disabling = Red Light
usb_bulk_write: bulk_io...
usb_bulk_io
usb_bulk_io: usbd_setup_bulk
usb_bulk_io: BEFORE BUFFER[^R^ESCD^RE] LENGTH[5]
{[0x12][18][_],[0x1b][27][_],[0x44][68][D],[0x12][18][_],[0x45][69][E],[0x0]
[0][_],[0x0][0][_],[0x0][0][_],}
usb_bulk_io: usbd_io
usb_bulk_io: AFTER BUFFER[^R^ESCD^RE] LENGTH[5]
{[0x12][18][_],[0x1b][27][_],[0x44][68][D],[0x12][18][_],[0x45][69][E],[0x0]
[0][_],[0x0][0][_],[0x0][0][_],}
usb_bulk_io: usbd_io: if(status[0]) bulk_wait...
usb_bulk_wait
usb_bulk_wait: Checking status[0].
usb_bulk_read: bulk_io...
usb_bulk_io
usb_bulk_io: usbd_setup_bulk
usb_bulk_io: BEFORE BUFFER[] LENGTH[5]
{[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x
0][0][_],[0x0][0][_],}
usb_bulk_io: usbd_io
usb_bulk_io: AFTER BUFFER[] LENGTH[5]
{[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x
0][0][_],[0x0][0][_],}
usb_bulk_io: usbd_io: if(status[0]) bulk_wait...
usb_bulk_wait
usb_bulk_wait: Checking status[0].
enabling = Green Light
usb_bulk_write: bulk_io...
usb_bulk_io
usb_bulk_io: usbd_setup_bulk
usb_bulk_io: BEFORE BUFFER[^R^ESCE^RE] LENGTH[5]
{[0x12][18][_],[0x1b][27][_],[0x45][69][E],[0x12][18][_],[0x45][69][E],[0x0]
[0][_],[0x0][0][_],[0x0][0][_],}
usb_bulk_io: usbd_io
usb_bulk_io: AFTER BUFFER[^R^ESCE^RE] LENGTH[5]
{[0x12][18][_],[0x1b][27][_],[0x45][69][E],[0x12][18][_],[0x45][69][E],[0x0]
[0][_],[0x0][0][_],[0x0][0][_],}
usb_bulk_io: usbd_io: if(status[0]) bulk_wait...
usb_bulk_wait
usb_bulk_wait: Checking status[0].
usb_bulk_read: bulk_io...
usb_bulk_io
usb_bulk_io: usbd_setup_bulk
usb_bulk_io: BEFORE BUFFER[!] LENGTH[2]
{[0x21][33][!],[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x0][0][_],[
0x0][0][_],[0x0][0][_],}
usb_bulk_io: usbd_io
usb_bulk_io: AFTER BUFFER[!] LENGTH[2]
{[0x21][33][!],[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x0][0][_],[
0x0][0][_],[0x0][0][_],}
usb_bulk_io: usbd_io: if(status[0]) bulk_wait...
usb_bulk_wait
usb_bulk_wait: Checking status[0].
disabling = Red Light
usb_bulk_write: bulk_io...
usb_bulk_io
usb_bulk_io: usbd_setup_bulk
usb_bulk_io: BEFORE BUFFER[^R^ESCD^RE] LENGTH[5]
{[0x12][18][_],[0x1b][27][_],[0x44][68][D],[0x12][18][_],[0x45][69][E],[0x0]
[0][_],[0x0][0][_],[0x0][0][_],}
usb_bulk_io: usbd_io
usb_bulk_io: AFTER BUFFER[^R^ESCD^RE] LENGTH[5]
{[0x12][18][_],[0x1b][27][_],[0x44][68][D],[0x12][18][_],[0x45][69][E],[0x0]
[0][_],[0x0][0][_],[0x0][0][_],}
usb_bulk_io: usbd_io: if(status[0]) bulk_wait...
usb_bulk_wait
usb_bulk_wait: Checking status[0].
usb_bulk_read: bulk_io...
usb_bulk_io
usb_bulk_io: usbd_setup_bulk
usb_bulk_io: BEFORE BUFFER[!] LENGTH[5]
{[0x21][33][!],[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x0][0][_],[
0x0][0][_],[0x0][0][_],}
usb_bulk_io: usbd_io
usb_bulk_io: AFTER BUFFER[!] LENGTH[5]
{[0x21][33][!],[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x0][0][_],[
0x0][0][_],[0x0][0][_],}
usb_bulk_io: usbd_io: if(status[0]) bulk_wait...
usb_bulk_wait
usb_bulk_wait: Checking status[0].
enabling = Green Light
usb_bulk_write: bulk_io...
usb_bulk_io
usb_bulk_io: usbd_setup_bulk
usb_bulk_io: BEFORE BUFFER[^R^ESCE^RE] LENGTH[5]
{[0x12][18][_],[0x1b][27][_],[0x45][69][E],[0x12][18][_],[0x45][69][E],[0x0]
[0][_],[0x0][0][_],[0x0][0][_],}
usb_bulk_io: usbd_io
usb_bulk_io: AFTER BUFFER[^R^ESCE^RE] LENGTH[5]
{[0x12][18][_],[0x1b][27][_],[0x45][69][E],[0x12][18][_],[0x45][69][E],[0x0]
[0][_],[0x0][0][_],[0x0][0][_],}
usb_bulk_io: usbd_io: if(status[0]) bulk_wait...
usb_bulk_wait
usb_bulk_wait: Checking status[0].
usb_bulk_read: bulk_io...
usb_bulk_io
usb_bulk_io: usbd_setup_bulk
usb_bulk_io: BEFORE BUFFER[!] LENGTH[2]
{[0x21][33][!],[0x0][0][_],[0x90][144][É],[0x0][0][_],[0x0][0][_],[0x0][0][_
],[0x0][0][_],[0x0][0][_],}
usb_bulk_io: usbd_io
usb_bulk_io: AFTER BUFFER[!] LENGTH[2]
{[0x21][33][!],[0x0][0][_],[0x90][144][É],[0x0][0][_],[0x0][0][_],[0x0][0][_
],[0x0][0][_],[0x0][0][_],}
usb_bulk_io: usbd_io: if(status[0]) bulk_wait...
usb_bulk_wait
usb_bulk_wait: Checking status[0].
sleep 1 seconds...

disabling bitbang mode
usb_control_msg: setup...
urb[805a014], flags[2], request[b], request_type[40],value[0], index[0],
size[0], timeout[5000]
BYTES[0]=NULL or size[0]=0
CTRL_STATUS1[0]CTRL_STATUS2[0]insertion: closed.

=========================

Anyone has any idea of what the problem could be ?!

Sincerely yours,
Fred.
 
   
Reply with quote Back to top
Fred P.
Post subject: Re: [USB DDK] usbd_urb_status == EBUSY forever  PostPosted: Jul 06, 2004 - 11:56 PM
Guest





I also tried with 3 different urbs instead of just 1 urb:
urb_ctrl, urb_in, urb_out
for each endpoint, still gives EBUSY forever.

Based on the suggestion made by "Henry VanDyke"
in "Serial-USB driver help Belikn F5U103".

Sincerely,
Fred.


Quote:
Hi everyone,

I'm writing a USB device driver for an FTDI USB->Serial chip:
[0x6001,0x0403],
http://www.ftdichip.com/ based on the USB DDK Printer driver example,
since it has bulk in/out and some control setup.

I'm able to make the test LED going on and off
to the serial test board plugged to the FTDI in bitbang mode,
but usbd_urb_status == EBUSY and never return.

If I skip the bulk_wait part, I'm able to send data packets of 64 bytes to
the FTDI target,
but I'm unable to read anything.

bulk_cbf() is called only when I press CTRL-C, if I leave the bulk_wait().

Basically, I send a 5 bytes packet with the following decimal values
[18,27,68,18,69]
and I should retrieve a 2 bytes packet with the following decimal values
[71,13]
from a "pure serial port" point of view.

For instance, I'm getting the following decimal values in my
usbd_alloc(64)
read_data:
[33,96,144, 71,141,0...] or [0,0,0, 0,0,0...] garbage
instead of [71,13,0, 0,0,0...]

# io-usb -duhci
# usb -vvv
USB 0 (UHCI) v1.10, v1.01 DDK, v1.01 HCD
Control, Interrupt, Bulk, Isoch, Low speed

Device Address : 1
Upstream Host Controller : 0
Upstream Device Address : 0
Upstream Port : 0
Upstream Port Speed : Full
Vendor : 0x0403
Product : 0x6001
Device Release : r2.00
USB Spec Release : v1.10
Serial Number : N/A
Class : 0x00 (Independant per interface)
Max PacketSize0 : 8
Languages : No string descriptors
Current Frame : 929 (1024 bytes)
Configurations : 1
Configuration : 1
Attributes : 0x80 (Bus-powered)
Max Power : 90 mA
Interfaces : 1
Interface : 0 / 0
Class : 0xff (Vendor-specific)
Subclass : 0xff
Protocol : 0xff
Endpoints : Control + 2
Endpoint : 0
Attributes : Control
Max Packet Size: 8
Endpoint : 1
Attributes : Bulk/IN
Max Packet Size: 64
Endpoint : 2
Attributes : Bulk/OUT
Max Packet Size: 64

=================

program with fprintf log file for bulk_wait() enabled code:

inserted [8055f20][8055f8c]
{
devno 1 inserted
Read #0 = NULL
{
bLength[12],bDescriptorType[1],bcdUSB[110],bDeviceClass[0],
bDeviceSubClass[0],bDeviceProtocol[0],bMaxPacketSize0[8],
idVendor[403],idProduct[6001],bcdDevice[200],iManufacturer[1],
iProduct[2],iSerialNumber[3],bNumConfigurations[1]
}
Found CONTROL LINE - EndPoint#[0] - Max Packet Size [8]
Control pipe opened
Found BULK - EndPoint#[1]
BULK IN - Max Packet Size [64]
Input pipe opened
Found BULK - EndPoint#[2]
BULK OUT - Max Packet Size [64]
Output pipe opened
parse successful
Do something...
Initializing FTDI structure
Opening a FTDI device
usb_control_msg: setup...
urb[805a014], flags[2], request[0], request_type[40],value[0], index[0],
size[0], timeout[5000]
BYTES[0]=NULL or size[0]=0
CTRL_STATUS1[0]CTRL_STATUS2[0]usb_control_msg: setup...
urb[805a014], flags[2], request[3], request_type[40],value[4138],
index[0],
size[0], timeout[5000]
BYTES[0]=NULL or size[0]=0
CTRL_STATUS1[0]CTRL_STATUS2[0]ftdi open succeeded: 0
enabling bitbang mode
usb_control_msg: setup...
urb[805a014], flags[2], request[b], request_type[40],value[1ff], index[0],
size[0], timeout[5000]
BYTES[0]=NULL or size[0]=0
CTRL_STATUS1[0]CTRL_STATUS2[0]sleep 1 seconds...
disabling = Red Light
usb_bulk_write: bulk_io...
usb_bulk_io
usb_bulk_io: usbd_setup_bulk
usb_bulk_io: BEFORE BUFFER[^R^ESCD^RE] LENGTH[5]

{[0x12][18][_],[0x1b][27][_],[0x44][68][D],[0x12][18][_],[0x45][69][E],[0x0]
[0][_],[0x0][0][_],[0x0][0][_],}
usb_bulk_io: usbd_io
usb_bulk_io: AFTER BUFFER[^R^ESCD^RE] LENGTH[5]

{[0x12][18][_],[0x1b][27][_],[0x44][68][D],[0x12][18][_],[0x45][69][E],[0x0]
[0][_],[0x0][0][_],[0x0][0][_],}
usb_bulk_io: usbd_io: if(status[0]) bulk_wait...
usb_bulk_wait
usb_bulk_wait: Inside sleepon_lock()
usb_bulk_wait: Inside while... sleepon_wait()
usb_bulk_wait: urb_status[10],status[0],len[0],EBUSY[10]
]

{[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x
0][0][_],[0x0][0][_],}
usb_bulk_io: usbd_io
usb_bulk_io: AFTER BUFFER[] LENGTH[5]

{[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x
0][0][_],[0x0][0][_],}
usb_bulk_io: usbd_io: if(status[0]) bulk_wait...
usb_bulk_wait
usb_bulk_wait: Checking status[0].
enabling = Green Light
usb_bulk_write: bulk_io...
usb_bulk_io
usb_bulk_io: usbd_setup_bulk
usb_bulk_io: BEFORE BUFFER[^R^ESCE^RE] LENGTH[5]

{[0x12][18][_],[0x1b][27][_],[0x45][69][E],[0x12][18][_],[0x45][69][E],[0x0]
[0][_],[0x0][0][_],[0x0][0][_],}
usb_bulk_io: usbd_io
usb_bulk_io: AFTER BUFFER[^R^ESCE^RE] LENGTH[5]

{[0x12][18][_],[0x1b][27][_],[0x45][69][E],[0x12][18][_],[0x45][69][E],[0x0]
[0][_],[0x0][0][_],[0x0][0][_],}
usb_bulk_io: usbd_io: if(status[0]) bulk_wait...
usb_bulk_wait
usb_bulk_wait: Checking status[0].
usb_bulk_read: bulk_io...
usb_bulk_io
usb_bulk_io: usbd_setup_bulk
usb_bulk_io: BEFORE BUFFER[!] LENGTH[2]

{[0x21][33][!],[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x0][0][_],[
0x0][0][_],[0x0][0][_],}
usb_bulk_io: usbd_io
usb_bulk_io: AFTER BUFFER[!] LENGTH[2]

{[0x21][33][!],[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x0][0][_],[
0x0][0][_],[0x0][0][_],}
usb_bulk_io: usbd_io: if(status[0]) bulk_wait...
usb_bulk_wait
usb_bulk_wait: Checking status[0].
disabling = Red Light
usb_bulk_write: bulk_io...
usb_bulk_io
usb_bulk_io: usbd_setup_bulk
usb_bulk_io: BEFORE BUFFER[^R^ESCD^RE] LENGTH[5]

{[0x12][18][_],[0x1b][27][_],[0x44][68][D],[0x12][18][_],[0x45][69][E],[0x0]
[0][_],[0x0][0][_],[0x0][0][_],}
usb_bulk_io: usbd_io
usb_bulk_io: AFTER BUFFER[^R^ESCD^RE] LENGTH[5]

{[0x12][18][_],[0x1b][27][_],[0x44][68][D],[0x12][18][_],[0x45][69][E],[0x0]
[0][_],[0x0][0][_],[0x0][0][_],}
usb_bulk_io: usbd_io: if(status[0]) bulk_wait...
usb_bulk_wait
usb_bulk_wait: Checking status[0].
usb_bulk_read: bulk_io...
usb_bulk_io
usb_bulk_io: usbd_setup_bulk
usb_bulk_io: BEFORE BUFFER[!] LENGTH[5]

{[0x21][33][!],[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x0][0][_],[
0x0][0][_],[0x0][0][_],}
usb_bulk_io: usbd_io
usb_bulk_io: AFTER BUFFER[!] LENGTH[5]

{[0x21][33][!],[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x0][0][_],[
0x0][0][_],[0x0][0][_],}
usb_bulk_io: usbd_io: if(status[0]) bulk_wait...
usb_bulk_wait
usb_bulk_wait: Checking status[0].
enabling = Green Light
usb_bulk_write: bulk_io...
usb_bulk_io
usb_bulk_io: usbd_setup_bulk
usb_bulk_io: BEFORE BUFFER[^R^ESCE^RE] LENGTH[5]

{[0x12][18][_],[0x1b][27][_],[0x45][69][E],[0x12][18][_],[0x45][69][E],[0x0]
[0][_],[0x0][0][_],[0x0][0][_],}
usb_bulk_io: usbd_io
usb_bulk_io: AFTER BUFFER[^R^ESCE^RE] LENGTH[5]

{[0x12][18][_],[0x1b][27][_],[0x45][69][E],[0x12][18][_],[0x45][69][E],[0x0]
[0][_],[0x0][0][_],[0x0][0][_],}
usb_bulk_io: usbd_io: if(status[0]) bulk_wait...
usb_bulk_wait
usb_bulk_wait: Checking status[0].
usb_bulk_read: bulk_io...
usb_bulk_io
usb_bulk_io: usbd_setup_bulk
usb_bulk_io: BEFORE BUFFER[!] LENGTH[2]

{[0x21][33][!],[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x0][0][_],[
0x0][0][_],[0x0][0][_],}
usb_bulk_io: usbd_io
usb_bulk_io: AFTER BUFFER[!] LENGTH[2]

{[0x21][33][!],[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x0][0][_],[
0x0][0][_],[0x0][0][_],}
usb_bulk_io: usbd_io: if(status[0]) bulk_wait...
usb_bulk_wait
usb_bulk_wait: Checking status[0].
sleep 1 seconds...

disabling bitbang mode
usb_control_msg: setup...
urb[805a014], flags[2], request[b], request_type[40],value[0], index[0],
size[0], timeout[5000]
BYTES[0]=NULL or size[0]=0
CTRL_STATUS1[0]CTRL_STATUS2[0]insertion: closed.

=================

program with fprintf log file for bulk_wait() disabled code:

inserted [8055f20][8055f8c]
{
devno 1 inserted
Read #0 = NULL
{
bLength[12],bDescriptorType[1],bcdUSB[110],bDeviceClass[0],
bDeviceSubClass[0],bDeviceProtocol[0],bMaxPacketSize0[8],
idVendor[403],idProduct[6001],bcdDevice[200],iManufacturer[1],
iProduct[2],iSerialNumber[3],bNumConfigurations[1]
}
Found CONTROL LINE - EndPoint#[0] - Max Packet Size [8]
Control pipe opened
Found BULK - EndPoint#[1]
BULK IN - Max Packet Size [64]
Input pipe opened
Found BULK - EndPoint#[2]
BULK OUT - Max Packet Size [64]
Output pipe opened
parse successful
Do something...
Initializing FTDI structure
Opening a FTDI device
usb_control_msg: setup...
urb[805a014], flags[2], request[0], request_type[40],value[0], index[0],
size[0], timeout[5000]
BYTES[0]=NULL or size[0]=0
CTRL_STATUS1[0]CTRL_STATUS2[0]usb_control_msg: setup...
urb[805a014], flags[2], request[3], request_type[40],value[4138],
index[0],
size[0], timeout[5000]
BYTES[0]=NULL or size[0]=0
CTRL_STATUS1[0]CTRL_STATUS2[0]ftdi open succeeded: 0
enabling bitbang mode
usb_control_msg: setup...
urb[805a014], flags[2], request[b], request_type[40],value[1ff], index[0],
size[0], timeout[5000]
BYTES[0]=NULL or size[0]=0
CTRL_STATUS1[0]CTRL_STATUS2[0]sleep 1 seconds...
disabling = Red Light
usb_bulk_write: bulk_io...
usb_bulk_io
usb_bulk_io: usbd_setup_bulk
usb_bulk_io: BEFORE BUFFER[^R^ESCD^RE] LENGTH[5]

{[0x12][18][_],[0x1b][27][_],[0x44][68][D],[0x12][18][_],[0x45][69][E],[0x0]
[0][_],[0x0][0][_],[0x0][0][_],}
usb_bulk_io: usbd_io
usb_bulk_io: AFTER BUFFER[^R^ESCD^RE] LENGTH[5]

{[0x12][18][_],[0x1b][27][_],[0x44][68][D],[0x12][18][_],[0x45][69][E],[0x0]
[0][_],[0x0][0][_],[0x0][0][_],}
usb_bulk_io: usbd_io: if(status[0]) bulk_wait...
usb_bulk_wait
usb_bulk_wait: Checking status[0].
usb_bulk_read: bulk_io...
usb_bulk_io
usb_bulk_io: usbd_setup_bulk
usb_bulk_io: BEFORE BUFFER[] LENGTH[5]

{[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x
0][0][_],[0x0][0][_],}
usb_bulk_io: usbd_io
usb_bulk_io: AFTER BUFFER[] LENGTH[5]

{[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x
0][0][_],[0x0][0][_],}
usb_bulk_io: usbd_io: if(status[0]) bulk_wait...
usb_bulk_wait
usb_bulk_wait: Checking status[0].
enabling = Green Light
usb_bulk_write: bulk_io...
usb_bulk_io
usb_bulk_io: usbd_setup_bulk
usb_bulk_io: BEFORE BUFFER[^R^ESCE^RE] LENGTH[5]

{[0x12][18][_],[0x1b][27][_],[0x45][69][E],[0x12][18][_],[0x45][69][E],[0x0]
[0][_],[0x0][0][_],[0x0][0][_],}
usb_bulk_io: usbd_io
usb_bulk_io: AFTER BUFFER[^R^ESCE^RE] LENGTH[5]

{[0x12][18][_],[0x1b][27][_],[0x45][69][E],[0x12][18][_],[0x45][69][E],[0x0]
[0][_],[0x0][0][_],[0x0][0][_],}
usb_bulk_io: usbd_io: if(status[0]) bulk_wait...
usb_bulk_wait
usb_bulk_wait: Checking status[0].
usb_bulk_read: bulk_io...
usb_bulk_io
usb_bulk_io: usbd_setup_bulk
usb_bulk_io: BEFORE BUFFER[!] LENGTH[2]

{[0x21][33][!],[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x0][0][_],[
0x0][0][_],[0x0][0][_],}
usb_bulk_io: usbd_io
usb_bulk_io: AFTER BUFFER[!] LENGTH[2]

{[0x21][33][!],[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x0][0][_],[
0x0][0][_],[0x0][0][_],}
usb_bulk_io: usbd_io: if(status[0]) bulk_wait...
usb_bulk_wait
usb_bulk_wait: Checking status[0].
disabling = Red Light
usb_bulk_write: bulk_io...
usb_bulk_io
usb_bulk_io: usbd_setup_bulk
usb_bulk_io: BEFORE BUFFER[^R^ESCD^RE] LENGTH[5]

{[0x12][18][_],[0x1b][27][_],[0x44][68][D],[0x12][18][_],[0x45][69][E],[0x0]
[0][_],[0x0][0][_],[0x0][0][_],}
usb_bulk_io: usbd_io
usb_bulk_io: AFTER BUFFER[^R^ESCD^RE] LENGTH[5]

{[0x12][18][_],[0x1b][27][_],[0x44][68][D],[0x12][18][_],[0x45][69][E],[0x0]
[0][_],[0x0][0][_],[0x0][0][_],}
usb_bulk_io: usbd_io: if(status[0]) bulk_wait...
usb_bulk_wait
usb_bulk_wait: Checking status[0].
usb_bulk_read: bulk_io...
usb_bulk_io
usb_bulk_io: usbd_setup_bulk
usb_bulk_io: BEFORE BUFFER[!] LENGTH[5]

{[0x21][33][!],[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x0][0][_],[
0x0][0][_],[0x0][0][_],}
usb_bulk_io: usbd_io
usb_bulk_io: AFTER BUFFER[!] LENGTH[5]

{[0x21][33][!],[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x0][0][_],[0x0][0][_],[
0x0][0][_],[0x0][0][_],}
usb_bulk_io: usbd_io: if(status[0]) bulk_wait...
usb_bulk_wait
usb_bulk_wait: Checking status[0].
enabling = Green Light
usb_bulk_write: bulk_io...
usb_bulk_io
usb_bulk_io: usbd_setup_bulk
usb_bulk_io: BEFORE BUFFER[^R^ESCE^RE] LENGTH[5]

{[0x12][18][_],[0x1b][27][_],[0x45][69][E],[0x12][18][_],[0x45][69][E],[0x0]
[0][_],[0x0][0][_],[0x0][0][_],}
usb_bulk_io: usbd_io
usb_bulk_io: AFTER BUFFER[^R^ESCE^RE] LENGTH[5]

{[0x12][18][_],[0x1b][27][_],[0x45][69][E],[0x12][18][_],[0x45][69][E],[0x0]
[0][_],[0x0][0][_],[0x0][0][_],}
usb_bulk_io: usbd_io: if(status[0]) bulk_wait...
usb_bulk_wait
usb_bulk_wait: Checking status[0].
usb_bulk_read: bulk_io...
usb_bulk_io
usb_bulk_io: usbd_setup_bulk
usb_bulk_io: BEFORE BUFFER[!] LENGTH[2]

{[0x21][33][!],[0x0][0][_],[0x90][144][É],[0x0][0][_],[0x0][0][_],[0x0][0][_
],[0x0][0][_],[0x0][0][_],}
usb_bulk_io: usbd_io
usb_bulk_io: AFTER BUFFER[!] LENGTH[2]

{[0x21][33][!],[0x0][0][_],[0x90][144][É],[0x0][0][_],[0x0][0][_],[0x0][0][_
],[0x0][0][_],[0x0][0][_],}
usb_bulk_io: usbd_io: if(status[0]) bulk_wait...
usb_bulk_wait
usb_bulk_wait: Checking status[0].
sleep 1 seconds...

disabling bitbang mode
usb_control_msg: setup...
urb[805a014], flags[2], request[b], request_type[40],value[0], index[0],
size[0], timeout[5000]
BYTES[0]=NULL or size[0]=0
CTRL_STATUS1[0]CTRL_STATUS2[0]insertion: closed.

=========================

Anyone has any idea of what the problem could be ?!

Sincerely yours,
Fred.






 
   
Reply with quote Back to top
Harald KL
Post subject: Re: [USB DDK] FTDI USB->Serial chip  PostPosted: Aug 05, 2004 - 12:01 PM
Guest





Hello Fred,
I've got exactly the same task, and had a similar problem.
I used the printer class from the DDK as an template, too. And for the
interface description i used the Linux-Driver found on
http://ftdi-usb-sio.sourceforge.net/.
I could write to the port, but only once. And after that the message
repeated for ever and i got an EBUSY for the URB. I figured out that this
was happening because of the close statement. I did not delete the
termination code for the printer. This sent a 0 to the out-Endpoint. After
removing this writing worked properly. Still I had some trouble with
reading from the port. I found that you should not use a smaller request
then around 16 bytes. I don't know why, but when attempting to read a
smaller amount of data i get an USBD_STATUS_CMP_ERR.
You have to omit the first to bytes, too. Because they contain some status
information.
I'm quite a newbie to USB - Programming, but my driver seems to be working
now quite well. I can set the baudrate, stopbits and parity via stty.
Reading and writing works pretty much the same as on a normal serial port.

However I'm not using the bitbang mode.

If anyone has a clue on the 16-byte minimal reading problem, please let me
know.

Have fun,
Harald


Fred P. wrote:

Quote:
I also tried with 3 different urbs instead of just 1 urb:
urb_ctrl, urb_in, urb_out
for each endpoint, still gives EBUSY forever.

Based on the suggestion made by "Henry VanDyke"
in "Serial-USB driver help Belikn F5U103".

Sincerely,
Fred.


Quote:
Hi everyone,

I'm writing a USB device driver for an FTDI USB->Serial chip:
[0x6001,0x0403],
http://www.ftdichip.com/ based on the USB DDK Printer driver example,
since it has bulk in/out and some control setup.

I'm able to make the test LED going on and off
to the serial test board plugged to the FTDI in bitbang mode,
but usbd_urb_status == EBUSY and never return.

If I skip the bulk_wait part, I'm able to send data packets of 64 bytes to
the FTDI target,
but I'm unable to read anything.

bulk_cbf() is called only when I press CTRL-C, if I leave the bulk_wait().

Basically, I send a 5 bytes packet with the following decimal values
[18,27,68,18,69]
and I should retrieve a 2 bytes packet with the following decimal values
[71,13]
from a "pure serial port" point of view.

For instance, I'm getting the following decimal values in my
usbd_alloc(64)
read_data:
[33,96,144, 71,141,0...] or [0,0,0, 0,0,0...] garbage
instead of [71,13,0, 0,0,0...]
 
   
Reply with quote Back to top
anthony
Post subject: (usb-serial driver)-for Herald  PostPosted: Jan 06, 2005 - 06:03 AM
Active Member


Joined: Dec 20, 2004
Posts: 20

hello Herald
i have seen your reply to Fred.i am facing lots of problem in implementing read & write.i am following Linux Code as well as the ddk-printer & ddk-mouse.can u please help me out by sending some parts of your code to me.

please give a reply to me

take care
bye
anthony
 
 View user's profile Send private message  
Reply with quote Back to top
Olena
Post subject: RE: (usb-serial driver)-for Herald  PostPosted: Mar 03, 2005 - 09:38 AM
New Member


Joined: Mar 03, 2005
Posts: 3

Hello, Harald!
I`ve two similar problems with reading data from FTDI USB-Serial chip.

1. usbd_urb_status == EBUSY forever
usbd_urb_status always returns EBUSY flag.
I can change that status only by repluging(!) FTDI device.
Would you be such kind to send some example of your code to me or point
me where my code is wrong.

=====a part of ftdi-reading code (error-checking skiped)========
void insertion(...){
usbd_attach(...);
ep_in = usbd_endpoint_descriptor( device, 1,0,0,0x81, &DescNode );
usbd_descriptors_t *_ep_in = reinterpret_cast<usbd_descriptors_t*>(ep_in);
usbd_open_pipe( device, _ep_in, &InPipe );
IUSBBuf = static_cast<unsigned char*>( usbd_alloc(IUSBBufSize) );
IURB = usbd_alloc_urb(0);
}

int pl_bulk_wait(struct usbd_urb *urb, struct usbd_pipe *pipe ) {
while(usbd_urb_status( urb, &ustatus, &alen ) == EBUSY ) {
pthread_sleepon_wait( urb );
usbd_urb_status( urb, &ustatus, &alen );
}
pthread_sleepon_unlock();
if( ( ustatus & USBD_USB_STATUS_MASK ) == USBD_STATUS_STALL )
status=usbd_reset_pipe( pipe ); puts("bulk wait> stall error");
else{
if( (ustatus&USBD_STATUS_CMP) && !(ustatus&USBD_STATUS_CMP_ERR) ){
for( int i=2;i<IUSBBufSize;i++)
printf("%lx ",IUSBBuf[i]);
}
}
}

void main(){
usbd_connect(...);
sleep(4);
memset(IUSBBuf, 0x00, 1Cool;
for (i = 0; i < 0xFFFFFFF; i++) {
usbd_setup_bulk( IURB, URB_DIR_IN, IUSBBuf,1Cool;
if (usbd_io(IURB, InPipe, &pl_bulk_cbf, NULL,USBD_TIME_INFINITY)==EOK)
pl_bulk_wait( IURB, InPipe );
else { cout << "usbd_io error"; THROW_ER(r); }
}
}
===========================================
To All: Does any body knows where the problem can be?

2. About the problem with reading less than 16 bytes from devices.
IMHO you can`t read less than 16 bytes long. Because minimal packet
size is 16 bytes long (in this context).
For example I have:
D1 D2 D3 D4 D5 D6 D7 D8 D9 D10 D11 D12 D13 D14 D15 D16
1 40 0 ff bc 8 0 0 0 0 0 0 0 0 c6 ff
alen=18, where
D1-D2 -id of packet;
D3-D5 - some vendor data;
D6 - length of data transfer;
D7-D14 - data;
D15-D16 - crc.

Best regards, Olena.
mailto: norisnom@gmail.com
 
 View user's profile Send private message  
Reply with quote Back to top
Olena
Post subject: RE: (usb-serial driver)-for Herald  PostPosted: Mar 03, 2005 - 09:44 AM
New Member


Joined: Mar 03, 2005
Posts: 3

sorry, in code chapter I meen:
memset(IUSBBuf, 0x00, IUSBBufSize ) ; ....
usbd_setup_bulk( IURB, URB_DIR_IN, IUSBBuf, IUSBBufSize ) ; //IUSBBufSize=18
....
 
 View user's profile Send private message  
Reply with quote Back to top
Augustin
Post subject: RE: (usb-serial driver)-for Herald  PostPosted: Oct 03, 2006 - 03:25 PM
New Member


Joined: Oct 03, 2006
Posts: 1

Hi,
I am having the same problem : EBUSY on usbd_urb_status call using the printer template
Did anyone solve this ?
 
 View user's profile Send private message  
Reply with quote Back to top
jiv
Post subject: re:[USB DDK] usbd_urb_status == EBUSY forever  PostPosted: Oct 16, 2006 - 08:47 AM
Active Member


Joined: Feb 17, 2006
Posts: 35

QNX versions? update patches? etc?
Using printer DDK(IMHO) -> as sample only
 
 View user's profile Send private message  
Reply with quote Back to top
duttn
Post subject: EBUSY forever  PostPosted: Jul 16, 2007 - 07:16 PM
New Member


Joined: Jul 06, 2007
Posts: 5

Hi all,

I just saw this post and did not see if anybody finally solved this problem, could somebody please let me know if this was solved, and if possible, please attach the code as well.

Thank you so much in advance.

Regards,
N
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2007 The PNphpBB Group
Credits
All logos and trademarks in this site are property of their respective owners. The comments are property of their posters.
Powered by OpenQNX: The QNX Community Portal Site
QNX and the QNX logo are registered trademarks of QNX Software Systems.