What is USB-FS DMA Access Granularity?

cancel
Showing results for 
Search instead for 
Did you mean: 

What is USB-FS DMA Access Granularity?

Jump to solution
352 Views
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 Kudos
1 Solution
183 Views
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!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
2 Replies
184 Views
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 Kudos
183 Views
brunopaillard
Contributor III

Thanks Kan!

Bruno

0 Kudos