-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
stm32_fsdev & ISO EP buffer allocation improvements #1828
Conversation
…edpt_number in the stm32 device driver as a crude tool to control mapping of the endpoint address to actual endpoint register
… through lookup table. Allocation of endpoint is now only performed in dcd_edpt_open
… available but requested
…g register on ISOCHRONOUS endpoints
If src is odd then src[wNBytes] is accessed.
I think it's better to add a flag somewhere to choose new buffer allocation method or continue use old one. |
4f59a1e
to
e833426
Compare
e833426
to
0bd41d5
Compare
b2f5100
to
21bdafc
Compare
Hi, thanks for your comments. Maybe yes, the APIs would be suitable for UVC too. By the way, UVC can also use bulk EPs instead of ISO EPs for non-linear editing. Current UVC implementation has not supported this. |
51dc934
to
2ef5adb
Compare
2ef5adb
to
35fa6b6
Compare
Yes i think this is a good idea! For us it might be a bit more work but the user does not need to be aware of this new allocation feature and we thus will get less issues reported ;) Great work btw! |
Thank you @HiFiPhile , am on travel, will check this out next week. |
TU_ATTR_WEAK uint8_t tu_stm32_edpt_number_cb(uint8_t addr); | ||
|
||
// This callback is called on SOF and can be used to e.g. capture a timer value for timing purposes | ||
TU_ATTR_WEAK void tu_stm32_sof_cb(void); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the moment I kept your SOF callback but for the stack it's not quite the right place to do it.
Did you test the tud_audio_feedback_interval_isr
and found out it has too much jitter ?
If a prioritized SOF callback is needed we need do it in a generalized way for other DCD drivers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I am also still on the fence with this callback.
From the looks of it, the generated feedback values in the speaker feedback endpoint had way less jitter for the UAC2 application. However I did not check if this actually makes a difference for the (stability of the) feedback control loop running on the Host. Since I can only test Linux hosts, I left it in there for a better gut feel in terms of compatibility.
I do however think it would be a nice addition, if this would be a more general solution across all DCD drivers. The way I use it is that the callback "emulates" a timer capture on SOF (since the STM32 I used cannot do this in hardware). I fear however, that a more generalized solution would come with more overhead, since It would require a "callback sharing" mechanism, in case multiple USB classes use this callback. Which of course diminishes the purpose of this callback.
EDIT: Maybe it would make sense to integrate a SOF-timestamp function into the device drivers, that the tinyusb stack can then query? Of course it would need to be configurable what Timer to use, etc... Which again depends on the actually device used and it's device driver.
If I get around to it, I can test if it would work without this callback. I think it would be okay for now to remove the callback. If I desperately need it, we can discuss the issue further.
Sorry for the delay in testing your branch. However I have found a serious bug in the code that you based your commits on. I first noticed sporadic corrupted memory on only some of my devices, which was really hard to debug. I narrowed it down to the TU_ASSERT that I added to the code in this commit. It turns out, that you need to set the receive buffer-size with ISOCHRONOUS endpoints for both double buffer count registers in the buffer descriptor table. I only set it for the |
@skuep Thanks for your update ! Indeed I have only tested IN EP. |
…ommit gets triggered for ISOCHRONOUS endpoints. It is necessary for those endpoints to set the NUM_BLOCK and BLSIZE for the receiving buffer in both, USB_COUNTn_TX and USB_COUNTn_RX. Despite the datasheet showing those fields only for the USB_COUNTn_RX register
Alrighty! From my side of view, testing was successful! Thanks a lot |
@skuep PS: One thing very useful is J-Scope, I used it to visualize FIFO level while adjusting feedback loop. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested successfully with the AIOC project
https://github.com/skuep/AIOC
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Superb!! Sorry for huge delay, I am in the middle for reviewing this PR. Everything looks great, I am doing mostly clean up to make it more readable. Number of #ifdef in audio driver is starting to look scary now. We should do some refactoring in the future. Overall this PR is awesome and ready to merge, however there is a note in the review, that I think we should change to prevent a read out-of-bound of an array.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
everything looks good. Thank you very much for putting your effort to this brilliant PR.
Awesome! Thanks 👍🙂 |
Describe the PR
For
stm32_fsdev
:For ISO transfer:
Additional context
If applicable, add any other context about the PR and/or screenshots here.