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

Arduino Due not supported? #76

Closed
ns130291 opened this issue Feb 23, 2014 · 27 comments
Closed

Arduino Due not supported? #76

ns130291 opened this issue Feb 23, 2014 · 27 comments

Comments

@ns130291
Copy link

I am trying to compile the ADK samples for the Arduino Due and get the following error messages:

Arduino: 1.5.5-r2 (Windows 7), Board: "Arduino Due (Programming Port)"

In file included from Usb.h:36,
                 from adk.h:23,
                 from term_test.ino:1:
usbhost.h:73: error: #error "No SPI entry in usbhost.h"
usbhost.h: In static member function 'static void SPi<SPI_CLK, SPI_MOSI, SPI_MISO, SPI_SS>::init()':
usbhost.h:54: error: 'SPCR' was not declared in this scope
usbhost.h:55: error: 'SPSR' was not declared in this scope
In file included from Usb.h:36,
                 from adk.h:23,
                 from term_test.ino:1:
usbhost.h: In member function 'void MAX3421e<SPI_SS, INTR>::regWr(uint8_t, uint8_t)':
usbhost.h:134: error: 'SPDR' was not declared in this scope
usbhost.h:135: error: 'SPSR' was not declared in this scope
usbhost.h:135: error: 'SPIF' was not declared in this scope
usbhost.h:137: error: 'SPSR' was not declared in this scope
usbhost.h:137: error: 'SPIF' was not declared in this scope
usbhost.h: In member function 'uint8_t* MAX3421e<SPI_SS, INTR>::bytesWr(uint8_t, uint8_t, uint8_t*)':
usbhost.h:155: error: 'SPDR' was not declared in this scope
usbhost.h:157: error: 'SPSR' was not declared in this scope
usbhost.h:157: error: 'SPIF' was not declared in this scope
usbhost.h:162: error: 'SPSR' was not declared in this scope
usbhost.h:162: error: 'SPIF' was not declared in this scope
usbhost.h: In member function 'uint8_t MAX3421e<SPI_SS, INTR>::regRd(uint8_t)':
usbhost.h:190: error: 'SPDR' was not declared in this scope
usbhost.h:191: error: 'SPSR' was not declared in this scope
usbhost.h:191: error: 'SPIF' was not declared in this scope
usbhost.h:193: error: 'SPSR' was not declared in this scope
usbhost.h:193: error: 'SPIF' was not declared in this scope
usbhost.h: In member function 'uint8_t* MAX3421e<SPI_SS, INTR>::bytesRd(uint8_t, uint8_t, uint8_t*)':
usbhost.h:212: error: 'SPDR' was not declared in this scope
usbhost.h:213: error: 'SPSR' was not declared in this scope
usbhost.h:213: error: 'SPIF' was not declared in this scope
usbhost.h:217: error: 'SPSR' was not declared in this scope
usbhost.h:217: error: 'SPIF' was not declared in this scope
usbhost.h: In member function 'int8_t MAX3421e<SPI_SS, INTR>::Init()':
usbhost.h:272: error: 'spi' has not been declared
usbhost.h: In member function 'int8_t MAX3421e<SPI_SS, INTR>::Init(int)':
usbhost.h:309: error: 'spi' has not been declared
In file included from Usb.h:37,
                 from adk.h:23,
                 from term_test.ino:1:
UsbCore.h: At global scope:
UsbCore.h:27: error: 'P10' was not declared in this scope
UsbCore.h:27: error: 'P9' was not declared in this scope
UsbCore.h:27: error: template argument 1 is invalid
UsbCore.h:27: error: template argument 2 is invalid
UsbCore.h:27: error: invalid type in declaration before ';' token
In file included from Usb.h:37,
                 from adk.h:23,
                 from term_test.ino:1:
UsbCore.h:176: error: expected class-name before '{' token
term_test.ino: In function 'void setup()':
term_test:20: error: 'class USB' has no member named 'Init'
@Lauszus
Copy link
Collaborator

Lauszus commented Feb 24, 2014

No the Due is not supported at the moment, but I will work on adding support for it in the future.

@Lauszus
Copy link
Collaborator

Lauszus commented Feb 25, 2014

I just worked on adding support for it last night. Please download the code from the following branch: https://github.com/felis/USB_Host_Shield_2.0/tree/Due and let me know if it is working.

Note that you should add:

#include <SPI.h>

In your sketch due to a bug in the Arduino IDE - see: arduino/Arduino#1726.

@Lauszus
Copy link
Collaborator

Lauszus commented Feb 25, 2014

Also could you please upload the following program to your Due:

