-
Notifications
You must be signed in to change notification settings - Fork 1.7k
USB: USB_Host_Shield_2.0
hasu@tmk edited this page Nov 24, 2021
·
6 revisions
- Hub with
parent = 0is assigned to 0x41.portis not used. - Device with
parent = 0is assigned to 0x01.portis not used. - Hub with
parent != 0is assigned usinghubCounter.portis not used. - Device with
parent != 0is assigned usingport.
address.h:
virtual uint8_t AllocAddress(uint8_t parent, bool is_hub = false, uint8_t port = 0)
UsbDeviceAddress:
struct UsbDeviceAddress {
union {
struct {
uint8_t bmAddress : 3; // device address/port number
uint8_t bmParent : 3; // parent hub address
uint8_t bmHub : 1; // hub flag
uint8_t bmReserved : 1; // reserved, must be zero
} __attribute__((packed));
uint8_t devAddress;
};
} __attribute__((packed));
bit ____________________________ Reserved(0)
/ _________________________ Hub flag(bmHub)
/ / ______________________ Parent Hub no(bmParent)
/ / / / / ___________ Hub no or Port no(bmAddress)
/ / / / / / / /
7 6 5 4 3 2 1 0
-----------------------------
0 0 0 0 0 0 0 0 00 Default Address
0 0 0 0 0 0 0 1 01 Device directly attached on Host Controller
0 1 0 0 0 0 0 1 41 Hub 1 directly attached to Host Controller
0 1 0 0 1 0 1 0 4A Hub 2 on Hub 1
0 1 0 0 1 0 1 1 4B Hub 3 on Hub 1
0 1 0 1 0 0 1 1 53 Hub 3 on Hub 2
0 0 0 0 1 0 0 1 09 Device on Port 1 of Hub 1(Root Hub)
0 0 0 0 1 0 1 0 0A Device on Port 2 of Hub 1(Root Hub)
0 0 0 1 0 0 0 1 11 Device on Port 1 of Hub 2
0 0 0 1 0 0 1 0 12 Device on Port 2 of Hub 2
MAX3421E error codes:
/* Host error result codes, the 4 LSB's in the HRSL register */
#define hrSUCCESS 0x00
#define hrBUSY 0x01
#define hrBADREQ 0x02
#define hrUNDEF 0x03
#define hrNAK 0x04
#define hrSTALL 0x05
#define hrTOGERR 0x06
#define hrWRONGPID 0x07
#define hrBADBC 0x08
#define hrPIDERR 0x09
#define hrPKTERR 0x0A
#define hrCRCERR 0x0B
#define hrKERR 0x0C
#define hrJERR 0x0D
#define hrTIMEOUT 0x0E
#define hrBABBLE 0x0F