Status: Assigned
Owner: [email protected]
Labels: Type-Defect Priority-Medium
New issue 176 by [email protected]: USB buffer descriptor memory
allocation
http://code.google.com/p/jallib/issues/detail?id=176
Prevous discussion at:
http://groups.google.com/group/jallib/browse_thread/thread/e6c730dbaa2a31f8/3b4bf0227b3231ef?lnk=gst&q=msd#3b4bf0227b3231ef
I noticed that the BD array (buffer descriptors array) is only 255 bytes
but it should be 256 bytes since it is located from, 400h to 4FFh.
See this line in usb_defs.jal:
var volatile byte usb_bd_array[ 255 ] at ( USB_BASE_ADDRESS + 0x0000 )
It should be:
var volatile byte usb_bd_array[ 256 ] at ( USB_BASE_ADDRESS + 0x0000 )
Also see Page 365:
http://ww1.microchip.com/downloads/en/DeviceDoc/39931d.pdf
However, sometimes the space required is larger then 256. According to the
below setup for MSD, the space needed will be 0x10 + 64 + 64 + 64 + 64 =
272 bytes
const bit USB_EP0 = ENABLED
const byte USB_EP0_OUT_SIZE = 64
const word USB_EP0_OUT_ADDR = (USB_BASE_ADDRESS + 0x0010)
const byte USB_EP0_IN_SIZE = 64
const word USB_EP0_IN_ADDR = (USB_EP0_OUT_ADDR + USB_EP0_OUT_SIZE )
const bit USB_EP1 = ENABLED
const byte USB_EP1_OUT_SIZE = 64
const word USB_EP1_OUT_ADDR = (USB_EP0_IN_ADDR + USB_EP0_IN_SIZE)
const byte USB_EP1_IN_SIZE = 64
const word USB_EP1_IN_ADDR = (USB_EP1_OUT_ADDR + USB_EP1_OUT_SIZE)
To fix this for MSD, I used the following in my sample after the above code:
var volatile byte usb_msd_reserve_array[0x10] at 0x400 + 0x100
But I still don't get it, since I had already defined this in the sample
which should have reserved the memory space:
var volatile byte usb_ep1out_buf[USB_EP1_OUT_SIZE] at USB_EP1_OUT_ADDR
Maybe the compiler is removing this since usb_ep1out_buff is never used?
The above fixes resolved some of my USB MSD issues. MSD would not work
otherwise.
--
You received this message because you are subscribed to the Google Groups
"jallib" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/jallib?hl=en.