Coder Social home page Coder Social logo

Comments (13)

kiffie avatar kiffie commented on July 28, 2024

I had this or a similar issue on an STM32F446RET. The problem was the USB driver used by the HAL (crate synopsys-usb-otg). I solved it with a small patch. What chip are you using? BTW, I did not experience such problems on PIC32 and RP2040.

from usbd-audio.

JosefUtbult avatar JosefUtbult commented on July 28, 2024

Cool. I've been using a STM32H743ZITx with USB HS. I have also been trying with a STM32F7411RETx on FS.

from usbd-audio.

kiffie avatar kiffie commented on July 28, 2024

Do you mean STM32F411?

In the meantime, I reviewed my patch I created about a year ago. I put it on Github on https://github.com/kiffie/synopsys-usb-otg after rebasing it to the current master.

I can confirm that using the original synopsys-usb-otg has the same issue on STM32F446, i.e. loss of every second ISO packet. The patch fixes this issue for audio output (data flow from the host to the USB device).

Feel free to try it and let me know if it works.

I think the easiest way to test it, is to clone the iso-ep branch and add something like this to Cargo.toml of your program:

[patch.crates-io]
synopsys-usb-otg = { path = "../synopsys-usb-otg" }

from usbd-audio.

JosefUtbult avatar JosefUtbult commented on July 28, 2024

Thanks! Ill try it out. You're a lifesaver!

from usbd-audio.

JosefUtbult avatar JosefUtbult commented on July 28, 2024

It worked! I tried it for both the STM32F411 and the STM32H743, and the patch solved the problem.

I can make some changes in the stm32f4 example and make a pull request. Is it possible for you to explain what the problem was? I'm writing my masters thesis, and kinda need an explanation.

from usbd-audio.

kiffie avatar kiffie commented on July 28, 2024

Great. Does it also work on USB HS?

The issue was caused by the USB hardware checking the LSB (odd/even information) of the frame/micro frame number as indicated in the last SOF packet. The modified synopsys-usb-otg crate toggles the even/odd frame bit in the OTG_DOEPCTLx so that every ISO packet is received. More information can be found in the ST documentation, e.g. ST RM0390, section 31.16.6 "Device programming model".

A PR related to the stm32f4 example is very welcome, of course.

BTW, I am currently thinking about beautifying my quick fix on synopsys-usb-otg and sending a PR to them. Maybe, I will make some commits in my fork.

from usbd-audio.

JosefUtbult avatar JosefUtbult commented on July 28, 2024

Yea it seems to work on HS. The frame rate is still 1 ms though. I'm not sure if its still supposed to be that using HS, or if there is something else acting weird.

I'll fix the PM

from usbd-audio.

kiffie avatar kiffie commented on July 28, 2024

In the meantime, I revised the code on the iso-ep branch and crated a PR, see stm32-rs/synopsys-usb-otg#38.

from usbd-audio.

JosefUtbult avatar JosefUtbult commented on July 28, 2024

Sounds good

from usbd-audio.

JosefUtbult avatar JosefUtbult commented on July 28, 2024

Hey man. Sorry for continuing an issue like this, but I couldnt figure out a better way to get in contact with you.

I'm writing my masters thesis report now, and was wondering if you would like to be mensioned in it? In that case, would you be comfortable with me including your real name, or should I just use Stephan or Kiffeie?

from usbd-audio.

kiffie avatar kiffie commented on July 28, 2024

To cite this crate, you can use Stephan alias "Kiffie" and the URL of the repo: https://github.com/kiffie/usbd-audio.

I wish you success with your master thesis!

from usbd-audio.

JosefUtbult avatar JosefUtbult commented on July 28, 2024

Great. I'll send it to you before I publicise it so you can look it over. Thanks.

from usbd-audio.

kiffie avatar kiffie commented on July 28, 2024

No need to send it to me before publication. But you may post a link to the thesis once published if you want.

from usbd-audio.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.