Skip to content
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

FT231X Serial-to-USB not working #432

Open
NuclearPhoenixx opened this issue Jan 25, 2025 · 13 comments
Open

FT231X Serial-to-USB not working #432

NuclearPhoenixx opened this issue Jan 25, 2025 · 13 comments
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@NuclearPhoenixx
Copy link
Member

The disadvantage of working with WebUSB is that you can't directly connect to a serial device, so you need a Serial-to-USB chip. AFAIR we added support for all FTDI chips in that regard.

I noticed i had a spare FTDI FT231X board laying around, so i tried using that but i am still running into issues. Currently im using an ESP Wroom 32 with said Serial to USB chip. The Esp is just running very simple test code:

Image

Connecting the ESP via the FTDI chip it works without any problems on PC and i can see all the data comin in correctly on a serial monitor on mobile.

Image

But when i connect it to the Gamma MCA app, it shows up correctly under the serial devices. But as soon as i start recording, it sometimes works for like a second and then just stopps. There is then no new data coming in on the Gamma MCA console. But when i check it again without doing anything in the app, the data is still coming correctly. Im not sure if this is an issue with Gamma MCA or just with something im doing wrong, but any help would be appreciated.

Originally posted by @pyrogcode in #431

@NuclearPhoenixx NuclearPhoenixx self-assigned this Jan 25, 2025
@NuclearPhoenixx
Copy link
Member Author

That's weird. The code you posted looks okay. Must be a problem with the FTDI chip itself, or something related.

Can you please open the developer console and post its contents? That'll help a lot. Hotkey CTRL + SHIFT + J.

@pyrogcode
Copy link

I also get the same issue using the TTL-232R, how do i open the developer console on mobile?

@NuclearPhoenixx
Copy link
Member Author

Oof, I think you actually can't on mobile.
From what I can remember, I was using an FT232 for testing the feature back then.
You could try and connect the thing on your desktop. That'll use WebSerial, but at least it will tell us if it's something with the WebUSB workaround specifically or not.

@pyrogcode
Copy link

It works fine on desktop, i let it run for one hour and i had no issues with it. Is there a way to disable web serial on pc so it would use webusb, that way we could rule out android as the issue. Maybe a browser that only supports webusb?

@NuclearPhoenixx
Copy link
Member Author

Okay then it's clearly some weird stuff with the WebUSB library we're using.

https://github.com/Shaped/webusb-ftdi

Under Windows, if any FTDI driver has been installed, you can use zadig to switch to the WinUSB driver in order for the browser to be able to access the USB device. This will prevent the device from being used as a serial (COM) port until you've switched the driver back.

Basically: Install Zadig (https://zadig.akeo.ie/) and switch to the WinUSB driver for your FTDI device.

@pyrogcode
Copy link

Im sorry, i have never done anything like this with drivers, could you please walk me through the process so i can further test the issue?

@NuclearPhoenixx
Copy link
Member Author

It should be as easy as downloading the executable, selecting your respective FTDI device in the selector and then at the driver section switch to "WinUSB".

Image

I never actually did that myself, but it should be easy enough.

@pyrogcode
Copy link

I tried connecting the device to every possible usb port, closed all apps that might be using the device and reconnected it a couple times but it jist doesnt show up...

Image

@NuclearPhoenixx
Copy link
Member Author

Ok, then maybe you have to install the official drivers first: https://ftdichip.com/drivers/ 🤔

@pyrogcode
Copy link

pyrogcode commented Jan 25, 2025

Installed the drivers, restarted everything a couple times but its still not showing up in Zadig. Is there anything else i could test instead?

@NuclearPhoenixx
Copy link
Member Author

Hm, sorry for not being more helpful. There's one last thing that comes to my mind: using remote debugging on your phone with your desktop.

https://stackoverflow.com/questions/37256331/is-it-possible-to-open-developer-tools-console-in-chrome-on-android-phone

@pyrogcode
Copy link

pyrogcode commented Jan 25, 2025

console-1737839799892.log

Due to me not having the right adapters to connect both my phone to my pc and the esp to the phone at the same time, the best i can do is connect the esp to the website try to start a recording, stop it and then connect it for debugging to my pc. This is what i got in the developer console from it:

Image

@NuclearPhoenixx
Copy link
Member Author

NuclearPhoenixx commented Jan 26, 2025

Yes that helps I think. If the error is something to go by, the issue occurs when opening the WebUSB serial, i.e. connecting to the device. It looks like an issue with the library when it tries to read data for the first time?

https://github.com/Shaped/webusb-ftdi/blob/028edd9a35506f99d48d6f01de04e4c1edc42d4b/webusb-ftdi.js#L618

Maybe it's even related to this issue here: Shaped/webusb-ftdi#2

Not sure what to make of it if I'm 100% accurate. I'm flagging this as help wanted for the time being.
From what you mentioned you tried pretty much everything and the same problem occurs for every FTDI device you tried using, which makes me wonder if some things in the browser changed to break the lib.

I'm going to see if there are any better alternatives before I'll patch up the 3-year-old code.

@NuclearPhoenixx NuclearPhoenixx added bug Something isn't working help wanted Extra attention is needed labels Jan 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Development

No branches or pull requests

2 participants