Hi,
I'm sending some data via USB on MK22FN512 by:
USB_DeviceSendRequest(handle, ep, buffer, length);
If buffer is pointing to chip's flash area then the other doesn't receive correct data. If I move buffer to SRAM, then correct data passes through.
Is there anything I have to do to be able to send data from flash via USB?
Martin
You must give the USB master the correct Flash access privilege - see the FMC_PFAPR ( Flash Access Protection Register) .
Regards
Mark
uTasker developer and supporter (+5'000 hours experience on +60 Kinetis derivatives in +80 product developments)
Kinetis: http://www.utasker.com/kinetis.html
Hi Mark,
thanks. I can see that privileges can be set for Master 0, 1 and 2 in PFAPR on MK22FN512. But USB is Master 4. So it is still unclear for me what to set...
Martin
For your device you need
FMC_PFAPR |= FMC_PFAPR_M4AP_RD;
which is
FMC_PFAPR |= 0x00000100;
Regards
Mark
OK, thanks. Then, there is a mistake in https://www.nxp.com/docs/en/reference-manual/K22P121M120SF7RM.pdf , page 600. M4AP field is not there.
Martin
I have always worked with Rev. 3, 7/2014 version which shows it:
The NXP version Rev. 4, 8/2016
removes the fields to control masters 3 and above.
There are masters 0, 1, 2 and 4 according to the latest Crossbar switch diagram:
and so I believe that it is a documentation error. Probably the flags were cleaned up since there are no M3, M5, M6 or M7 masters but the M4 master was also deleted by mistake....
Regards
Mark