USB K22 flash

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

USB K22 flash

802 Views
martindusek
Contributor V

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?

Labels (2)
0 Kudos
5 Replies

641 Views
mjbcswitzerland
Specialist V

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

0 Kudos

641 Views
martindusek
Contributor V

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

0 Kudos

641 Views
mjbcswitzerland
Specialist V

Martin

For your device you need

FMC_PFAPR |= FMC_PFAPR_M4AP_RD;
which is

FMC_PFAPR |= 0x00000100;

Regards

Mark

0 Kudos

641 Views
martindusek
Contributor V

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.

0 Kudos

643 Views
mjbcswitzerland
Specialist V

Martin

I have always worked with Rev. 3, 7/2014 version which shows it:

pastedImage_1.png

The NXP version Rev. 4, 8/2016

pastedImage_2.png

removes the fields to control masters 3 and above.

There are masters 0, 1, 2 and 4 according to the latest Crossbar switch diagram:

pastedImage_3.png

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

0 Kudos