Jark / FTDISample

Note: As of version 10556.0 the ftdi driver does no longer seem to work. A sample application showcasing the FTDI D2XX driver use in Windows Universal projects (UWP). This sample is tested on the Raspberry PI 2 with Windows IOT installed and a FTDI FT232R usb-to-serial adapter.
Apache License 2.0
22 stars 3 forks source link

not working with Windows 10 IoT Core 10.0.10586.63? #9

Open hellthorne opened 8 years ago

hellthorne commented 8 years ago

Hi there.

I recently updated my raspberry pi 2 to Win10 IoT 10.0.10586.63, and I noticed that my FTDI driver based code is no longer working. Specifically, calls to FTManager.GetDeviceList() returns a list of size 0. I have a device watcher timer in my code, similar to your sample, but it never seems to enumerate any devices. As a sanity check, i ran your sample and I see the same results - no devices.

When I run the dreadful SerialDevice code that Microsoft provides, it does enumerate the FTDI device, and after much struggling I can make the device work, but the performance is dismal.

I would much rather use the FTDI driver solution than the native Microsoft SerialDevice. Are you seeing the same thing with the latest IoT release? is there a known workaround?

ghost commented 8 years ago

Hi. The native FTDI (WinRT) works fine in Headed mode (only). Be sure you also have the entries in the application metadata file. The Microsoft serial driver works OK for me too, also in headless, but I do not have high bandwidth et. al. requirements for this serial interface.

hellthorne commented 8 years ago

My application is headed, and i also tried out the sample app that Jark provided. It does not detect any devices. i am using the absolute latest version of Win10 IoT Core (theimage on the SD card plus the windows update download). Have the FTDI drivers been updated? When I flashed my SD card, i applied the drivers from a couple of months ago.

Jark commented 8 years ago

Hi,

Have you restarted the device after installing the FTDI drivers? That's the only thing I can think of that could be a problem.

Haven't done any testing with the latest Windows IOT build since my RaspberryPI 2 is currently running Raspbian and mono :)

Out of interest, can you show me the code you're using to access the serial port using the SerialDevice api? Maybe there's a way to get some more performance out of it.

Jark commented 8 years ago

I've added the ability to switch between the ftdi drivers and the SerialDevice api to the sample app. To use the windows SerialDevice api uncomment / comment the desired lines in: https://github.com/Jark/FTDISample/blob/master/src/FTDISample/MainPage.xaml.cs#L17.

https://github.com/Jark/FTDISample/blob/master/src/FTDISample/Serial/SerialDevice.cs contains the WriteAsync / ReadAsync methods, in what I believe to be the fastest way to read them.

Unfortunately I haven't been able to test this code as I don't have a usb-to-serial adapter handy, but it should work or be able to make workable without too many changes. Hopefully this helps.

hellthorne commented 8 years ago

I tried restarting the device, removing the drivers, reinstalling the driver and then restarting with no luck. FtManager.GetDeviceList always returns 0 devices. I have this Sparkfun FTDI basic breakout attached (https://www.sparkfun.com/products/9716) When I run devcon status, I get 1 matching device found, and like I said, if I use the microsoft API, I can access the device.

I am trying to use an arduino based speedometer that I talk to over the ftdi serial device. The arduino based speedometer sends one sample every time it receives an arbitrary byte from the RPi2. When I was using the ftdi driver/ftmanager, i was able to get 30 - 60 samples per second. However, since having to switch to the microsoft api, i am only getting about 5 samples per second. Also a lot of time, the readAsync task waits forever. In general, the Microsoft API is slow and/or intermittently locks up..

Unfortunately I don't have my code samples to share right now, but I can try to attach some later today or tomorrow.

Do you have any advice on how to get the ftdi drivers working again?

hellthorne commented 8 years ago

Well, after a few days of trying in my spare time, I have been able to get acceptable performance out of the Microsoft API. I built and ran your sample and am still not able to get the ftdi api to detect any devices, but the sample does detect devices with the microsoft api. it looks like the latest version of IoT has broken the ftdi library support.

I don't consider this issue closed since the ftdi api doesn't work, but I am not sure what else can be done. Since I can get what I need from the microsoft api now, I will probably abandon the ftdi library, which is a shame since it still had better performance and was easier to use.

alamethane commented 8 years ago

Hello, I have been trying to upload your drivers to the Raspberry Pi 2 Model B for a few days. I always face the same error. These are steps I am following:

Hoping to hear your solutions for the problem I faced. Love y'all!

Jark commented 8 years ago

Hi,

Hellthorne: I know, it's a sad state of affairs. I'll edit the README.md to reflect that the drivers currently do not work on the current build of Windows IOT.

Alamethane: Just a clarification: the drivers are not mine, they're FTDI's and downloaded from FTDI's site. The support I can give is quite limited as I'm working with the same information that you have.

From what hellthorne has mentioned on this thread it's becoming quite clear that the drivers no longer work on Windows IOT (even though they should). The recommendation is to use the microsoft API's for now (since they're the only ones that work).

If you comment/uncomment out the lines MainPage.xaml.cs#L17 you can switch the demo app to work with the packaged FTDI drivers. No manual setup required.

If you're just interested to see how you can write to a serial port, SerialDevice.cs is a good place to start.

Hope this helps you out.

hellthorne commented 8 years ago

Alamethane - how are you saving the driver files? I had the same "native command error" problem but at the time I tried right click - save as, and my browser saved the text of the driver files with html formatting. Open both the cat and the inf file with notepad and see if you find any html in there. If so, you'll need to download the drivers using a git client or from the download zip link.

alamethane commented 8 years ago

Hey again,

Jark: I downloaded the drivers from your zip file, not from the link you have shared. The problem of hellthorne's is also my problem. I use and FTDI-USB XBee Explorer Dongle from Sparkfun. I used different libraries but it did not work. So I downloaded these drivers you shared but I could not run devcon.exe line as I told before. After writing this previous comment, I found a solution regarding this problem in the linkhttp://embedded101.com/Blogs/David-Jones/entryid/666/win-10-iot-core-ftdi-serial-driver . I tried the solutin exactly but it also did not work out. How can I find windows API's driver? Thanks for your big effort regarding this issue.

hellthorne: I could not copy the files from MS-DOS nor Powershell. So I just placed micro SD card and copied the two files directly into system32 folder. What I could not understand is after copying files, Windows IOT screen on Raspberry have a different "reparing files ..." subtitle while starting. Maybe this situation is removing the files temporarily from the system32 folder. But I created a temp folder as it is suggested on the link I have shared, but I could not succeed again. The files are rightly formatted so I guess I have no problem with that.

Greets,

Jark commented 8 years ago

Hi Alamethane,

The drivers in the repository are the same as FTDI's. I have not written the drivers so I can't give support on them.

See towards the end my previous post for an example how you can use the included FTDI driver. Since it's included no installation is necessary.

Hope this helps.

Jark