You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have described the issue in this post exactly: #1923 (comment)
The problem in a nutshell, is that the 'epout_buf' and 'epin_buf" members of the 'cdcd_interface_t' struct should be allowed to have different sizes, that correspond to the rx_ff_buf and tx_ff_buf sizes consequently.
How to reproduce ?
Power up a CDC device example,
In the config file, change the 'CFG_TUD_CDC_RX_BUFSIZE value to 1 lower than 'CFG_TUD_CDC_EP_BUFSIZE is set to.
Observe how the stack starts to work unstable and the tud_cdc_rx_cb function is not called.
To solve the issue, set 'epout_buf' size to not higher than the rx_ff_buf size. So currently for everything to work as expected, the CFG_TUD_CDC_RX_BUFSIZE has to be >= CFG_TUD_CDC_EP_BUFSIZE. IMO that should not be the case. For example, in my application I wanted to set the CFG_TUD_CDC_RX_BUFSIZE to 0, so I don't use reception at all, as it is not needed.
If I do this:
// CDC FIFO size of TX and RX
#define CFG_TUD_CDC_RX_BUFSIZE (0) // <- no RX buffer
#define CFG_TUD_CDC_TX_BUFSIZE (128)
// CDC Endpoint transfer buffer size, more is faster
#define CFG_TUD_CDC_EP_BUFSIZE (128)
and this:
uint8_t rx_ff_buf[CFG_TUD_CDC_RX_BUFSIZE];
uint8_t tx_ff_buf[CFG_TUD_CDC_TX_BUFSIZE];
OSAL_MUTEX_DEF(rx_ff_mutex);
OSAL_MUTEX_DEF(tx_ff_mutex);
// Endpoint Transfer buffer
CFG_TUSB_MEM_ALIGN uint8_t epout_buf[CFG_TUD_CDC_RX_BUFSIZE]; // <-- replaced the size to the give 0
CFG_TUSB_MEM_ALIGN uint8_t epin_buf[CFG_TUD_CDC_EP_BUFSIZE];
}cdcd_interface_t;
I can then runy the CDC with only transmission working and nothing crashing when I try to send data from the host to the device/
Debug Log as txt file
No response
Screenshots
No response
I have checked existing issues, dicussion and documentation
I confirm I have checked existing issues, dicussion and documentation.
The text was updated successfully, but these errors were encountered:
Operating System
Others
Board
KA-NUCLEO-F411CE
Firmware
src\class\cdc\cdc_device.c
What happened ?
I have described the issue in this post exactly: #1923 (comment)
The problem in a nutshell, is that the 'epout_buf' and 'epin_buf" members of the 'cdcd_interface_t' struct should be allowed to have different sizes, that correspond to the
rx_ff_buf
andtx_ff_buf
sizes consequently.How to reproduce ?
value to 1 lower than 'CFG_TUD_CDC_EP_BUFSIZE
is set to.tud_cdc_rx_cb
function is not called.To solve the issue, set 'epout_buf' size to not higher than the
rx_ff_buf
size. So currently for everything to work as expected, theCFG_TUD_CDC_RX_BUFSIZE
has to be >=CFG_TUD_CDC_EP_BUFSIZE
. IMO that should not be the case. For example, in my application I wanted to set theCFG_TUD_CDC_RX_BUFSIZE
to 0, so I don't use reception at all, as it is not needed.If I do this:
and this:
I can then runy the CDC with only transmission working and nothing crashing when I try to send data from the host to the device/
Debug Log as txt file
No response
Screenshots
No response
I have checked existing issues, dicussion and documentation
The text was updated successfully, but these errors were encountered: