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
Solved! Go to Solution.
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
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
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
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
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
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
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.
Hope that helps,
Have a great day,
Kan
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Kan
We have no problems accessing Flash.
The question is whether peripherals can be accessed?
Regards
Mark
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!
-----------------------------------------------------------------------------------------------------------------------