-
Notifications
You must be signed in to change notification settings - Fork 7.4k
nrf52840 usb driver with openthread #16761
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
Comments
Any thoughts on this? If it's too low of a priority for anyone to work on, then I might attempt to tackle it myself although I'm not sure where to start given the complexity of the openthread codebase. But not being able to get logging output with openthread apps is making development pretty challenging |
Hi @jwknaup, I've just tried to configure USB with OpenThread on current master. I've added the following configuration to the
With this configuration shell and logger over USB CDC worked fine for me. Two caveats though:
|
Hi @jwknaup, I was able to make Logging through USB work on a nrf52840_pca10059 (Dongle) but OpenThread's connection range was reduced from 20 meters to 1 meter. I suppose it is somehow related to #11694, as it is necessary for me to disable UART interrupt for it to work properly:
|
@jwknaup You're correct, Zephyr's OpenThread port is integrated with shell/logger subsystem, not the console. |
Issue resolved. |
Hello @rlubos |
As for the |
Hey @rlubos CONFIG_COAP_SERVER_LOG_LEVEL_DBG=y CONFIG_NET_SHELL=y CONFIG_NET_SOCKETS=y CONFIG_OPENTHREAD_MASTERKEY="00:11:22:33:44:55:66:77:88:99:aa:bb:cc:dd:ee:ff" CONFIG_USE_SEGGER_RTT=y CONFIG_LOG=y #CONFIG_OPENTHREAD_LOG_LEVEL_DEBG=n CONFIG_GPIO=y CONFIG_USB=y I tried every possible thing because i wasn't able to print data on my serial terminal via USB. Currently i am able to receive log info on debug terminal using RTT as i have enabled that. If i just disable RTT i wasn't able to receive log on terminal |
And did you tried to enable
It seems that the config you shared is not a complete one (I see some OT required configs missing). Are you building in NCS context? I know it has some default config file, which used to enable |
Hello @rlubos Here is my ot-default-config file from common folder: ` CONFIG_NCS_SAMPLES_DEFAULTS=y CONFIG_NEWLIB_LIBC=y Enable floating point Hard ABI Generic networking options Kernel options Increase set for threads with meta-irq priority Logging Disable certain parts of Zephyr IPv6 stack Stack sizes configuration Network buffers L2 OpenThread enabling Disable OpenThread autostart Disable vanilla mbedtls in favor of custom backends Disable unneeded mbedtls modules ` And in last reply i mentioned was proj.conf i enabled RTT because i wasn't able to enable the USB port. By your configurations i was able to enable the USB. I will enabling logs for debugging purpose only. I will try this CONFIG_SHELL_LOG_BACKEND=y and revert you back. I would also like to know is there any way to print out my sensor data on USB without displaying other logs in final product. |
Note that |
Hey @rlubos , |
@nikhil30081995 Please refer to the latest version of the NCS CLI sample: |
Yesterday only i installed NCS using manual steps on ubuntu. nrf version is 1.6.0 in that i don't see overlay file for USB in CLI example. Will the above mentioned overlay file work with my version too? |
I don't know that, the overlay was added after 1.6.0 release. You can simply use the latest master. |
Okay @rlubos Just to add i can use the same interface to print my data on the terminal right? |
If you use logger, yes. |
By logger you mean the steps you mentioned above ? |
By logger I mean the Zephyr logger module. You print logs with with |
Hello @rlubos My current application is configured in such a way that the logs are enabled on the JLink RTT Viewer. Also using printf i am able to printf on RTT Viewer . I need printf to work because i don't want unnecessary data like to get printed with my sensor data. So i would just like to shift from RTT Viewer to USB CDC. |
I'm not that familiar with stdout configuration, so I suggest you experiment with Kconfig options on your own or ask on slack on how to enable stdout on USB CDC device. To my knowledge, you need to enable appropriate CONSOLE in order to get the stdout to work correctly, so I'd double check if |
Hey @rlubos But now the issue arrives when reading data using python script. The printk function goes through LOGs, so basically 9-10 data samples are printed at a time. So which makes python serial readline difficult to read data from terminal as the data are in bulk. So can you suggest me how to print data using LOG/printk one at a time instead of reading data in buffer and writing it after 1second. `dnk121@DNK121:~/Nikhil/Project/S-Node$ python3 data_extractioon.py dnk121@DNK121:~/Nikhil/Project/S-Node$ python3 data_extractioon.py dnk121@DNK121:~/Nikhil/Project/S-Node$ python3 data_extractioon.py dnk121@DNK121:~/Nikhil/Project/S-Node$ python3 data_extractioon.py dnk121@DNK121:~/Nikhil/Project/S-Node$ python3 data_extractioon.py dnk121@DNK121:~/Nikhil/Project/S-Node$ python3 data_extractioon.py dnk121@DNK121:~/Nikhil/Project/S-Node$ python3 data_extractioon.py dnk121@DNK121:~/Nikhil/Project/S-Node$ python3 data_extractioon.py dnk121@DNK121:~/Nikhil/Project/S-Node$ python3 data_extractioon.py dnk121@DNK121:~/Nikhil/Project/S-Node$ python3 data_extractioon.py dnk121@DNK121:~/Nikhil/Project/S-Node$ python3 data_extractioon.py ` ` ser = Serial('/dev/ttyACM0',115200,timeout=0.1) ser_bytes = ser.readline() |
To be honest, I don't quite understand how receiving data in bulk could impair the serial readline operation - it should only read the data up to the newline character (note that But if you really want to disable the logger functionality to accumulate the data, either disable the feature itself ( And, please, open a separate issue if you have more questions, we're deviating from the original topic a lot now. |
Describe the bug
When attempting to use both the nrf52 usb serial device driver and openthread, the usb serial output prints very slowly with many dropped/garbled characters.
To Reproduce
Expected behavior
It should print to console almost immediately:
In reality it prints very slowly (over a couple minutes):
Impact
Cannot use nrf software usb with openthread applications
Environment (please complete the following information):
Additional context
Running the same sample without openthread, the usb console works fine
Running the sample with openthread, without usb, and instead using the j-link usb connection, console works fine.
It is only the combination of openthread and usb that has issues.
My resulting configuration file looks like this
The text was updated successfully, but these errors were encountered: