-
Notifications
You must be signed in to change notification settings - Fork 1k
Receive double buffering for STM32F1xx #456
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
Receive double buffering for STM32F1xx #456
Conversation
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.
I will review it deeply later.
Just a first request changes:
Remove the .idea
(you can also use .gitignore to ensure not add it after)
c1e5b09
to
2e88dba
Compare
c9309c1
to
7b09ae3
Compare
Ok. .idea removed. |
And... You can review it later... but maybe you can test it? Speed on bluepill. And communication errors? |
Yes I will test it. ;) |
On Windows, FYI, benchmark code returning the issue:
|
a6f600e
to
ffb44b5
Compare
It was hard. Very hard, so hard, that i must say any bad word: poop. Ok, i'm better. But i tested receiving on my mac and linux, and it works in many cases. I done it without interrupt disabling... Please, test it |
Thanks @makarenya |
b872823
to
0cd04d8
Compare
And some interactive rebasing... |
051ad2b
to
1cd5b35
Compare
3065501
to
f3fdfe3
Compare
- Transmit endpoint over receive endpoint in both branches (style correction). - Initialize receive buffer for the double-buffered endpoint (as single buffered already have) - In double buffering transmission, set EP to valid, and set DTOG-s to the same buffer for NAK-ing After activation, all endpoint would NAK-ing for any host attempt to receive anything,
it is impossible to determine exactly how large the allocated buffer should be. To achieve double-buffering acceleration, the PCD_FreeUserBuffer call must occur before the HAL_PCD_DataOutStageCallback call. But the real data buffer can be allocated only in this callback. It turns out that the approach itself needs to be changed - always allocate maximum allowable endpoint buffer size (it's already happends in USB_ActivateEndpoint). At the same time we need to check the size of the data received. This check be done at the time of data receipt. During reception confirmation, it may be that there is no allocated buffer at all. In this case, we will have to leave the filled PMA intact and not complete its release. In this case, this operation will be repeated in HAL_PCD_EP_ReceiveData.
126c341
to
2bdb516
Compare
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.
Only one questions around double buffering.
Else seems nice. I will need to test deeply.
Argh, just retry with BP the speed test... and got old results
|
I test BluePill on the two platforms: OpenWRT MT7688 Linux host and on my MacBook Pro 2017... And i get about 760 000 bps on first and 720 000 on second. |
Moreover, I cannot get a speed greater than 760,000 under any circumstances at all, even if I do nothing in response to the IRQ, but simply say that the buffer is free and the hardware can work further. |
I just dust off my windows PC and repeat all tests with the BluePill
As you can see, on windows system speed is close to theoretical maximum |
|
No, i'm using original chinese BP. Two BP-s. First - connected to my MacBook via micro usb cable, second one connected to OpenWRT via two 68 Ohm resistors (resistors connects A11 and A12 pins of the BP board to the USB- and USB+ pins of OpenWRT board) |
It seems to me, that there are reasons, that doesn't allow your host to speed up greater than 250 000 bps... Maybe some isochronous device connected to it... USB speakers or mic... |
Well, seems my host USB stack was corrupted.... Fresh restart and it's work. |
…ring_for_f1 Receive double buffering for STM32F1xx
Receive double buffering for STM32F103 and others. Milestone 1
Affected devices:
Transmission double buffering not tested yet.
Reception works. It achieve maximum CDC speed, available for this devices.
It also contains a set of fixes and improvements.