Skip to content
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

examples/foc: add real time data capture with nxscope lib #1765

Merged
merged 3 commits into from
May 19, 2023

Conversation

raiden00pl
Copy link
Contributor

Summary

  • examples/foc/foc_thr: fix mutex logic
  • examples/foc/foc_thr: get controller type from controller ID
  • examples/foc: add real time data capture with the NxScope library

Impact

It's now possible to capture controller data easily and then visualizing them. Useful for controller tuning and debugging.

Testing

Tested with nxscope client https://github.com/railab/nxscli
Data stream on UART works fine.
Data stream on full-speed CDCACM device adds too much uC overload which breaks FOC control loops and is not recommended (usbdev full-speed packet limit is too small). High-speed CDCACM should be more practical, but I don't have proper hardware to test.

Copy link

@cederom cederom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks cool! :-)

@cederom
Copy link

cederom commented May 18, 2023

@raiden00pl: Tested with nxscope client https://github.com/railab/nxscli Data stream on UART works fine. Data stream on full-speed CDCACM device adds too much uC overload which breaks FOC control loops and is not recommended (usbdev full-speed packet limit is too small). High-speed CDCACM should be more practical, but I don't have proper hardware to test.

@raiden00pl did you consider USB HID? It uses small fast interrupt transfers and provides quite good portability (+python modules on the host side). There is an interesting discussion at libusb/hidapi#274 (comment) on High-Speed vs Full-Speed HID problems and improving transfers at low level and hidapi vs hidraw implementation for various OS in favor of hidraw replacing hidapi :-)

I have just ordered cheap ESP32-S2 devkits maybe they will provide necessary USB Device to play with.. and the second device has OLED Display :-)

  1. https://allegro.pl/oferta/esp32-s2-mini-s2fn4r2-wifi-wemos-micropython-4mb-13135527193
  2. https://allegro.pl/oferta/esp32-s2-pico-oled-wifi-wemos-micropython-4mb-13135527582

@raiden00pl
Copy link
Contributor Author

@cederom that's interesting idea. I have no experience with usbdev as HID and NuttX doesn't seem to support HID device driver, so it's not so easy to verify :)

@cederom
Copy link

cederom commented May 19, 2023

There is a HIDKBD example app but I did not use it yet.. lets see when ESP32-S2 comes and some free time to play :-)

https://github.com/apache/nuttx-apps/tree/master/examples/hidkbd

If that chip works with both USB and WiFi then I could finally create virtual hid tester / fuzzer one day.. I have this idea to emulate various USB HID devices for host stack and libraries testing.. as for now people need to have whole bunch of devices while usually it is only the descriptor part that matters and some payload data all this could be provided over WiFi :-)

@xiaoxiang781216 xiaoxiang781216 merged commit 7e5a436 into apache:master May 19, 2023
@mcuee
Copy link

mcuee commented Jun 2, 2023

@cederom

For HIDAPI I have used the testing devices mentioned here.
libusb/hidapi#478

ESP32 C3/S2/S3/C6 should have have USB HID support and BLE HID support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants