3 Replies Latest reply on Oct 12, 2016 3:05 AM by cjsimon

    USBHost library with Galileo gen 2 and Arduino IDE

    stdalex

      Hi All,

       

      I am trying to transition one of my projects from using an Arduino board (Mega ADK) to using a Galileo gen 2 board but am running into some issues so hoping someone on here might be able to help.   I am currently using the USB  Host Shield 2.0 (felis/USB_Host_Shield_2.0 · GitHub) library in my Arduino code but when I try to use with Galileo I get a bunch of errors which I have included at the end.

       

       

      Is there a equivalent library for Galileo Arduino users?  All I need is the basic ability to send and receive data from the USB Host.  Here is a snippet of the code of how I am currently using it.

       

      // includes

      #include <cdcacm.h>

       

      // setup

      class ACMAsyncOper : public CDCAsyncOper

      {

      public:

        virtual uint8_t OnInit(ACM *pacm);

      };

       

      uint8_t ACMAsyncOper::OnInit(ACM *pacm)

      {

        uint8_t rcode = 0;

       

        // Set DTR=1 and RTS=1:

        rcode = pacm->SetControlLineState(3);


        if (rcode) {

          ErrorMessage<uint8_t>(PSTR("SetControlLineState"), rcode);

          return rcode;

        }

       

        LINE_CODING lc;

        lc.dwDTERate = 115200;

        lc.bCharFormat = 0;

        lc.bParityType = 0;

        lc.bDataBits = 8;

       

        rcode = pacm->SetLineCoding(&lc);

       

        if (rcode)

          ErrorMessage<uint8_t>(PSTR("SetLineCoding"), rcode);

       

        return rcode;

      }

       

      USB Usb;

      ACMAsyncOper AsyncOper;

      ACM Acm(&Usb, &AsyncOper);

       

      // To send data

      rcode = Acm.SndData(len, frame);

      // To receive data

      rcode = Acm.RcvData(len, buf);

       

       

      Any ideas?

       

      In file included from C:\arduino-1.5.3-Intel.1.0.4\libraries\USB_Host_Shield_20/Usb.h:36:0,

                       from C:\arduino-1.5.3-Intel.1.0.4\libraries\USB_Host_Shield_20/cdcacm.h:20,

                       from sketch_oct21a.ino:18:

      C:\arduino-1.5.3-Intel.1.0.4\libraries\USB_Host_Shield_20/usbhost.h:78:2: error: #error "No SPI entry in usbhost.h"

      In file included from C:\arduino-1.5.3-Intel.1.0.4\libraries\USB_Host_Shield_20/Usb.h:30:0,

                       from C:\arduino-1.5.3-Intel.1.0.4\libraries\USB_Host_Shield_20/cdcacm.h:20,

                       from sketch_oct21a.ino:18:

      C:\arduino-1.5.3-Intel.1.0.4\libraries\USB_Host_Shield_20/hexdump.h: In member function 'virtual void HexDumper<BASE_CLASS, LEN_TYPE, OFFSET_TYPE>::Parse(LEN_TYPE, const uint8_t*, const OFFSET_TYPE&)':

      C:\arduino-1.5.3-Intel.1.0.4\libraries\USB_Host_Shield_20/hexdump.h:48:51: error: there are no arguments to 'PSTR' that depend on a template parameter, so a declaration of 'PSTR' must be available [-fpermissive]

      C:\arduino-1.5.3-Intel.1.0.4\libraries\USB_Host_Shield_20/hexdump.h:48:51: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)

      C:\arduino-1.5.3-Intel.1.0.4\libraries\USB_Host_Shield_20/hexdump.h:51:42: error: there are no arguments to 'PSTR' that depend on a template parameter, so a declaration of 'PSTR' must be available [-fpermissive]

      C:\arduino-1.5.3-Intel.1.0.4\libraries\USB_Host_Shield_20/hexdump.h:54:53: error: there are no arguments to 'PSTR' that depend on a template parameter, so a declaration of 'PSTR' must be available [-fpermissive]

      In file included from C:\arduino-1.5.3-Intel.1.0.4\libraries\USB_Host_Shield_20/Usb.h:36:0,

                       from C:\arduino-1.5.3-Intel.1.0.4\libraries\USB_Host_Shield_20/cdcacm.h:20,

                       from sketch_oct21a.ino:18:

      C:\arduino-1.5.3-Intel.1.0.4\libraries\USB_Host_Shield_20/usbhost.h: In static member function 'static void SPi<SPI_CLK, SPI_MOSI, SPI_MISO, SPI_SS>::init()':

      C:\arduino-1.5.3-Intel.1.0.4\libraries\USB_Host_Shield_20/usbhost.h:57:17: error: 'SPCR' was not declared in this scope

      C:\arduino-1.5.3-Intel.1.0.4\libraries\USB_Host_Shield_20/usbhost.h:58:17: error: 'SPSR' was not declared in this scope

      In file included from C:\arduino-1.5.3-Intel.1.0.4\libraries\USB_Host_Shield_20/Usb.h:36:0,

                       from C:\arduino-1.5.3-Intel.1.0.4\libraries\USB_Host_Shield_20/cdcacm.h:20,

                       from sketch_oct21a.ino:18:

      C:\arduino-1.5.3-Intel.1.0.4\libraries\USB_Host_Shield_20/usbhost.h: In constructor 'MAX3421e<SPI_SS, INTR>::MAX3421e()':

      C:\arduino-1.5.3-Intel.1.0.4\libraries\USB_Host_Shield_20/usbhost.h:123:9: error: 'P55' has not been declared

      C:\arduino-1.5.3-Intel.1.0.4\libraries\USB_Host_Shield_20/usbhost.h:124:9: error: 'P55' has not been declared

      C:\arduino-1.5.3-Intel.1.0.4\libraries\USB_Host_Shield_20/usbhost.h: In member function 'void MAX3421e<SPI_SS, INTR>::regWr(uint8_t, uint8_t)':

      C:\arduino-1.5.3-Intel.1.0.4\libraries\USB_Host_Shield_20/usbhost.h:142:9: error: 'SPDR' was not declared in this scope

      C:\arduino-1.5.3-Intel.1.0.4\libraries\USB_Host_Shield_20/usbhost.h:143:17: error: 'SPSR' was not declared in this scope

      C:\arduino-1.5.3-Intel.1.0.4\libraries\USB_Host_Shield_20/usbhost.h:143:30: error: 'SPIF' was not declared in this scope

      C:\arduino-1.5.3-Intel.1.0.4\libraries\USB_Host_Shield_20/usbhost.h:145:17: error: 'SPSR' was not declared in this scope

      C:\arduino-1.5.3-Intel.1.0.4\libraries\USB_Host_Shield_20/usbhost.h:145:30: error: 'SPIF' was not declared in this scope

      C:\arduino-1.5.3-Intel.1.0.4\libraries\USB_Host_Shield_20/usbhost.h: In member function 'uint8_t* MAX3421e<SPI_SS, INTR>::bytesWr(uint8_t, uint8_t, uint8_t*)':

      C:\arduino-1.5.3-Intel.1.0.4\libraries\USB_Host_Shield_20/usbhost.h:170:9: error: 'SPDR' was not declared in this scope

      C:\arduino-1.5.3-Intel.1.0.4\libraries\USB_Host_Shield_20/usbhost.h:172:25: error: 'SPSR' was not declared in this scope

      C:\arduino-1.5.3-Intel.1.0.4\libraries\USB_Host_Shield_20/usbhost.h:172:38: error: 'SPIF' was not declared in this scope

      C:\arduino-1.5.3-Intel.1.0.4\libraries\USB_Host_Shield_20/usbhost.h:177:17: error: 'SPSR' was not declared in this scope

      C:\arduino-1.5.3-Intel.1.0.4\libraries\USB_Host_Shield_20/usbhost.h:177:30: error: 'SPIF' was not declared in this scope

      C:\arduino-1.5.3-Intel.1.0.4\libraries\USB_Host_Shield_20/usbhost.h: In member function 'uint8_t MAX3421e<SPI_SS, INTR>::regRd(uint8_t)':

      C:\arduino-1.5.3-Intel.1.0.4\libraries\USB_Host_Shield_20/usbhost.h:209:9: error: 'SPDR' was not declared in this scope

      C:\arduino-1.5.3-Intel.1.0.4\libraries\USB_Host_Shield_20/usbhost.h:210:17: error: 'SPSR' was not declared in this scope

      C:\arduino-1.5.3-Intel.1.0.4\libraries\USB_Host_Shield_20/usbhost.h:210:30: error: 'SPIF' was not declared in this scope

      C:\arduino-1.5.3-Intel.1.0.4\libraries\USB_Host_Shield_20/usbhost.h:212:17: error: 'SPSR' was not declared in this scope

      C:\arduino-1.5.3-Intel.1.0.4\libraries\USB_Host_Shield_20/usbhost.h:212:30: error: 'SPIF' was not declared in this scope

      C:\arduino-1.5.3-Intel.1.0.4\libraries\USB_Host_Shield_20/usbhost.h: In member function 'uint8_t* MAX3421e<SPI_SS, INTR>::bytesRd(uint8_t, uint8_t, uint8_t*)':

      C:\arduino-1.5.3-Intel.1.0.4\libraries\USB_Host_Shield_20/usbhost.h:237:9: error: 'SPDR' was not declared in this scope

      C:\arduino-1.5.3-Intel.1.0.4\libraries\USB_Host_Shield_20/usbhost.h:238:17: error: 'SPSR' was not declared in this scope

      C:\arduino-1.5.3-Intel.1.0.4\libraries\USB_Host_Shield_20/usbhost.h:238:30: error: 'SPIF' was not declared in this scope

      C:\arduino-1.5.3-Intel.1.0.4\libraries\USB_Host_Shield_20/usbhost.h:242:25: error: 'SPSR' was not declared in this scope

      C:\arduino-1.5.3-Intel.1.0.4\libraries\USB_Host_Shield_20/usbhost.h:242:38: error: 'SPIF' was not declared in this scope

      C:\arduino-1.5.3-Intel.1.0.4\libraries\USB_Host_Shield_20/usbhost.h: In member function 'int8_t MAX3421e<SPI_SS, INTR>::Init()':

      C:\arduino-1.5.3-Intel.1.0.4\libraries\USB_Host_Shield_20/usbhost.h:297:9: error: 'spi' has not been declared

      C:\arduino-1.5.3-Intel.1.0.4\libraries\USB_Host_Shield_20/usbhost.h: In member function 'int8_t MAX3421e<SPI_SS, INTR>::Init(int)':

      C:\arduino-1.5.3-Intel.1.0.4\libraries\USB_Host_Shield_20/usbhost.h:334:9: error: 'spi' has not been declared

      In file included from C:\arduino-1.5.3-Intel.1.0.4\libraries\USB_Host_Shield_20/Usb.h:37:0,

                       from C:\arduino-1.5.3-Intel.1.0.4\libraries\USB_Host_Shield_20/cdcacm.h:20,

                       from sketch_oct21a.ino:18:

      C:\arduino-1.5.3-Intel.1.0.4\libraries\USB_Host_Shield_20/UsbCore.h: At global scope:

      C:\arduino-1.5.3-Intel.1.0.4\libraries\USB_Host_Shield_20/UsbCore.h:37:18: error: 'P53' was not declared in this scope

      C:\arduino-1.5.3-Intel.1.0.4\libraries\USB_Host_Shield_20/UsbCore.h:37:23: error: 'P54' was not declared in this scope

      C:\arduino-1.5.3-Intel.1.0.4\libraries\USB_Host_Shield_20/UsbCore.h:37:26: error: template argument 1 is invalid

      C:\arduino-1.5.3-Intel.1.0.4\libraries\USB_Host_Shield_20/UsbCore.h:37:26: error: template argument 2 is invalid

      C:\arduino-1.5.3-Intel.1.0.4\libraries\USB_Host_Shield_20/UsbCore.h:37:36: error: invalid type in declaration before ';' token

      In file included from C:\arduino-1.5.3-Intel.1.0.4\libraries\USB_Host_Shield_20/Usb.h:37:0,

                       from C:\arduino-1.5.3-Intel.1.0.4\libraries\USB_Host_Shield_20/cdcacm.h:20,

                       from sketch_oct21a.ino:18:

      C:\arduino-1.5.3-Intel.1.0.4\libraries\USB_Host_Shield_20/UsbCore.h:195:29: error: expected class-name before '{' token

      sketch_oct21a.ino: In member function 'virtual uint8_t ACMAsyncOper::OnInit(ACM*)':

      sketch_oct21a.ino:73:53: error: 'PSTR' was not declared in this scope

      sketch_oct21a.ino:86:47: error: 'PSTR' was not declared in this scope

      sketch_oct21a.ino: In function 'void setup()':

      sketch_oct21a.ino:106:11: error: 'class USB' has no member named 'Init'

      sketch_oct21a.ino: In function 'void print_frame(char*, uint16_t, uint8_t*, char*)':

      sketch_oct21a.ino:133:20: error: no matching function for call to 'PrintHex(uint8_t&)'

      sketch_oct21a.ino:133:20: note: candidate is:

      In file included from C:\arduino-1.5.3-Intel.1.0.4\libraries\USB_Host_Shield_20/Usb.h:28:0,

                       from C:\arduino-1.5.3-Intel.1.0.4\libraries\USB_Host_Shield_20/cdcacm.h:20,

                       from sketch_oct21a.ino:18:

      C:\arduino-1.5.3-Intel.1.0.4\libraries\USB_Host_Shield_20/printhex.h:26:6: note: template<class T> void PrintHex(T, int)

      C:\arduino-1.5.3-Intel.1.0.4\libraries\USB_Host_Shield_20/printhex.h:26:6: note:   template argument deduction/substitution failed:

      sketch_oct21a.ino:133:20: note:   candidate expects 2 arguments, 1 provided

      sketch_oct21a.ino: In function 'boolean send_frame(int, uint8_t*)':

      sketch_oct21a.ino:151:41: error: 'PSTR' was not declared in this scope

      sketch_oct21a.ino: In function 'boolean get_frame(uint8_t*, uint16_t*)':

      sketch_oct21a.ino:164:37: error: 'PSTR' was not declared in this scope