Access of the USB FS DMA on MK22FN512VLH12 device

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Access of the USB FS DMA on MK22FN512VLH12 device

ソリューションへジャンプ
1,133件の閲覧回数
brunopaillard
Contributor III

Hi

I am trying to access various memory-map regions of the MK22FN512 device using the USB-FS module. That is, trying to read and write various regions of the memory map through USB.

I find that reading the SRAM region is not a problem.

Reading peripherals or Flash however always returns zeros.

For instance, I am trying to read address 0x00000000, which the TRM indicates should be accessible from all bus masters. I tried also at other aliased addresses, to no avail.

Is there a limitation (or protection) that precludes the DMA of the USB-FS module from accessing peripherals or Flash?

Thanks

Bruno

ラベル(3)
0 件の賞賛
1 解決策
904件の閲覧回数
brunopaillard
Contributor III

Hi Mark

Thanks for the link, very useful!

I assume that the USB-FS DMA cannot have access at all to other peripheral's registers? Just SRAM and Flash?

Thanks

Bruno

元の投稿で解決策を見る

0 件の賞賛
9 返答(返信)
904件の閲覧回数
lylezhu
Contributor I

Hi Bruno,

It is a Flash Access Protection Register(FMC_PFAPR) that is used to control whether the Master read and write access to the FLASH. So, If you want to access FLASH by using USB DMA, you need to set USB IP as a Master for FLASH in this register. Such as FMC_PFAPR |= 0x180;

Thanks,

Lyle

0 件の賞賛
903件の閲覧回数
mjbcswitzerland
Specialist V

Lyle

FMC_PFAPR |= 0x180 give master 4 read writes and master 3 write rights (there is no master 3 in the K22)

FMC_PFAPR |= 0x300 would give master 4 (USB in the K22) read/write rights.

However, giving the USB write rights would be of no use since Flash can't be written anyway...

Regards

Mark

0 件の賞賛
904件の閲覧回数
mjbcswitzerland
Specialist V
0 件の賞賛
905件の閲覧回数
brunopaillard
Contributor III

Hi Mark

Thanks for the link, very useful!

I assume that the USB-FS DMA cannot have access at all to other peripheral's registers? Just SRAM and Flash?

Thanks

Bruno

0 件の賞賛
904件の閲覧回数
mjbcswitzerland
Specialist V

Bruno

I don't know whether the USB-FS DMA can access peripheral space since I have only been interested in it being able to access Flash (so that data in consts can be sent directly). If you disable the memory protection unit and find that any values it should be collecting from peripheral space is incorrect I would conclude that it is not possible and so you will need to copy peripheral data to SRAM (using a DMA controller would allow this to be done with little overhead since the DMA controller certainly can).

Regards

Mark

0 件の賞賛
904件の閲覧回数
brunopaillard
Contributor III

Hi Mark

On the MK22FN512VLH12 there is no MPU, so it does look like the USB DMA cannot access any peripheral registers.

Thank you for your quick response!

Bruno

0 件の賞賛
904件の閲覧回数
Kan_Li
NXP TechSupport
NXP TechSupport

Hi Bruno & Mark,

Actually USB FS module can access the internal flash, and there is an demo available to show that feature, but you have to change the settings for crossbar to allow USB FS has higher priority than the core. Please kindly refer to the following for details.

usb.png

Hope that helps,


Have a great day,
Kan

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
904件の閲覧回数
mjbcswitzerland
Specialist V

Kan

We have no problems accessing Flash.

The question is whether peripherals can be accessed?

Regards

Mark

0 件の賞賛
904件の閲覧回数
Kan_Li
NXP TechSupport
NXP TechSupport

Hi Mark & Bruno,

Peripherals can be accessed, but out of reset , the Master of USB FS is not supported, only M0-2 can be allowed to access the peripherals, because peripheral access requires supervisor privilege level. Please kindly refer to Peripheral Bridge (AIPS-Lite) for more details.

Hope that helps,


Have a great day,
Kan

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