Skip to content

Add support for Sparkfun Artemis Redboard #654

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

Closed
wants to merge 15 commits into from
Closed

Add support for Sparkfun Artemis Redboard #654

wants to merge 15 commits into from

Conversation

Topo-png
Copy link

@Topo-png Topo-png commented Aug 9, 2021

I've attempted to implement the changes required to support the Sparkfun Artemis Reboard. I'm hung up trying to debug the following.

In file included from C:\Users\1\Arduino\libraries\USB_Host_Shield_Library_2.0/Usb.h:43,
                 from C:\Users\1\Arduino\libraries\USB_Host_Shield_Library_2.0/XBOXONE.h:26,
                 from C:\Users\user1\AppData\Local\Temp\arduino_modified_sketch_523678\XBOXONE.ino:15:
C:\Users\1\Arduino\libraries\USB_Host_Shield_Library_2.0/usbhost.h:126:25: error: type/value mismatch at argument 1 in template parameter list for 'template<class SPI_CLK, class SPI_MOSI, class SPI_MISO, class SPI_SS> class SPi'
 typedef SPi< 5, 7, 6, 13> spi;
                         ^
C:\Users\1\Arduino\libraries\USB_Host_Shield_Library_2.0/usbhost.h:126:25: note:   expected a type, got '5'
C:\Users\1\Arduino\libraries\USB_Host_Shield_Library_2.0/usbhost.h:126:25: error: type/value mismatch at argument 2 in template parameter list for 'template<class SPI_CLK, class SPI_MOSI, class SPI_MISO, class SPI_SS> class SPi'
C:\Users\1\Arduino\libraries\USB_Host_Shield_Library_2.0/usbhost.h:126:25: note:   expected a type, got '7'
C:\Users\1\Arduino\libraries\USB_Host_Shield_Library_2.0/usbhost.h:126:25: error: type/value mismatch at argument 3 in template parameter list for 'template<class SPI_CLK, class SPI_MOSI, class SPI_MISO, class SPI_SS> class SPi'
C:\Users\1\Arduino\libraries\USB_Host_Shield_Library_2.0/usbhost.h:126:25: note:   expected a type, got '6'
C:\Users\1\Arduino\libraries\USB_Host_Shield_Library_2.0/usbhost.h:126:25: error: type/value mismatch at argument 4 in template parameter list for 'template<class SPI_CLK, class SPI_MOSI, class SPI_MISO, class SPI_SS> class SPi'
C:\Users\1\Arduino\libraries\USB_Host_Shield_Library_2.0/usbhost.h:126:25: note:   expected a type, got '13'
C:\Users\1\Arduino\libraries\USB_Host_Shield_Library_2.0/usbhost.h: In member function 'int8_t MAX3421e<SPI_SS, INTR>::Init()':
C:\Users\1\Arduino\libraries\USB_Host_Shield_Library_2.0/usbhost.h:434:18: error: qualified-id in declaration before '(' token
         spi::init();
                  ^
C:\Users\1\Arduino\libraries\USB_Host_Shield_Library_2.0/usbhost.h: In member function 'int8_t MAX3421e<SPI_SS, INTR>::Init(int)':

C:\Users\1\Arduino\libraries\USB_Host_Shield_Library_2.0/usbhost.h:471:18: error: qualified-id in declaration before '(' token
         spi::init();
                  ^
In file included from C:\Users\1\Arduino\libraries\USB_Host_Shield_Library_2.0/Usb.h:44,
                 from C:\Users\1\Arduino\libraries\USB_Host_Shield_Library_2.0/XBOXONE.h:26,
                 from C:\Users\user1\AppData\Local\Temp\arduino_modified_sketch_523678\XBOXONE.ino:15:
