Skip to content
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 Buffer size #2178

Open
rapzak opened this issue Jan 13, 2025 · 1 comment
Open

USB Buffer size #2178

rapzak opened this issue Jan 13, 2025 · 1 comment

Comments

@rapzak
Copy link

rapzak commented Jan 13, 2025

Make an option to increase buffersize from user code...

Std settings on CDC as today gives ~200kbytes/sec
with increased buffer gives ~600kbytes/sec

Maybe make it posible to define custom buffers, but also pre-define.. like (low mem - std as today - medium and max mem...)
I have not troed to increase further to see more impact yet...

My changes to archieve 600kbyte:

// CHANGE CHANGE CHANGE
//.pico-sdk\sdk\2.1.0\src\rp2_common\pico_stdio_usb\include\tusb_config.h
//#define CFG_TUD_CDC_RX_BUFSIZE (256)
//#define CFG_TUD_CDC_TX_BUFSIZE (256)
#define CFG_TUD_CDC_RX_BUFSIZE 1024// (TUD_OPT_HIGH_SPEED ? 512 : 64)
#define CFG_TUD_CDC_TX_BUFSIZE 1024// (TUD_OPT_HIGH_SPEED ? 512 : 64)
// CDC Endpoint transfer buffer size, more is faster
#define CFG_TUD_CDC_EP_BUFSIZE 1024// (TUD_OPT_HIGH_SPEED ? 512 : 64)
// CHANGE CHANGE CHANGE END

I am not sure how to implement so it can be used from user code...

https://forums.raspberrypi.com/viewtopic.php?t=382388&sid=2e6f8d406c39944527e79819b0714d32

Thank you

@rapzak
Copy link
Author

rapzak commented Jan 13, 2025

The most important line:
#define CFG_TUD_CDC_EP_BUFSIZE

I just tried with all 3 defines the same, and above 768 the increase in speed is close to 0....
But if the 3 defines can be differentiated i have not tested

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant