###TL;DR
TL;DR
###Nitty-gritty
Nitty-gritty
###Footnote
Footnote
###TL;DR
###Nitty-gritty
###Footnote
TL;DR
Nitty-gritty
Footnote
- 3.2k
- 7
- 36
- 48
- Is
usbhost.h
Which is the correct file to modify the Arduino pin used for the USB Host slave select (SS) line? - Why does the pin definition of select, for the Mega, appear to be pin 53?
I would like to add USB host functionality, to a particular Arduino setup, whilst, also, being able to use an Ethernet/SD (or just SD) shield.
- "Hardwiring in""Hardcoding" a different "select" pin number into a header file;
- Adding an argument to the
Init()
method, or; - Adding a method to the
USB
class, such asUsb.DefineSelect()
.
The latter two options, I could work through, given the time. However, as a quick and dirty hack, where would I hardwirehardcode in a change from pin 10 to a pin of my choosing? Does anyone know? Has anyone had to do this?
- Is
usbhost.h
the correct file to modify the pin used for the USB select line? - Why does the pin definition of select, for the Mega, appear to be pin 53?
I would like to add USB host functionality, to a particular Arduino setup, whilst being able to use an Ethernet/SD (or just SD) shield.
- "Hardwiring in" a different "select" pin number into a header file;
- Adding an argument to the
Init()
method, or; - Adding a method to the
USB
class, such asUsb.DefineSelect()
.
The latter two options, I could work through, given the time. However, as a quick and dirty hack, where would I hardwire in a change from pin 10 to a pin of my choosing? Does anyone know? Has anyone had to do this?
- Which is the correct file to modify the Arduino pin used for the USB Host slave select (SS) line?
I would like to add USB host functionality, to a particular Arduino setup, whilst, also, being able to use an Ethernet/SD (or just SD) shield.
- "Hardcoding" a different "select" pin number into a header file;
- Adding an argument to the
Init()
method, or; - Adding a method to the
USB
class, such asUsb.DefineSelect()
.
The latter two options, I could work through, given the time. However, as a quick and dirty hack, where would I hardcode in a change from pin 10 to a pin of my choosing? Does anyone know? Has anyone had to do this?
Looking at thetypedef SPi< Pb5, Pb3, Pb4, Pb2 > spi;
statement,
typedef SPi< Pb5, Pb3, Pb4, Pb2 > spi;
the last argument appears to be the pin used for select. For the Uno (ATmega328P), in avrpins.h (line 535) Pb2
is P10
(pin 10), so I could substitute Pb2
for some other pin definition, i.e. Pd5
for P5
(pin 5) (line 529 in avrpins.h).
However, what I don't understand is that for the statement
typedef SPi< Pb1, Pb2, Pb3, Pb0 > spi;
which deals with the Mega (ATmega2560), in avrpins.h (line 512) Pb0
is P53
, but (pin 53). As P10Pb4
is actually Pb4P10
(pin 10) (line 466)., why is Pb0
en lieu of Pb4
used? That doesn't tie up with the fact that Pin 10 is used for both the Uno and Mega boards. It seems to suggest the pin 10 is used on the Uno and pin 53 is used on the Mega. Unless I have misinterpreted the typedef
.
1From For the USB host shield, from Arduino USB Host Shield
FromThe key piece of information here is that pin 10 is used by both the Uno and Mega boards.
For the Ethernet shield, from Arduino Ethernet Shield V2
Here, yet again, the key piece of information here is that pin 10 is used by both the Uno and Mega boards to select the Ethernet.
Looking at thetypedef SPi< Pb5, Pb3, Pb4, Pb2 > spi;
statement, the last argument appears to be the pin used for select. For the Uno (ATmega328P), in avrpins.h (line 535) Pb2
is P10
(pin 10), so I could substitute Pb2
for some other pin definition, i.e. Pd5
for P5
(pin 5) (line 529 in avrpins.h).
However, what I don't understand is that for the Mega (ATmega2560), in avrpins.h (line 512) Pb0
is P53
, but P10
is Pb4
(line 466). That doesn't tie up with the fact that Pin 10 is used for both the Uno and Mega boards. Unless I have misinterpreted the typedef
.
1From Arduino USB Host Shield
Looking at the statement
typedef SPi< Pb5, Pb3, Pb4, Pb2 > spi;
the last argument appears to be the pin used for select. For the Uno (ATmega328P), in avrpins.h (line 535) Pb2
is P10
(pin 10), so I could substitute Pb2
for some other pin definition, i.e. Pd5
for P5
(pin 5) (line 529 in avrpins.h).
However, what I don't understand is that for the statement
typedef SPi< Pb1, Pb2, Pb3, Pb0 > spi;
which deals with the Mega (ATmega2560), in avrpins.h (line 512) Pb0
is P53
(pin 53). As Pb4
is actually P10
(pin 10) (line 466), why is Pb0
en lieu of Pb4
used? That doesn't tie up with the fact that Pin 10 is used for both the Uno and Mega boards. It seems to suggest the pin 10 is used on the Uno and pin 53 is used on the Mega. Unless I have misinterpreted the typedef
.
1 For the USB host shield, from Arduino USB Host Shield
The key piece of information here is that pin 10 is used by both the Uno and Mega boards.
For the Ethernet shield, from Arduino Ethernet Shield V2
Here, yet again, the key piece of information here is that pin 10 is used by both the Uno and Mega boards to select the Ethernet.