K81/82 USB accessing Flash area

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

K81/82 USB accessing Flash area

1,824 次查看
izmile
Contributor III

Hi,

I am using K81 / K82 MCUs and got the USB CCID interface working. If I move the USB descriptors to flash area, then USB enumeration fails. I have tried the following but it doesn't work.

/* Disable MPU. All accesses from all bus masters are allowed now. */
MPU_CESR = (0);

// Set read access for USB master #3

FMC_PFAPR |= FMC_PFAPR_M3AP(01);   // USB is master #3

 

// USB master 3 is trusted for read access

AIPS0_MPRA |= AIPS_MPRA_MTR3(1);

Is there anything I am missing?

Thanks,

-Ismail

标记 (1)
0 项奖励
回复
5 回复数

1,657 次查看
jorge_a_vazquez
NXP Employee
NXP Employee

Hi Mohamed

You just need to set your access, I don't see anything that is missing.  I set String descriptors in flash and I enable the flash read access to USB, and it works in my side but maybe the error is in the descriptors, how you set them in flash? could you verify that they are property set in this are?

void APP_init(void)
{
    cdc_config_struct_t cdc_config;
    FMC->PFAPR |= FMC_PFAPR_M3AP(0x03);
    cdc_config.cdc_application_callback.callback = USB_App_Device_Callback;
    cdc_config.cdc_application_callback.arg = &g_app_handle;‍‍‍‍‍‍


Best Regards
Jorge Alcala

0 项奖励
回复

1,657 次查看
mjbcswitzerland
Specialist V

Hi

I confirm that I didn't see any problem with the settings; they are the same as used in the uTasker K80 USB stack, which always has the descriptors in Flash.

There is a USB-MSD loader for the K82 at http://www.utasker.com/kinetis/FRDM-K82F.html and with a debugger it should be possible to compare settings in the peripherals to be sure (as well as verifying that the operation with descriptors in Flash are OK).

Regards

Mark

0 项奖励
回复

1,657 次查看
izmile
Contributor III

Thanks for your replies. I am sure this would be a silly mistake in the code. I will update my findings shortly.

PS: Tossed around on another project.

0 项奖励
回复

1,657 次查看
mjbcswitzerland
Specialist V

Hi

Verify that FMC_PFAPR_M3AP(01);   // USB is master #3

gives 0x00000040

The macro is not transparent and so the value may be incorrect (?)

Regards

Mark

0 项奖励
回复

1,657 次查看
izmile
Contributor III

Yes, the macro FMC_PFAPR_M3AP(01) set the bits properly. I do some more digging around.

0 项奖励
回复