Giter Site home page Giter Site logo

Comments (4)

dmitrystu avatar dmitrystu commented on May 19, 2024

AFAIK ISO EP double buffering for the F103 and similar USBFS can't be disabled due to hardware design. Anyway, let me check the docs.

from libusb_stm32.

dmitrystu avatar dmitrystu commented on May 19, 2024

Yes. See RM008 Section 23.4.4 "Isochronous transfers"

from libusb_stm32.

Seneral avatar Seneral commented on May 19, 2024

Thank you for pointing me in the right direction. Seems clear that it is not intended to be used using a single buffer, and any possible solution will be non-standard.

However, for future reference, I might try these two things:

  1. Set TX_0 and TX_1 to the same packet buffers, without any other additional action taken. Hardware toggle of DTOG should have no effect then, however behaviour might be undefined
  2. Set one adress field to a small separate buffer and then manually toggle DTOG when I'm ready to send again, unless I want it to it shouldn't have to do anything with the small buffer

Will comment when I did try, but probably won't do for at least a few months.

from libusb_stm32.

Seneral avatar Seneral commented on May 19, 2024

I have a related followup, not sure if it is an issues per se though.
The TX pma buffers are not cleared after an isochronous IN transfer has been completed, resulting in the same data being send 2 frames afterwards if you do not explicitly overwrite the PMA. I adressed this by a usbd_ep_write(usbd, ep, NULL, 0); call in the isochronous TX callback. Since all it needs to do is reset the PMA buffer count COUNTn_TX_x, this works as well:

if (!(*reg & USB_EP_DTOG_TX)) {
	tbl->tx1.cnt = 0;
} else {
	tbl->tx0.cnt = 0;
}

Since the TX callback is fired right when the DTOG is toggled (according to RM008), the usb driver user shouldn't have had the chance to write to the buffer yet, so I think this is a safe addition to the libusb_stm32 core (for isochronous transfers IN). This results in only the isochronous transfer immediately after a usbd_ep_write call to send the data, as expected.

On an unrelated note, I would think that a WCID example might be helpful. I recently implemented it and while it didn't take terribly long, it's simple copy-paste code that would be nice to have as an example, since I assume many people will be using WinUSB for windows. There are only two requests to cover and some custom data structures. If you want, I can create a simple example.

from libusb_stm32.

Related Issues (20)

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.