USB NCP data corruption #3131
Closed
andrewleech
started this conversation in
General
Replies: 1 comment
-
Oh, my mistake, it seems I was working with an older pinned submodule that didn't include #2828 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I'm working on integrating NCP support into micropython in micropython/micropython#16459
I initially followed the lib/tinyusb/examples/device/net_lwip_webserver/src/main.c example to bind the NCM class support to the existing LWIP integration in micropython and had it working relatively easily, thanks!
However I found that if I started send / recv more than ~230 bytes at a time the received data was corrupted at the start of reception, eg the following log should be all
a
I was able to fix this by removing the use of
and essentially replacing the example code:
with
I think the key changes were replacing memcpy with
pbuf_take()
and not callingpbuf_free(received_frame);
afterethernet_input(received_frame, &netif_data);
unless there's an error. I copied this pattern from other working network drivers in micropython and don't seem to have run out of lwip buffers; I gatherethernet_input()
frees the buffer itself on success?I don't have hardware / build env set up to try making similar changes to the actual example code here sorry but wanted to share my findings in case they're relevant and helpful.
Beta Was this translation helpful? Give feedback.
All reactions