-
Notifications
You must be signed in to change notification settings - Fork 20
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-NCM driver 0.17 hangs after a period of sending packets (IEC-243) #107
Comments
Hi @emaayan , thanks for reporting the issue. The last release v0.17.x of tinyusb uses DMA, so it might be helpful for the problem seeking to change it back to simple Slave mode via menuconfig ( If that won't help, there is an option to specify the tinyusb component with previous release version in the manifest file by providing the specific component version line:
Meanwhile we will try to find the problem, but regarding the current plans that might be not sooner than next month. |
upon further inspection i saw this lock happens here on the tud_task method which is basically
|
Hi @emaayan, is the issue still relevant? Could you also check to which core pinned the TinyUSB stack? If there is |
Maybe this is related to |
the performance, there is a workaround where you can add this to CMAKEList.txt of the main #idf_build_set_property(COMPILE_DEFINITIONS CFG_TUD_NCM_IN_NTB_N=3 APPEND) hi, the project that I've attached initially contains these settings, does it make any difference to which CPU it's pinned? CONFIG_TINYUSB_NO_DEFAULT_TASK is not setCONFIG_TINYUSB_TASK_PRIORITY=20 CONFIG_TINYUSB_TASK_AFFINITY_NO_AFFINITY is not setCONFIG_TINYUSB_TASK_AFFINITY_CPU0=y CONFIG_TINYUSB_TASK_AFFINITY_CPU1 is not setCONFIG_TINYUSB_TASK_AFFINITY=0x0 |
1 similar comment
If you could simply, try to configure NCM transfer blocks (their counts and lengths). Basically, it the MR I created to fix the other issue, fixes your issue as well, or if those are unrelated issues. Or you would need some higher count of NCM buffers for your solution to be stable.. |
i actually there might be 2 issues here the first is the configuration and the 2nd is a what seems to me a directly call to a function was meant to be used as a task in tiny_usb_send method |
Hi @emaayan, thanks for the clarification. NTB after the PR could be configured via menuconfig, so lets keep the problem with the transfer request blocked out of scope for now. Regarding the calling tud_task() in the Thanks. |
Made example from https://github.com/hathach/tinyusb/blob/master/examples/device/net_lwip_webserver/src/main.c#L111 My thought is that since |
my 2 main concerns is that i'm not sure that methods indented to be invoked directly because the docs say it's intented to be called either from main or RTSO loop, i don't know enough about task method to know for sure but my bigger concern is in the event of a single xmit failure that slides into that task, you're locked forever, because it waits indefinitely, which may ok , if you're calling it from a main super loop but not as a sub method i'm not even sure it's valid thing in that example. |
In case we received invalid datagram, we silently fail a the buffer was not returned to empty list -> it was lost. If this happened more than CFG_TUD_NCM_OUT_NTB_N times, we run out of NTBs and all OUT transfers are NACKed. Closes espressif/esp-usb#107
Answers checklist.
Which component are you using? If you choose Other, provide details in More Information.
device/esp_tinyusb
ESP-IDF version.
5.3.1
Development Kit.
esp-s3
Used Component version.
0.17.1
More Information.
hi, i'm directly using tinyusb port from espressif , but that repo has no issues repo
if i try to use the esp_tinyusb component wrapper the tinyusb_send method would eventually fail consistently with sending this.
steps to reproduce:
esp_tusb_ncm_bug.zip
the program generates a bytes array at random lengths from 20 to 1400 and first sends the size of the byte array and the actuall byte array while the corresponding client code does the opposite
after a while it just halts in it tracks sometimes you get log error of ethernetif_input: IP input error
private static ByteBuffer getByteBuffer(InputStream inputStream, int size) throws IOException { final ByteBuffer allocate = ByteBuffer.allocate(size).order(ByteOrder.LITTLE_ENDIAN); final byte[] array = allocate.array(); final int read = inputStream.readNBytes(array,0,size);// read(array,0,size); return allocate; } public static void main(String[] args) throws IOException { String host = "192.168.5.1"; final Socket socket = SocketFactory.getDefault().createSocket(host, 19000); while (socket.isConnected()){ final InputStream inputStream = socket.getInputStream(); final ByteBuffer byteBuffer = getByteBuffer(inputStream, 4); final int sz = byteBuffer.getInt(); final byte[] bytes = inputStream.readNBytes(sz); System.out.println(sz +" " +Arrays.toString(bytes)); } }
it hangs on tud_task() , which waits indefinitely..
The text was updated successfully, but these errors were encountered: