Jim
I haven't tried this yet (it has only just occured to me) - but if you are trying USB transmissions directly from FLASH (before I do) you could have a go at doing the following:
Add CFM_FLASH to the FLASH address, where
#define CFM_FLASH (IPSBAR + 0x4000000)
Since the USB controller has its own DMA controller it is possibly working like the general purpose DMA controller. This also has to use the 'back-door' FLASH address to work properly. I solved this a long time back when creating a DMA based memcpy() - it reduces a 512 byte memcpy() to about 40% of the time using the standard loop method. In this code I used the following when setting up the DMA controller:
if ((unsigned long)ptrFrom < START_OF_SRAM) { DMA_SAR3 = (BACKDOOR_FLASH + (unsigned long)ptrFrom); // if from FLASH, set to backdoor } else { DMA_SAR3 = (unsigned long)ptrFrom; // address of first byte to be transfered (SARn) }
I suspect that the same technique will be relevant for the USB controller.
Furthermore, there may be access restrictions where the DMA controller will error when trying to access FLASH (then no transfer will take place - it aborts) if it doesn't have the rights to use FLASH. I solved this for the general purpose DMA controller by performing these two commands:
PACR1 = 0x04; // enable DMA to access FLASH
GPACR1 = 0x04;
These are already active in my project code but, again, they may also be required for the USB controller to be able to work directly from FLASH.
I will report back once I have tried this out (in case you don't beat me to it).
Regards
Mark
www.uTasker.com