#include <SPI.h>
#define _usb_h_ // Workaround include trap in the USB Host library
#include <avrpins.h> // Include this from the USB Host library

void setup() {
  P9::SetDirWrite();
  P10::SetDirWrite();
  P74::SetDirWrite();
  P75::SetDirWrite();
  P76::SetDirWrite();
}

void loop() {
  P9::Set();
  P10::Set();
  P74::Set();
  P75::Set();
  P76::Set();
  delay(1000);
  P9::Clear();
  P10::Clear();
  P74::Clear();
  P75::Clear();
  P76::Clear();
  delay(1000);
}

Note that pin 74-76 is located on the ICSP header - see: http://arduino.cc/en/Hacking/PinMappingSAM3X and http://www.robgray.com/temp/Due-pinout.pdf.

And confirm that it toggles the pins?

@Lauszus
Copy link
Collaborator

Lauszus commented Mar 1, 2014

@ns130291 did you have time to try this yet?

@ns130291
Copy link
Author

ns130291 commented Mar 2, 2014

I compiled and uploaded it to the Due, but I didn't have time to test it yet.

@Lauszus
Copy link
Collaborator

Lauszus commented Mar 2, 2014

Okay. Let me know when you have tested it.

@Lauszus
Copy link
Collaborator

Lauszus commented Mar 2, 2014

Also please run the following example as well: https://github.com/felis/USB_Host_Shield_2.0/blob/master/examples/board_qc/board_qc.ino.

@etherviz
Copy link

etherviz commented Mar 6, 2014

my results running board_qc:
Circuits At Home 2011
USB Host Shield Quality Control Routine
Reading REVISION register... Die revision invalid. Value returned: FF
Unrecoverable error - test halted!!
0x55 pattern is transmitted via SPI
Press RESET to restart test

btw, I'm using the Due with Sparkfun's USBhostshield

@Lauszus
Copy link
Collaborator

Lauszus commented Mar 6, 2014

You can not use the Sparkfun shield without modifications, as the SPI pins on the Due are located on the ICSP header!
Could you try to just run this code: #76 (comment) and confirm that the pins toggle?

@etherviz
Copy link

etherviz commented Mar 6, 2014

Yep, it blinks pins 9,10,74,75, & 76 on my Due.

@Lauszus
Copy link
Collaborator

Lauszus commented Mar 6, 2014

Great! You need to connect some wires from the ICSP header to pins 11, 12 and 13.
Pin 4 on the ICSP header (MOSI) should be connected to pin 11.
Pin 1 on the ICSP header (MISO) should be connected to pin 12.
Pin 3 on the ICSP header (SCK) should be connected to pin 13.

More information is available here: http://arduino.cc/en/Reference/SPI.

After that please run: https://github.com/felis/USB_Host_Shield_2.0/blob/master/examples/board_qc/board_qc.ino again.

@etherviz
Copy link

etherviz commented Mar 6, 2014

This Says it all:
Circuits At Home 2011
USB Host Shield Quality Control Routine
Reading REVISION register... Die revision 03
SPI long test. Transfers 1MB of data. Each dot is 64K................ SPI long test passed
GPIO test. Connect GPIN0 to GPOUT7, GPIN1 to GPOUT6, and so on
Test failed. Value written: 00 Value read: FF
Press any key to continue...
GPIO test passed.
PLL test. 100 chip resets will be performed
Resetting oscillator

Reset number 0 Time to stabilize - 387 cycles

Reset number 1 Time to stabilize - 387 cycles

Reset number 2 Time to stabilize - 387 cycles

Reset number 3 Time to stabilize - 387 cycles

Reset number 4 Time to stabilize - 387 cycles

Reset number 5 Time to stabilize - 387 cycles

Reset number 6 Time to stabilize - 387 cycles

Reset number 7 Time to stabilize - 387 cycles

Reset number 8 Time to stabilize - 387 cycles

Reset number 9 Time to stabilize - 387 cycles

Reset number 10 Time to stabilize - 387 cycles

Reset number 11 Time to stabilize - 387 cycles

Reset number 12 Time to stabilize - 387 cycles

Reset number 13 Time to stabilize - 387 cycles

Reset number 14 Time to stabilize - 387 cycles

Reset number 15 Time to stabilize - 387 cycles

Reset number 16 Time to stabilize - 387 cycles

Reset number 17 Time to stabilize - 387 cycles

Reset number 18 Time to stabilize - 387 cycles

Reset number 19 Time to stabilize - 387 cycles

Reset number 20 Time to stabilize - 387 cycles

Reset number 21 Time to stabilize - 387 cycles

Reset number 22 Time to stabilize - 387 cycles

