> var volatile byte usb_bd_array[ 255 ] at ( USB_BASE_ADDRESS + 0x0000 )

>> So I just noticed that this bd array (buffer descriptors array) is only
>> 255 bytes, but I think it should be 256 bytes since it is located from
>> 400h to 4FFh.

>> Maybe you can have a quick look and tell me what you think. Page 365
>> http://ww1.microchip.com/downloads/en/DeviceDoc/39931d.pdf


> that sounds logical

Thanks Seb, this is what I wanted to confirm.

> but you should extremely careful (test) while changing
> this.

Yes, of course! I will test other USB samples.

> do you think your problem  comes from here?

Yes, I just tested the fix. I could fix it by doing it in MSD lib, but
that's not the right place for the fix.

You can calculate USB space used by this:

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)

It actually works by allocating an extra 0x10 bytes at 0x500, but then
I worry about the missed 0x4FF. So MSD uses 0x0010 + (64 x 4) bytes.
>From addresses 0x400 to 0x510.

Adding this line to MSD fixes the issue:
var volatile byte usb_msd_reserve_array[0x10] at 0x400 + 0x100

But I still don't get it, since I had already defined:
var volatile byte usb_ep1out_buf[USB_EP1_OUT_SIZE] at USB_EP1_OUT_ADDR

The compiler may be removing this since it is not used. Doesn't
volatile mean the compiler won't movify or remove variables?

Matt.

-- 
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.

Reply via email to