Hi -
I have an EZ-USB - based device that requires code to be downloaded
into it to turn it into a useful device. From linux I found a program
called ezusb2131 which acts as a driver and allows one to download an
attached device. This program works under linux; my device is downloaded
and the lights flash as expected, and re-enumeration shows it to be the
expected device. I took the program and rewrote it for the QNX usb
stack, and made some mistake(s) obviously, as all the lights come on
solid and it won’t re-enumerate. The key chunk of code, I think, is the
bit that downloads a “line” of code.
From the linux side it looks like this:
/* download the line of code to the board */
i=usb_control_msg(pezusb->usbdev,
usb_sndctrlpipe(pezusb->usbdev, 0),
ANCHOR_LOAD, VEN_REQUEST_OUT,
ihex_record.address, 0, ihex_record.data,
ihex_record.length, 300);
if (i != ihex_record.length)
{
printk(EZUSB_LL “%s: ERROR could not download board, err=%d,
%s,%d\n”,
EZUSB_MOD_NAME, i, FILE, LINE);
return(-1);
}
and my code looks like this:
// download that chunk
memmove( ezu->buffer, hexRec.data, hexRec.length );
if ( EOK != ( err = usbd_setup_vendor( ezu->urb, URB_DIR_OUT,
ANCHOR_LOAD,
USB_RECIPIENT_DEVICE |USB_TYPE_VENDOR,
hexRec.address, 0, ezu->buffer, hexRec.length ) )) {
fprintf( stderr, “EzUsb failed setup_vendor: line %d\n”, cnt );
return ( err );
}
if ( EOK != ( err = usbd_io( ezu->urb, ezu->ep_cntl, NULL, NULL, 500
)) ) {
fprintf( stderr, “EzUsb failed to load line %d\n”, cnt );
return ( err );
}
Can anybody see my error here? Or possibly the usb stack is unhappy with
the instant dis-connect and re-connect - done by the EZ-USB hardware at
the end of the download?
Does anybody know how to make the usb stack display setup packets in
hex? I could compare with what my Windows usb stiffer reports…
Any help will be much appreciated!
Phil Olynyk