Reset number 23 Time to stabilize - 387 cycles

Reset number 24 Time to stabilize - 387 cycles

Reset number 25 Time to stabilize - 387 cycles

Reset number 26 Time to stabilize - 387 cycles

Reset number 27 Time to stabilize - 387 cycles

Reset number 28 Time to stabilize - 387 cycles

Reset number 29 Time to stabilize - 387 cycles

Reset number 30 Time to stabilize - 387 cycles

Reset number 31 Time to stabilize - 387 cycles

Reset number 32 Time to stabilize - 387 cycles

Reset number 33 Time to stabilize - 387 cycles

Reset number 34 Time to stabilize - 387 cycles

Reset number 35 Time to stabilize - 387 cycles

Reset number 36 Time to stabilize - 387 cycles

Reset number 37 Time to stabilize - 387 cycles

Reset number 38 Time to stabilize - 387 cycles

Reset number 39 Time to stabilize - 387 cycles

Reset number 40 Time to stabilize - 387 cycles

Reset number 41 Time to stabilize - 387 cycles

Reset number 42 Time to stabilize - 387 cycles

Reset number 43 Time to stabilize - 387 cycles

Reset number 44 Time to stabilize - 387 cycles

Reset number 45 Time to stabilize - 387 cycles

Reset number 46 Time to stabilize - 387 cycles

Reset number 47 Time to stabilize - 387 cycles

Reset number 48 Time to stabilize - 387 cycles

Reset number 49 Time to stabilize - 387 cycles

Reset number 50 Time to stabilize - 387 cycles

Reset number 51 Time to stabilize - 387 cycles

Reset number 52 Time to stabilize - 387 cycles

Reset number 53 Time to stabilize - 387 cycles

Reset number 54 Time to stabilize - 387 cycles

Reset number 55 Time to stabilize - 387 cycles

Reset number 56 Time to stabilize - 387 cycles

Reset number 57 Time to stabilize - 387 cycles

Reset number 58 Time to stabilize - 387 cycles

Reset number 59 Time to stabilize - 387 cycles

Reset number 60 Time to stabilize - 387 cycles

Reset number 61 Time to stabilize - 387 cycles

Reset number 62 Time to stabilize - 387 cycles

Reset number 63 Time to stabilize - 387 cycles

Reset number 64 Time to stabilize - 387 cycles

Reset number 65 Time to stabilize - 387 cycles

Reset number 66 Time to stabilize - 387 cycles

Reset number 67 Time to stabilize - 387 cycles

Reset number 68 Time to stabilize - 387 cycles

Reset number 69 Time to stabilize - 387 cycles

Reset number 70 Time to stabilize - 387 cycles

Reset number 71 Time to stabilize - 387 cycles

Reset number 72 Time to stabilize - 387 cycles

Reset number 73 Time to stabilize - 387 cycles

Reset number 74 Time to stabilize - 387 cycles

Reset number 75 Time to stabilize - 387 cycles

Reset number 76 Time to stabilize - 387 cycles

Reset number 77 Time to stabilize - 387 cycles

Reset number 78 Time to stabilize - 387 cycles

Reset number 79 Time to stabilize - 387 cycles

Reset number 80 Time to stabilize - 387 cycles

Reset number 81 Time to stabilize - 387 cycles

Reset number 82 Time to stabilize - 387 cycles

Reset number 83 Time to stabilize - 387 cycles

Reset number 84 Time to stabilize - 387 cycles

Reset number 85 Time to stabilize - 387 cycles

Reset number 86 Time to stabilize - 387 cycles

Reset number 87 Time to stabilize - 387 cycles

Reset number 88 Time to stabilize - 387 cycles

Reset number 89 Time to stabilize - 387 cycles

Reset number 90 Time to stabilize - 387 cycles

Reset number 91 Time to stabilize - 387 cycles

Reset number 92 Time to stabilize - 387 cycles

Reset number 93 Time to stabilize - 387 cycles

Reset number 94 Time to stabilize - 387 cycles

Reset number 95 Time to stabilize - 387 cycles

Reset number 96 Time to stabilize - 387 cycles

Reset number 97 Time to stabilize - 387 cycles

Reset number 98 Time to stabilize - 387 cycles

Reset number 99 Time to stabilize - 387 cycles

Checking USB device communication.

Reset complete. Waiting for the first SOF...
Getting device descriptor
Descriptor Length: 12
Descriptor type: 01
USB version: 0200
Device class: 00
Device Subclass: 00
Device Protocol: 00
Max.packet size: 40
Vendor ID: 8564
Product ID: 1000
Revision ID: 0100
Mfg.string index: 01
Prod.string index: 02
Serial number index: 03
Number of conf.: 01

