Page 1 of 1

HsUSBD Fly-Mode packetizing size control

Posted: 04 Mar 2019, 08:29
by kojima
Dear staffs,

I'm investigating HsUSBD of Cortex-M4 serise.
I have a question about Fly-Mode which will be used for IN-Endpoints.

○When I write a data by WORD-access to corresponding EPxDAT, does
this mechanism validate packet length by FOUR byte boundary ?

○This mode is explained that it is suitable for Isoch.
How can I enjoy this mechanism for so-called "Hi-Res Audio", which
requires multiple( audio channels) of 32bit wide data ?
In the most application cases, the number of audio channels will be
even numbers, such as two (for stereo), four, eight etc....
The audio datum representing those of the SAME audio sampling time
should NOT be separated apart in two USB packets, must be always
in the same USB packet.

○To accomplish Hi-Res Strereo, a pair of 32bit Left/Right audio channel
data smartly employing Fly-mode, I think I must set endpoint in Fly-mode
only when I write proper even number of audio channel data.
Is there any recommendable algorithm to do that ?
For examples.....
A kind of DYNAMIC mode change only to get expected validation border condition;
Before writing two (word-sized) audio data, once set Endpoint as
Auto-Validate or Manual-Validate.
When those audio datum representing those on the same audio
sampling time are written, set Endpoint in Fly-mode back again....
Here, I'm a little bit anxious about....
Endpoint mode setting frequently changed while data contents
in the FIFO are growing still keeps proper behavior of Endpoint control or not...

Regards.
Shoichi Kojima

Re: HsUSBD Fly-Mode packetizing size control

Posted: 19 Mar 2019, 11:08
by Dylan Hsieh
Hi Kojima-san,

The fly-mode only care how many data in the endpoint buffer, if the data in the EP buffer is less than maximum packet size, the HS-USBD will send all of data in A package after receive the in-token from HOST. But if data is more than the maximum packet size, the data will be divided into two package, one package data payload is maximum packet size, the other is consist by remaining data.

○When I write a data by WORD-access to corresponding EPxDAT, does
this mechanism validate packet length by FOUR byte boundary ?

Yes, the HS-USBD handles the boundary case itself.

○This mode is explained that it is suitable for Isoch.
How can I enjoy this mechanism for so-called "Hi-Res Audio", which
requires multiple( audio channels) of 32bit wide data ?
In the most application cases, the number of audio channels will be
even numbers, such as two (for stereo), four, eight etc....
The audio datum representing those of the SAME audio sampling time
should NOT be separated apart in two USB packets, must be always
in the same USB packet.

If you can ensure that all the audio data (32-bit x N-ch x L/R) is less than maximum packet size, and put those data to EP buffer
before in-token coming, the data will be sent in A USB package.


○To accomplish Hi-Res Strereo, a pair of 32bit Left/Right audio channel
data smartly employing Fly-mode, I think I must set endpoint in Fly-mode
only when I write proper even number of audio channel data.
Is there any recommendable algorithm to do that ?
For examples.....
A kind of DYNAMIC mode change only to get expected validation border condition;
Before writing two (word-sized) audio data, once set Endpoint as
Auto-Validate or Manual-Validate.
When those audio datum representing those on the same audio
sampling time are written, set Endpoint in Fly-mode back again....
Here, I'm a little bit anxious about....
Endpoint mode setting frequently changed while data contents
in the FIFO are growing still keeps proper behavior of Endpoint control or not...

Change the operate mode of endpoint dynamically is not recommended, it's hard to control and know which operate mode is when in-token coming.