I own a UDOO Quad board which features two CPUs (SAM3X8E like Arduino Due and a ARM Cortex-A9) connected with an internal OTG USB.

I am trying literally for months to use the USB Host Shield Library (https://github.com/felis/USB_Host_Shield_2.0/) in order to make the Due act as a USB host to the other CPU (which runs Android). The Due runs well a piece of code collecting some data every X milliseconds within a built-in timer's ISR.

What I want to achieve is to send this data collected by the ISR to the other CPU via the USB connection of the two; but there seems to be an issue with the Usb.Task() call. This Usb.Task() needs to be executed from within the Loop() but it seems to need much more time than the timer's frequency. So eventually it is never executed.

Please note that all of the above work when the interrupt is not involved; Usb.Task() works perfectly from the Loop() (data to/from the other CPU can be both sent and received).

Bits from the code:

void readPlantStatus() {
  if (analogRead(E2_STATUS)*(3.3/1023.0) > 2.0) e2_reached = true;
  else e2_reached = false;
  if (analogRead(F2_STATUS)*(3.3/1023.0) > 2.0) f2_reached = true;
  else f2_reached = false;
  if (analogRead(T2_STATUS)*(3.3/1023.0) > 2.0) t2_reached = true;   
  else t2_reached = false;
  if (analogRead(E3_STATUS)*(3.3/1023.0) > 2.0) e3_reached = true;
  else e3_reached = false;
  if (analogRead(F3_STATUS)*(3.3/1023.0) > 2.0) f3_reached = true;   
  else f3_reached = false;

void TC3_Handler() {
  TC_GetStatus(TC1, 0);

void loop()

Any help would be greatly appreciated!

  • USB may well not be suited to your task - it is generally not good at moving tiny bits of data frequently. You could look at trying to transfer the data in larger packet-sized buffers asynchronously to your sampling which would be more fitting to the design of USB (but may indeed make for some tricky programming) or you could look at using a UART - at a decent baud rate such as 115200 that can actually be faster for short messages than USB since you can basically talk any time you've finished what you were previously sending. – Chris Stratton Apr 2 '16 at 3:33
  • Thank you Chris for your quick comment. I guess I will have to look into the UART option as you proposed. – sample_nickname Apr 3 '16 at 15:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.