All tests passed. Press RESET to restart test

I can wire the GPins to the GPouts, if that test data is useful to you.
Thank you for all your help!
I'm sure I'll have more questions as I start to play. I want to read data from usb memory sticks for a client application.

@etherviz
Copy link

etherviz commented Mar 6, 2014

Oh, by the way it was SPI that had MOSI,MOSO,SCK. ICSP had MOSI2, MOSO2, & SCK2 in the same pin positions.

@Lauszus
Copy link
Collaborator

Lauszus commented Mar 6, 2014

@etherviz thanks! I will close this issue now then and merge it into master ;)

Ahh I get what you say, but I was not referring to the pin label. That type of connected is called an ICSP header, but anyway yes it is labeled SPI on the board.

Btw if you consider buying another USB Host shield, then please consider buying from either: http://www.circuitsathome.com/products-page/arduino-shields or http://shop.tkjelectronics.dk/product_info.php?products_id=43 to support the guys that have actually done the development.

@Lauszus Lauszus closed this as completed Mar 6, 2014
@Lauszus
Copy link
Collaborator

Lauszus commented Mar 6, 2014

Could you just confirm that it is still working after this commit: d8cadc5?

You will need to redownload the code from the Due branch: https://github.com/felis/USB_Host_Shield_2.0/archive/Due.zip.

@etherviz
Copy link

etherviz commented Mar 6, 2014

Yep, same results! Also, I already ordered to circuits@home board, to have as a backup.

@Lauszus
Copy link
Collaborator

Lauszus commented Mar 6, 2014

Okay great!

@LASKER17
Copy link

Hi, Lauszus, Can you help me?? i have arduino 1.
when I run the program board_qc, the serial monitor shows me this

Circuits At Home 2011
USB Host Shield Quality Control Routine
Reading REVISION register... Die revision 03
SPI long test. Transfers 1MB of data. Each dot is 64K
Test failed. Value written: 01 read: 00
Unrecoverable error - test halted!!
0x55 pattern is transmitted via SPI
Press RESET to restart test

@Lauszus
Copy link
Collaborator

Lauszus commented Nov 23, 2015

@LASKER17 what shield are you using?

@LASKER17
Copy link

Lauszus i'm using the arduino UNO
El 23/11/2015 05:01, "Kristian Sloth Lauszus" notifications@github.com
escribió:

@LASKER17 https://github.com/LASKER17 what shield are you using?


Reply to this email directly or view it on GitHub
#76 (comment)
.

@Lauszus
Copy link
Collaborator

Lauszus commented Nov 23, 2015

Okay, but what USB Host shield are you using? :)

@LASKER17
Copy link

I have this one
El 23/11/2015 07:12, "Kristian Sloth Lauszus" notifications@github.com
escribió:

Okay, but what USB Host shield are you using? :)


Reply to this email directly or view it on GitHub
#76 (comment)
.

@Lauszus
Copy link
Collaborator

Lauszus commented Nov 23, 2015

@LASKER17 you didn't send a link?

@LASKER17
Copy link

No, I sent a picture, but I have a usb host shield Keyes

@LASKER17 https://github.com/LASKER17 you didn't send a link?


Reply to this email directly or view it on GitHub
#76 (comment)
.

@Lauszus
Copy link
Collaborator

Lauszus commented Nov 24, 2015

If you want to attach a picture, you should attach it via the web GUI. Anyway please buy the official shield from either: http://shop.tkjelectronics.dk/product_info.php?products_id=43 or https://www.circuitsathome.com/products-page/arduino-shields, as there is all kind of weird issues with the Chinese clones.

@xxxajk
Copy link
Contributor

xxxajk commented Nov 24, 2015

Many other shields are UNO ONLY. You get what you pay for.
Buy one from circuitsathome. Circuitsathome UHS works on ALL arduino
variants without any problems.

On Tue, Nov 24, 2015 at 8:36 AM, Kristian Sloth Lauszus <
notifications@github.com> wrote:

If you want to attach a picture, you should attach it via the web GUI.
Anyway please buy the official shield from either:
http://shop.tkjelectronics.dk/product_info.php?products_id=43 or
https://www.circuitsathome.com/products-page/arduino-shields, as there is
all kind of weird issues with the Chinese clones.


Reply to this email directly or view it on GitHub
#76 (comment)
.

Visit my github for awesome Arduino code @ https://github.com/xxxajk

@Lauszus
Copy link
Collaborator

Lauszus commented Nov 24, 2015

And you will get support on top of that ;)

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

No branches or pull requests

5 participants