-
Notifications
You must be signed in to change notification settings - Fork 1k
USB enhancement #419
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
USB enhancement #419
Conversation
I've tested this PR on STM32F407 and the performance is just about the same as with the timer based CDC. RAM usage is much better: USB enhancement: Sketch uses 22540 bytes (2%) of program storage space. Maximum is 1048576 bytes. Average bytes per second = 635948 Timer based USB: Sketch uses 24260 bytes (2%) of program storage space. Maximum is 1048576 bytes. Average bytes per second = 633275 Unfortunately, using a simple Arduino test program that just echoes back what it receives there seems to be character loss:
The PC programs just sends an increasing number of bytes then reads and compares the number of bytes sent/received: ... I assume this is caused by the smaller buffers but not being able to transfer 160 bytes is a limitation. |
Can you attach a client application to make it easier to test for similar errors? |
I'm trying to reproduce this bug, but... python code on host:
code on STM32F103C8T6
same as yours, except it uses '\n' instead of '\r' And it produces no errors at all. On the STM32F103... |
This is What I thought, some bytes are Lost. This mainly depends of the cpu speed. This is why HS on F7 is not ok. |
I think I know the answer. The fact is that a prerequisite for flawless operation is that the |
I will read the code for STM32F407 today and see what and where bugs could have been generated. |
Your test program is not doing the same as mine. I send a buffer with an increasing size, you send a buffer containing a string represenation of an increasing value. Try this instead:
|
Has anyone tried the teensy test code? https://www.pjrc.com/teensy/benchmark_usb_serial_receive.html . It might be useful to see how this code compares to other boards |
@RickKimball I, and others, tried it on the parent USB PR #388: speeds were similar to above. |
@RickKimball yes, this is how we bench the speed. Anyway, I will try to find/implement a test for send and also check data integrity. |
All errors are fixed, PR are updated! |
Can someone share a speed test? It's interesting to try double buffering and generally look at USB optimization options. |
Thanks @makarenya. I will test it tomorrow. Currently I do not have a full speed test. We only use the one from PJRC. https://www.pjrc.com/teensy/benchmark_usb_serial_receive.html |
8f20f02
to
7f89b83
Compare
I've added @makarenya fixes. Thanks ;) |
Tried the speed test on STM32F407 and speed is the same. Also tried the echo test program and now there is no lost characters! Great work! |
I can try to speed up it on f103 board (it has endpoint double buffering feature, that must speed it up). But i today i have no other stm32 boards... however i bough f407 and am waiting for the postal service |
Happy to test any f4 speed improvements here... |
I'm also happy to test any F4 speed improvments. Maybe one optimization would be to implement the readBytes() function as done in Teensyduino? (ref USB Virtual Serial Receive Speed) |
Yes, of course. This is in the list. Forgot to add it. |
#410 updated, added bulk readBytes method and some other small speed improvements. Can you test it? |
Thanks @makarenya |
7f89b83
to
e8fd582
Compare
I've updated the PR with @makarenya speed improvements. |
Thanks @makarenya for the last fixes. |
What exactly is wrong with HS? |
Ok. Thanks @BennehBoy , |
HID bootloader works fine. DFU with Maple Original bootloader works fine - DISC PIN handling working. Seems good to me. Will you consider merging HID/DFU & the magic word handling also? |
I have tried this pull request and the branch created by Frederic (https://github.com/fpistm/Arduino_Core_STM32/tree/USB_PR_419_424_426) with the Marlin 3D printer firmware (2.0.x). Unfortunately there is a serious issue which causes the firmware to lock up until the USB CDC port is opened from the host computer. Marlin writes to the serial port during startup and if the port is not open the I think the linestate must be montored by the CDC implementation. This was not a problem with the timer-based CDC. Regards, |
Got it, i make it tomorrow |
Hi @makarenya Did you find a solution to the problem with writes to the CDC when the port is not opened on the host side? If you need any help testing just let me know. |
47d6535
to
c1d4d60
Compare
Signed-off-by: Alexey Makarenya <[email protected]>
Signed-off-by: Alexey Makarenya <[email protected]>
Signed-off-by: Alexey Makarenya <[email protected]>
Signed-off-by: Frederic.Pillon <[email protected]>
Added bulk read method readBytes and improved read and peek methods.
c1d4d60
to
6cde061
Compare
Signed-off-by: Frederic Pillon <[email protected]>
Signed-off-by: Frederic Pillon <[email protected]>
@BennehBoy, @ktand could you test this latest version, please? I will do a release this week, so hope to solve your issue with Marlin before. |
@fpistm - works 👍 |
@fpistm I will test tonight.
Den tis 12 feb. 2019 22:27Ben Anderson <[email protected]> skrev:
… @fpistm <https://github.com/fpistm> - works 👍
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#419 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AQ8NJI7p-x6bPaI0C7cruMqdtqoqtBDjks5vMzGvgaJpZM4aTPhy>
.
|
I think I will merge this PR. |
USB enhancement
List:
USB_DISC_PIN
and re-enumeration --> Covered by [USBD] Force re-enumeration #426readBytes
andreadBytesUntil
thanks @makarenya (Timers removal, rebased to master. Also fixed PMA memory distribution #410)Current Status:
FS well functional.
HS ok except ReadByte test.