C:\Users\1\Arduino\libraries\USB_Host_Shield_Library_2.0/UsbCore.h: At global scope:
C:\Users\1\Arduino\libraries\USB_Host_Shield_Library_2.0/UsbCore.h:212:29: error: expected class-name before '{' token
 class USB : public MAX3421E {
                             ^
Using library SPI at version 1.0 in folder: C:\Users\user1\AppData\Local\Arduino15\packages\SparkFun\hardware\apollo3\1.2.1\libraries\SPI 

Using library USB_Host_Shield_Library_2.0 at version 1.6.0 in folder: C:\Users\1\Arduino\libraries\USB_Host_Shield_Library_2.0 

exit status 1

Error compiling for board SparkFun RedBoard Artemis ATP.

Changes per #654. 

Builds successfully for Sparkfun Redboar Artemis ATP
formating fix
@Topo-png
Copy link
Author

Topo-png commented Aug 9, 2021

It looks to build successfully on my machine @Lauszus. Thanks for the guidance. This PR was my first and also my first real attempt at using Git.

update to include #undef MAKE_PIN for new SF board
updated formatting
updated formatting
@Lauszus
Copy link
Collaborator

Lauszus commented Aug 15, 2021

All looks good now. Have you confirmed that the library now works with the board?

@Topo-png
Copy link
Author

I'm waiting for a new USB host shield to arrive. Examples build properly. I will hopefully be able to report functionality later this week.

@Lauszus
Copy link
Collaborator

Lauszus commented Aug 16, 2021

@Topo-png thanks. I'll squash and merge the commits once you have verified that it is actually working with the board :)

@Topo-png
Copy link
Author

Topo-png commented Aug 21, 2021

I loaded the XBOXONE example to the board for testing.
Serial Log reports back
OSC did not start

I went and reflowed the pins and loaded the board_qc program.
Serial Log reports back
Circuits At Home 2011 USB Host Shield Quality Control Routine Reading REVISION register... Die revision invalid. Value returned: 00 Unrecoverable error - test halted!! 0x55 pattern is transmitted via SPI Press RESET to restart test

@xxxajk
Copy link
Contributor

xxxajk commented Aug 21, 2021

Use shorter wires for SPI. :-)

@Topo-png
Copy link
Author

Topo-png commented Aug 21, 2021

@xxxajk - this is a shield directly connected to header pins, no long wires other than the PCB traces.

I modified the pins to match what I believe is the correct pinout. Using Pin Out and this image
image

I used the blink sketch to flash each pin independently to verify the proper pinout (SCK, MOSI, MISO, INT, SS). I also cross-referenced the standard Arduino pinout to the new Redboard pinout. (see above image, small black text offset to the left in the red rectangle).

in ushbost.h
#elif defined(AM_PART_APOLLO3)
typedef SPi< P5, P7, P6, P13 > spi;

in usbcore.h
#elif defined(AM_PART_APOLLO3)
typedef MAX3421e<P13, P12> MAX3421E; // ATP

Board_qc now outputs the following
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

@xxxajk
Copy link
Contributor

xxxajk commented Aug 21, 2021

Slow down the SPI, going at maximum rated rate with some SPI causes issues. This was noted before on Atmel's SAMD ARM, where it's SPI didn't clock the bit in at the correct point, and would miss or hit it in transition.
What speed are you currently using?

@Topo-png
Copy link
Author

I haven't changed any SPI speeds. How do I slow this down?

@Topo-png
Copy link
Author

Thanks, I reduced those down to 260000 and I still didn't have any luck. The errors take noticeably longer to report so I believe this is working properly.

@xxxajk
Copy link
Contributor

xxxajk commented Aug 21, 2021

Try the following:
12000000
10000000
8000000

If you can't get it working at less than 8MHz, then something else is wrong.
Running the shield on 3.3v? Because 5V will fry the SPI... Unless the board can take 5v.

@xxxajk
Copy link
Contributor

xxxajk commented Aug 21, 2021

One other note, is that the official shields, use the ICSP header for SPI. Just sayin'...

updated pinouts for sparkfun redboard
updated pinouts for Sparkfun redboard ATP
@Topo-png Topo-png closed this by deleting the head repository Sep 24, 2022
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

Successfully merging this pull request may close these issues.

3 participants