Add support for USB Host / CDC Devices based on FTDI chipsets (FT232)#7
Open
shreeve wants to merge 1 commit into
Open
Add support for USB Host / CDC Devices based on FTDI chipsets (FT232)#7shreeve wants to merge 1 commit into
shreeve wants to merge 1 commit into
Conversation
Author
|
Everything with this seems to be working as expected, except for the last bit, which is actually getting data back from the device. 😨 Here's some (sloppy) code I was using to try to read from this FTDI device, which should have properly been enumerated and setup, etc. int main()
{
Print("Launched\n");
UsbHostInit();
// wait for connection
while (!UsbCdcIsMounted())
{
Print("-");
WaitMs(100);
}
Print("UsbCdcIsMounted\n");
// print device descriptor
sUsbHostDev *cfg;
cfg = UsbHostGetDev(1);
Print("\r\nDevice Descriptor:\r\n");
Print(" idVendor 0x%04X\r\n", cfg->vendor);
Print(" idProduct 0x%04X\r\n", cfg->product);
Print(" Vendor 0x%02X\r\n", cfg->i_manufact);
Print(" Product 0x%02X\r\n", cfg->i_product);
Print(" Serial 0x%02X\r\n", cfg->i_serial);
Print(" bMaxPacketSize 0x%02X\r\n", cfg->pktmax);
// main loop
u8 i = 0;
char ch;
while (True)
{
if ((++i % 100) == 0) {
while (!UsbCdcWriteReady()) {
WaitMs(100);
Print("!");
}
if (!UsbCdcWriteChar(0x06)) {
Print("N"); // NAK
} else {
Print("K"); // ACK
}
}
WaitMs(100);
if (UsbCdcIsMounted()) {
while (ch = UsbCdcReadChar()) {
Print("%02X\n", ch);
}
Print(".");
} else {
Print("-");
}
}
}The output looks like this: Any thoughts on this? |
Owner
|
Sorry I can't help, I don't know much about USB interface anymore (see email). :-( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR is not intended to be merged, but rather to review to see if support can be enabled for USB Host / CDC Devices based on FTDI chipsets (FT232).
I am communicating with the Raspberry Pi Pico W through its UART.
The Pico is connected to a USB Device that internally uses an FT232 chip. This is essentially a USB CDC class device, but it presents itself as a device with a class of 0x00 and subclass of 0x00, which aren't valid.
As a result, in this PR, instead of calling
UsbHostCdcOpen, I have a new method calledUsbHostCdcOpenFTDI, which just creates one interface and a pair of endpoints.In addition, instead of calling
UsbHostCdcCfg, I have a new method calledUsbHostCdcCfgFTDIwhich does three things:In addition, I added a little echo support to show if you type characters in the UART as well as small logging messages to track the progress.
This code is an initial effort to communicate with these FTDI based devices (millions exist in the world).
I think everything here should work, but it's still not 100% there. I think it's REALLY close though...
Any ideas to get it running? @Panda381 - is this the general idea? Is it close?
Thanks!