Mark Butcher

M5222X - USB DATA from FLASH

Discussion created by Mark Butcher on May 26, 2008
Latest reply on May 30, 2008 by Mark Butcher
Hi All

Does any one know of restrictions to sending DATA over USB directly from FLASH?

I spend today completing a HID device working with the debugger from SRAM. Enumeration was working reliably and then interrupt DATA was being collected correctly. Then I compiled for FLASH and found that the enumeration would no longer get past the first DATA transfer - the data content was all zeros.

Since most of the descriptors were build up as const directly from FLASH I suspected that this may be the  problem: (example below):
    static const USB_DEVICE_DESCRIPTOR device_descriptor = {        STANDARD_DEVICE_DESCRIPTOR_LENGTH,   // standard device descriptor length (0x12)        DESCRIPTOR_TYPE_DEVICE,        {(unsigned char)USB_SPEC_VERSION,(USB_SPEC_VERSION >> 8)},        0,0,0,                               // device class, sub-class and protocol        ENDPOINT_0_SIZE,                     // size of endpoint reception buffer        {(unsigned char)USB_VENDOR_ID, (USB_VENDOR_ID >> 8)},        {(unsigned char)USB_PRODUCT_ID, (USB_PRODUCT_ID >> 8)},        {(unsigned char)USB_PRODUCT_RELEASE_NUMBER, (USB_PRODUCT_RELEASE_NUMBER >> 8)},        MANUFACTURER_STRING_INDEX, PRODUCT_STRING_INDEX, SERIAL_NUMBER_STRING_INDEX,  // fixed string table indexes        1                                    // number of configurations    };    fnPrepareOutData((unsigned char *)&device_descriptor, STANDARD_DEVICE_DESCRIPTOR_LENGTH, 0, ptrUSB_HW);

After removing the const attribute (and thus causing it to be copied from FLASH to SRAM) the DATA in this transfer was then correct again, which seemingly shows that direct transfers from FLASH don't work but from SRAM are OK.

Has anyone else experienced this or know of a method to be able to work directly from FLASH?

Regards

Mark

www.uTasker.com





Outcomes