Having a difficult time getting iso transfers working. What am I missing now?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Having a difficult time getting iso transfers working. What am I missing now?

286 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by HenryPhillis on Tue Oct 02 21:36:16 MST 2012
Evening folks. I'm trying to to get isochronous (OUT) transfers working and have run into nothing but troubles sofar! Does anyone have an example?.. or a working usb stack? The keil one has some bugs that make me think either nobody reviewed it or it was written by a novice ... such as this in usbhw.c:

void delay (uint32_t length ) {
  uint32_t i;

  for ( i = 0; i < length; i++ ) {
  }
  return;
}
My code wouldn't enumerate after I added optimization flags.. it took me a while to track down this because I thought it was an issue with something I did... not of Keil's code. :mad:


This is the fix by the way (put it in the for loop):
    __asm volatile("nop");



On the host side, I've made a libusb app that talks with EP4 (OUT) on the LPC1343.. This connects fine and via my usb logic analyzer, I can verify data really is being sent to the device.


On the device side, I have:
1. Added an interface with ONE endpoint... an OUT endpoint going to EP 4 since this is the only EP that supports 512 iso transfers.
2. Added a USB_EndPoint4 function in usbuser.c and some code that toggles an led on and off. 
3. in usbcfg.h, changed the following so USB_EndPoint4 would be called (it took me a while to understand this)
#define USB_EP_EVENT 0x11
What else do I need to do to get my method called when an iso transfer comes in? The led does not toggle as is and I can't find much more information.

Any additional info would be really helpful! My angst might be coming out in this post, but it's only because I've spent many hours trying to figure out what's going on.


Edit: It's probably worth mentioning I'm using 1.2 of the keil arm usb stack.
0 Kudos
4 Replies

261 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by HenryPhillis on Wed Oct 03 22:02:10 MST 2012
I figured it out!

I had to rewrite the USB_ReadEP method. Once again, I expected something to work, and it didn't.

The problem with the method is it will sit and hang until something is read due to:

  do {
    cnt = LPC_USB->RxPLen;
  } while ((cnt & PKT_DV) == 0);
  cnt &= PKT_LNGTH_MASK;


Since iso transfers need to be read in the SOF interrupt, that means data won't always be there... the solution is to basically make than an if statement FOR ISO TRANSFERS ONLY.. so either add additional code for EP 4, or make another method.
0 Kudos

261 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by HenryPhillis on Wed Oct 03 14:56:11 MST 2012
Oh my, how did I forget that detail!

I'm using the lpc1343. I did not realize they totally changed the engine for the lpc1347. I intended to port this design and this will make things more interesting.
0 Kudos

261 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Tsuneo on Wed Oct 03 10:54:55 MST 2012
NXP's LPC families have two types of USB device engines.

a) The first and legacy one, which runs USB protocol engine, had introduced at LPC214x
LPC23xx/24xx, LPC17xx and LPC1343 succeed this lineage.
In this post, I explained about the behavior of this engine for isochronous transfer.
http://www.keil.com/forum/21347/

b) The newer one, which has been designed for LPC11Uxx.
LPC1347 came up with this newer engine.
I believe NXP will apply this engine for new LPC chips, to be released.

Which one are you playing with?

Tsuneo
0 Kudos

261 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by HenryPhillis on Tue Oct 02 22:37:59 MST 2012
Ok, so I popped open the datasheet to read through the code and the first thing I notice is there is no interrupt for EP4... so why the heck is it here in this table?:
/* USB Endpoint Events Callback Pointers */
void (* const USB_P_EP[USB_LOGIC_EP_NUM]) (uint32_t event) = {
  P_EP(0),
  P_EP(1),
  P_EP(2),
  P_EP(3),
  P_EP(4),
};
It looks like I need to look at frames, which going on the start code suggests I need to define the following in usbcfg.h:
#define USB_SOF_EVENT       1
I gotta look at this more before continuing.. if you have run down the same path, let me know
0 Kudos