I am using this library for a project where I can read voltages on a AD and send it to python and vice versa. Actually I have the problem that python gives me a LIBUSB_ERROR, because it can not write to the device. This mostly happens after writing 1024 bytes to the ATXMega192A3U. But sometimes it works like a charm.
Sending bytes to the host makes no problem at all, only receiving bytes from the host. Currently I am using a very simple protocol to communicate with the XMega:
For sampling a voltage from the AD I simply write one byte 's' to the XMega. Then the XMega sends me first back the magic number 123, then a 8 (for 8 channels), and then 8 times 2 bytes.
For setting a new voltage on a channel C, I send first 't', then one byte C and then two bytes for the voltage.
For setting new voltages on all 4 output channels, I send first a 'u', then the number of channels N and then N times 2 bytes.
Maybe you can help me with developing the main loop which should always be able to receive the data that comes from the host? Or do you have an example framework for a simple protocol between Host and XMega?
Hi there,
I am using this library for a project where I can read voltages on a AD and send it to python and vice versa. Actually I have the problem that python gives me a LIBUSB_ERROR, because it can not write to the device. This mostly happens after writing 1024 bytes to the ATXMega192A3U. But sometimes it works like a charm.
Sending bytes to the host makes no problem at all, only receiving bytes from the host. Currently I am using a very simple protocol to communicate with the XMega:
Maybe you can help me with developing the main loop which should always be able to receive the data that comes from the host? Or do you have an example framework for a simple protocol between Host and XMega?
Thank you in advance and best Regards, Nicolas