What is USB-FS DMA Access Granularity?

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

What is USB-FS DMA Access Granularity?

跳至解决方案
630 次查看
brunopaillard
Contributor III

Hi

I am trying to understand if the DMA of the USB-FS on the MK22FN512VLH12 would transfer a 32-bit long integer as a whole (atomically) as seen from the point of view of the MCU.

For instance let's say the MCU is reading a 32-bit long integer from memory. At the same time the USB-FS DMA is writing that same long-int (during a USB OUT request). Is it possible for the MCU to be reading that long-int after the USB-FS has written part of it, but not all of it, thereby reading a corrupted value?

Or would the DMA of the USB-FS write the whole 32-bit at once - as would be the case if the 32-bit transfer occurs as one atomic transfer on a 32-bit bus?

Same thing in reverse: If the USB-FS is reading from a long-int in memory (during a USB IN request) while the MCU is writing that long-int, is it possible for the USB-FS to read part of the long-int before the MCU write and the other part after the MCU write, thereby reading a corrupted value? Or will the USB-FS perform the 32-bit read as one atomic transfer on a 32-bit bus?

Thanks

Bruno

0 项奖励
1 解答
461 次查看
Kan_Li
NXP TechSupport
NXP TechSupport

Hi Bruno,


Two type of memory during usb system, one is data structure, which have some control information, another is data buffer, it’s used to store usb transfer data only.


For data structure, we have a “OWN” bit in it, which indicate which one is own the memory now, so MCU and USB won’t write same 32-bit at a same time, and USB will only access it with a 32-bit mode.


For data buffer, MCU and USB won’t access it at same time, they will exchange information with data structure and interrupt first, then they will know when is the proper time to access the data buffer.


Have a great day,
Kan

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

在原帖中查看解决方案

0 项奖励
2 回复数
462 次查看
Kan_Li
NXP TechSupport
NXP TechSupport

Hi Bruno,


Two type of memory during usb system, one is data structure, which have some control information, another is data buffer, it’s used to store usb transfer data only.


For data structure, we have a “OWN” bit in it, which indicate which one is own the memory now, so MCU and USB won’t write same 32-bit at a same time, and USB will only access it with a 32-bit mode.


For data buffer, MCU and USB won’t access it at same time, they will exchange information with data structure and interrupt first, then they will know when is the proper time to access the data buffer.


Have a great day,
Kan

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

0 项奖励
461 次查看
brunopaillard
Contributor III

Thanks Kan!

Bruno

0 项奖励