I’m trying to interface the USB host shield through Arduino UNO ’s spi interface without the library since it’s missing support for many functions and I would like to have more control.
I’m using the shield(that is based on a max3421e chip) as a USB host, so I could connect any peripheral, for instance keyboard) and I’m trying to read the result of a get descriptor setup packet, which is higher than 64.
I’m initialising the usb host in full duplex spi mode, as host. I’m able to receive the first 64 bytes after a single ISO IN transfer from address 0, endpoint 0(first request to the peripheral device during enumeration, before set address is issued) However, no matter what I do I can’t get the RCVFIFO double register to actually work so I could read the full length of the response payload.
According to the MAX3421E datasheet, the chip does support reading response payloads up to the limit of USB specifications which is much higher than 64.
So what could I be missing?
how do you read those bytes?
According to the MAX3421E programming guide, when I write a value that stands for the ISO IN token, to the HXFR register, it initiates an ISO IN transfer. Then I wait until reading the register HIRQ with the proper bitmask yields true to indicate the transfer is done,
Afterwards I get the result response code from the HRSL register to verify the transfer had no errors.
Basically after that I can read the bytes from the RCVFIFO register.
the FIFO register 64 bytes deep (see datasheet )
You don't want "transfer is done" if you have more than 64 bytes.
are you using the Receive FIFO IRQ flag?
Im waiting until the HXFRDNIRQ bit from HIRQ register is high before I read any data
that would mean the Host Transfer is done. If it were more than 64 bits you lost some since that's the size of the buffer.
Long time since I did not look at the details but if I remember you can configure the MAX3421E to generate an interrupt when data is available in the receive FIFO buffer (enable the RCVDAVIRQ interrupt in the HXFRDNIRQ register) and that's when you extract the data
Even if I use this interrupt when I read the amounts of bytes to read it’s always 0 after I read the first 64 bytes.
I am just on my iPhone at the moment - I don’t remember if there was a way to know the length of the data in the FIFO buffer
Reading the RCVBC buffer gives the byte count
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.