Comments (9)
Have you tried #65112 ?
from zephyr.
I was testing on a nrf52840dk with the cdc_acm_echo sample.
[00:02:35.662,628] cdc_acm_echo: Received byte does not match expected byte! C0 != 80
[00:02:35.662,689] cdc_acm_echo: Sent byte does not match expected byte! C0 != 80
Which sample is it?
from zephyr.
Its the cdc_acm sample: samples/subsys/usb/cdc_acm
from zephyr.
Its the cdc_acm sample: samples/subsys/usb/cdc_acm
The log output clearly shows that it is not the sample in the tree, please add your modifications to the bug description.
from zephyr.
Added the modified interrupt handler
from zephyr.
No idea why git diff
does not work for you, but assuming your changes are:
diff --git a/samples/subsys/usb/cdc_acm/src/main.c b/samples/subsys/usb/cdc_acm/src/main.c
index 91f7a8db7f7..012f1a6b893 100644
--- a/samples/subsys/usb/cdc_acm/src/main.c
+++ b/samples/subsys/usb/cdc_acm/src/main.c
@@ -108,6 +108,11 @@ static int enable_usb_device_next(void)
}
#endif /* IS_ENABLED(CONFIG_USB_DEVICE_STACK_NEXT) */
+uint8_t tx_byte = 0x00;
+uint8_t rx_byte = 0x00;
+bool rx_err = false;
+bool tx_err = false;
+
static void interrupt_handler(const struct device *dev, void *user_data)
{
ARG_UNUSED(user_data);
@@ -132,6 +137,14 @@ static void interrupt_handler(const struct device *dev, void *user_data)
recv_len = 0;
};
+ for (int i = 0; i < recv_len; i++) {
+ if (!rx_err && (buffer[i] != rx_byte)) {
+ LOG_ERR("Received byte does not match expected byte! %02X != %02X", buffer[i], rx_byte);
+ rx_err = true;
+ }
+ rx_byte++;
+ }
+
rb_len = ring_buf_put(&ringbuf, buffer, recv_len);
if (rb_len < recv_len) {
LOG_ERR("Drop %u bytes", recv_len - rb_len);
@@ -154,6 +167,14 @@ static void interrupt_handler(const struct device *dev, void *user_data)
continue;
}
+ for (int i = 0; i < rb_len; i++) {
+ if (!tx_err && (buffer[i] != tx_byte)) {
+ LOG_ERR("Sent byte does not match expected byte! %02X != %02X", buffer[i], tx_byte);
+ tx_err = true;
+ }
+ tx_byte++;
+ }
+
if (rx_throttled) {
uart_irq_rx_enable(dev);
rx_throttled = false;
I cannot reproduce it on nRF52840, my steps are something like:
Python 3.11.9 (main, Apr 10 2024, 13:16:36) [GCC 13.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import serial
>>> dev = serial.Serial('/dev/ttyACM1', 115200, timeout=0.1, writeTimeout=0.1)
>>> data_out = serial.to_bytes(range(256))
>>> dev.writable()
True
>>> dev.write(data_out)
256
>>> dev.readable()
True
>>> data_in = dev.read(len(data_out))
>>> if data_out != data_in:
... print("Error");
...
>>>
from zephyr.
The changes look correct. It does not happen on the first packet. Try sending and receiving in a loop. On my system the byte drop happens after several minutes.
from zephyr.
The changes look correct. It does not happen on the first packet. Try sending and receiving in a loop. On my system the byte drop happens after several minutes.
Well, with example above I do not see any issue running in a loop for about 10 minutes.
It seems like the first 64 bytes are dropped on the usb receive side of the nrf52.
What is the exact name of the SoC or development board?
from zephyr.
What is the exact name of the SoC or development board?
nRF21540-DK
from zephyr.
Related Issues (20)
- Add support for Broadcom APDS9306
- Contributor self nomination: jakubtopic HOT 3
- ARCMWDT: compiler generates warnings about omited function declaration
- west simulate and west robot do not work with OOT
- ESP32-S3 Shell UART Ringbuffer Corruption HOT 1
- checkpatch: Devicetree `.overlay` files are not checked
- tests: net: conn_mgr_monitor: net.conn_mgr.nodad and net.conn_mgr.dad fails on NXP platforms HOT 2
- driver: serial: gd32: missing `irq_update` in `usart_gd32_driver_api` HOT 1
- Upgrading from zephyr3.6.0 to zephyr3.7.0-rc1, MCUboot has a dead loop during the image integrity check phase HOT 1
- Missing WID errors HOT 2
- zephyr kernel crash during networking testing on imx8mp Cortex-A Core HOT 1
- native_sim: combining `-fstack-protector` with `CONFIG_POSIX_C_LIB_EXT=y` crashes during boot HOT 6
- doc: Documentation issue in all api documentation HOT 1
- boards: nxp: lpcxpress55s16: missing usbphy1 devicetree node
- Drivers adc.h not taking oversampling from the devicetree in the resolution calculation HOT 1
- drivers: sensors: ti: tmp116: add conversion configuration
- POSIX sysconf breaks builds for many STM32 targets HOT 1
- Cellular modem with Sara-R5 turning off fail
- build system: No re-configure if dtc overlay file is changed with out-of-tree board
- esp32: can´t built project using base64 sources
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zephyr.