Hi everyone,
I want to modify the USBD example.
In the USBD example there's a mouse but I don't have to work with a mouse.
I want to transfer data from ADC to PC. How should I modify the example to achieve this?
Thanks,
BR
Hi everyone,
I want to modify the USBD example.
In the USBD example there's a mouse but I don't have to work with a mouse.
I want to transfer data from ADC to PC. How should I modify the example to achieve this?
Thanks,
BR
Hi
Is there any particular USB class that you want to use?
If you use the usbd_cdc_acm example you can essentially send whatever data you like, and the device will appear as a comport on the host side that you can use to exchange data with the USB device.
Best regards
Torbjørn
Thanks for your answer,
I try to explain myself better.
Basically, I want to transmit data from the ADC of the nrf52840 to the computer. The goal is to transmit data packets in real time and therefore I think the best choice is a bulk transfer. I don't need to use a default class.
To do this I'm starting from USB example but i'm in trouble as i don't have a mouse like in the example. I just want to take data from the ADC and send it to the PC. I have no HID device.
I hope it is clearer now, sorry for my english but I'm sweden..
BR
Hi
If you just want to send generic data I think the CDC example is the best place to start.
The CDC class is based on bulk transfer.
One advantage of CDC over other USB classes is that you don't need to install a USB driver on the host side, since most operating systems support CDC devices out of the box.
Best regards
Torbjørn
What do you mean for "generic data"? Is a streaming data packet a "generic data"?
The problem with the CDC ACM is that it is not a packet-oriented data stream but character-oriented. In CDC ACM I don't have a package delimiter. It is not very suitable for transmitting packaged binary data (I think).
Thanks
Hi
It is relatively straight forward to add a delimiter to the data before sending it, as long as you add some code on the receiving end to remove the delimiter and form the data into packets again.
Essentially you need to define two unique 8-bit values. One for the delimiter, and one as a special character in case the delimiter value shows up in the data.
I guess the question is what you plan to run on the host side if you want to run something custom?
You can use something like libusb or winusb probably, to communicate more directly over bulk USB endpoints, but we don't have any examples showing how to configure this on the nRF side unfortunately.
Best regards
Torbjørn