<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: USB Audio Class: Explanation of the feedback sync function in i.MX RT Crossover MCUs</title>
    <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/USB-Audio-Class-Explanation-of-the-feedback-sync-function/m-p/1060825#M8404</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Daniel,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for the quick response and sorry for a bit confusing question.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The question is not about how to set up the proper amount of channels and bit-depth. I changed it in USB descriptors and adjust the audio buffer. Everything works as expected with a small exception... The synchronization sometimes glitching. What I mean by glitching is with a certain case (for example when I quickly reconnect the device) it loses synchronization and buffer overrun/underrun occurs. That's why the main question is "how exactly this synchronization function works"? What is the logic to calculate and compensate this "unsynchronizations". My goal is to tune it and test it somehow, but there is no description but only source code which is not fully clear.&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;SPAN class="" lang="en"&gt;&lt;SPAN class="" title=""&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;SPAN class="" lang="en"&gt;&lt;SPAN class="" title=""&gt;In other words, I would like to know how: &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;SPAN class="" lang="en"&gt;&lt;SPAN class="" title=""&gt;1. understand the cause of "unsynchronizations"&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;SPAN class="" lang="en"&gt;&lt;SPAN class="" title=""&gt;2. be able to reproduce it&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;SPAN class="" lang="en"&gt;&lt;SPAN class="" title=""&gt;3. tune it and test it again comparing with the previous result&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;SPAN class="" lang="en"&gt;&lt;SPAN class="" title=""&gt;4. debug synchronization feedback&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Anton&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 22 Jul 2020 07:57:58 GMT</pubDate>
    <dc:creator>anton_glukhov</dc:creator>
    <dc:date>2020-07-22T07:57:58Z</dc:date>
    <item>
      <title>USB Audio Class: Explanation of the feedback sync function</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/USB-Audio-Class-Explanation-of-the-feedback-sync-function/m-p/1060823#M8402</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm working with evkmimxrt1010_dev_audio_speaker_freertos example and would like to understand USB_AudioFeedbackDataUpdate function. It works for 2 channels 16bit audio stream, but I would like to change the number of channels and use 24bit or 32bit instead of 16bit. The general idea of feedback endpoint is clear the same as the format of the provided frame rate from the device to the host. But the implementation of calculation feedbackValue, unfortunately, is not very clear. It would be good if you can share/provide some documentation or short clarification of the ideas behind it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The second part is the tuning process. Once I adjust this function for my stream rate, how to tune the calculation of feedback rate in the most efficient way? What is the best options here? For example I can track the size of the income packets from the USB audio stream and easily see when host add/remove one packet. Another option is to track the buffer size, but using USB_AudioSpeakerBufferSpaceUsed function. These two marker are very useful, but they don't really help with analyzing if feedback value calculate efficiency.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Anton&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 18 Jul 2020 23:56:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/USB-Audio-Class-Explanation-of-the-feedback-sync-function/m-p/1060823#M8402</guid>
      <dc:creator>anton_glukhov</dc:creator>
      <dc:date>2020-07-18T23:56:09Z</dc:date>
    </item>
    <item>
      <title>Re: USB Audio Class: Explanation of the feedback sync function</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/USB-Audio-Class-Explanation-of-the-feedback-sync-function/m-p/1060824#M8403</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp; Anton:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The USB_AudioFeedbackDataUpdate function is not the right funciton that to modify the number of channels and the bits. this function is used to solve the problem of data unsynchronization that may exist between host and device.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you need to use the usb device to play the audio with different sampling rate, channels, quantization depth, you can change the settings of descriptor in usb_device_descriptor.c&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_3.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/116551i4E9C737CFEC04DC8/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_3.png" alt="pastedImage_3.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;These settings can be found in usb_device_descriptor.h and in the form of macros.&lt;/P&gt;&lt;P&gt;In addition, the setting of SAI&amp;amp;EDMA should also make corresponding adjustments. Related functions are in audio_speaker.c&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Jul 2020 06:16:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/USB-Audio-Class-Explanation-of-the-feedback-sync-function/m-p/1060824#M8403</guid>
      <dc:creator>danielchen</dc:creator>
      <dc:date>2020-07-22T06:16:10Z</dc:date>
    </item>
    <item>
      <title>Re: USB Audio Class: Explanation of the feedback sync function</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/USB-Audio-Class-Explanation-of-the-feedback-sync-function/m-p/1060825#M8404</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Daniel,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for the quick response and sorry for a bit confusing question.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The question is not about how to set up the proper amount of channels and bit-depth. I changed it in USB descriptors and adjust the audio buffer. Everything works as expected with a small exception... The synchronization sometimes glitching. What I mean by glitching is with a certain case (for example when I quickly reconnect the device) it loses synchronization and buffer overrun/underrun occurs. That's why the main question is "how exactly this synchronization function works"? What is the logic to calculate and compensate this "unsynchronizations". My goal is to tune it and test it somehow, but there is no description but only source code which is not fully clear.&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;SPAN class="" lang="en"&gt;&lt;SPAN class="" title=""&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;SPAN class="" lang="en"&gt;&lt;SPAN class="" title=""&gt;In other words, I would like to know how: &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;SPAN class="" lang="en"&gt;&lt;SPAN class="" title=""&gt;1. understand the cause of "unsynchronizations"&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;SPAN class="" lang="en"&gt;&lt;SPAN class="" title=""&gt;2. be able to reproduce it&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;SPAN class="" lang="en"&gt;&lt;SPAN class="" title=""&gt;3. tune it and test it again comparing with the previous result&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;SPAN class="" lang="en"&gt;&lt;SPAN class="" title=""&gt;4. debug synchronization feedback&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Anton&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Jul 2020 07:57:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/USB-Audio-Class-Explanation-of-the-feedback-sync-function/m-p/1060825#M8404</guid>
      <dc:creator>anton_glukhov</dc:creator>
      <dc:date>2020-07-22T07:57:58Z</dc:date>
    </item>
    <item>
      <title>Re: USB Audio Class: Explanation of the feedback sync function</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/USB-Audio-Class-Explanation-of-the-feedback-sync-function/m-p/1060826#M8405</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Anton:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;The case you proposed is&amp;nbsp;actually not related to the synchronization function, when you quickly reconnect the device, host will&amp;nbsp;re-enumerate the device and it will not trigger synchronous feedback.&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;For the four questions you listed:&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;1. The&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff; border: 0px; font-weight: inherit;"&gt;unsynchronization&amp;nbsp;&lt;/SPAN&gt;means&amp;nbsp;unsynchronization for clock. More specific, the speaker play audio with 48k sampling rate,2 channels and 16 bit depth, so every millisecond, the host should send 48*2*2 = 196 bytes data, but the host may have something wrong with the clock, it send 198 bytes every&amp;nbsp;&lt;SPAN style="border: 0px; font-weight: inherit;"&gt;millisecond, and then the device will give host the feedback to make host change it clock and send the correct 196 bytes per millsecond.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;SPAN style="border: 0px; font-weight: inherit;"&gt;2. If you use PC as host, you cannot control the host to send more data, maybe you can try different PCs. Or you can use another RT1010 as Host, change the length of send packet to Max packet size+2, you can easily get the overrun result.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px;"&gt;&lt;SPAN style="border: 0px; font-weight: inherit;"&gt;For 3 and 4,&amp;nbsp;&amp;nbsp;&lt;SPAN style="color: #51626f; background-color: #ffffff; border: 0px; font-weight: inherit;"&gt;the logic to calculate and compensate the&amp;nbsp;&lt;SPAN style="border: 0px; font-weight: inherit;"&gt;unsynchronization is based on the spec of usb audio, you can&amp;nbsp;refer to the USB audio spec&amp;nbsp; for more detailed information.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Jul 2020 07:26:11 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/USB-Audio-Class-Explanation-of-the-feedback-sync-function/m-p/1060826#M8405</guid>
      <dc:creator>danielchen</dc:creator>
      <dc:date>2020-07-23T07:26:11Z</dc:date>
    </item>
  </channel>
</rss>

