chipKIT32 / chipKIT32-MAX

Multi-platform IDE derived version from Arduino 0022 for the chipKit.
http://chipkit.net
Other
108 stars 76 forks source link

USB Serial on XP Embedded #466

Closed mskoczen closed 9 years ago

mskoczen commented 10 years ago

Between version 20130715 and 20140316 the USB Serial broke on XP Embedded Windows. I tested this with a Quick240, Fubarino SD, and another chipkit compatible board that all use USB Serial from the chip.

EmbeddedMan commented 10 years ago

What are the symptoms of the failure? Can you describe your testing procedure?

On Thu, May 29, 2014 at 1:38 PM, mskoczen notifications@github.com wrote:

Between version 20130715 and 20140316 the USB Serial broke on XP Embedded Windows. I tested this with a Quick240 and another chipkit compatible board.

— Reply to this email directly or view it on GitHubhttps://github.com/chipKIT32/chipKIT32-MAX/issues/466 .

mskoczen commented 10 years ago

I uploaded the same sketch to the board with the two different versions of Mpide. Then plugged them into the computer running XP Embedded. XP Embedded needed two files mdmcpq.inf, and usbser.sys for the Chipkit USB Serial driver to work. The old version will connect after the files and driver are added. The new version says "Found New Hardware a problem occurred during hardware installation" and nothing shows up in the Device manager.

//sketch I used for testing void setup() { Serial.begin(115200); } void loop() { Serial.println("I am here."); delay(2000); }

On Thu, May 29, 2014 at 11:45 AM, Brian Schmalz notifications@github.comwrote:

What are the symptoms of the failure? Can you describe your testing procedure?

On Thu, May 29, 2014 at 1:38 PM, mskoczen notifications@github.com wrote:

Between version 20130715 and 20140316 the USB Serial broke on XP Embedded Windows. I tested this with a Quick240 and another chipkit compatible board.

— Reply to this email directly or view it on GitHub< https://github.com/chipKIT32/chipKIT32-MAX/issues/466> .

— Reply to this email directly or view it on GitHubhttps://github.com/chipKIT32/chipKIT32-MAX/issues/466#issuecomment-44568756 .

EmbeddedMan commented 10 years ago

I have reproduced this problem. But something strange is going on. It doesn't seem to be consistent for me. Investigating further.

EmbeddedMan commented 10 years ago

Here are my first test results: I tried using the following sketch, which allows me to see if the sketch is running, and if the USB serial port is functioning.

void setup() { pinMode(PIN_LED1, OUTPUT);
Serial.begin(115200); } void loop() { Serial.println("I am here."); digitalWrite(PIN_LED1, HIGH); // set the LED on delay(1000); // wait for a second digitalWrite(PIN_LED1, LOW); // set the LED off delay(1000); // wait for a second }

Here are the results: 20130724 : everything works 20130817 : everything works 20131118 : everything works 20140112 : LED blinks, USB not working 20140121 : everything works 20140220 : everything works 20140307 : everything works 20140316 : everything works 20140407 : no LED, no USB 20140417 : everything works 20140421 : no LED, no USB 20140502 : no LED, no USB 20140511 : no LED, no USB 20140518 : no LED, no USB 20140528 : no LED, no USB

Next step : what the heck is different?

EmbeddedMan commented 10 years ago

The big difference between the 20140417 and 20140421 is the addition of Keith's MZ changes, including the new compiler.

EmbeddedMan commented 10 years ago

So I think I have some of it figured out. In 20140316, we just have the 'old' compiler. Then in 20140407 we added the MZ compiler as a first attempt. That broke USB serial. Then we took it out for 20140417, and things worked again. Then we added it back in for 20140421 and after, and things broke again.

There's something about the new MZ compiler, or some of the changes that came with it, that is causing our sketch not to run at all. The thing is, there are tons of files that have changed, so its impossible to just look at the changed files to see where the problem is.

I'm still looking into the 20140112 version and why USB doesn't work but the sketch runs.

mskoczen commented 10 years ago

Thank you for your efforts so far.

EmbeddedMan commented 10 years ago

I believe this is now fixed in the latest test build (20140531) of MPIDE. If it is not, please re-open the issue.

mskoczen commented 10 years ago

I will download and test on Monday. On Jun 1, 2014 8:34 AM, "Brian Schmalz" notifications@github.com wrote:

I believe this is now fixed in the latest test build (20140531) of MPIDE. If it is not, please re-open the issue.

— Reply to this email directly or view it on GitHub https://github.com/chipKIT32/chipKIT32-MAX/issues/466#issuecomment-44780522 .

mskoczen commented 10 years ago

Just tested this with 20140531 and it is still an issue. The code works as expected on my Windows 7 computer but on the XP Embedded computer the USB port is still not recognized.

EmbeddedMan commented 10 years ago

Aww, drat. That's a big stinker. I don't have an XP Embedded machine that I can test on. I'm actually really surprised by this result - the fix that we put in wasn't in any way specific to a particular OS. I wonder if there isn't something else going on entirely with the XP Embedded system.

What's the easiest way to get my hands on an XP Embedded system to test with? Is there a way you could create a VM of it that you could share with me?

*Brian

On Mon, Jun 2, 2014 at 11:44 AM, mskoczen notifications@github.com wrote:

Just tested this with 20140531 and it is still an issue. The code works as expected on my Windows 7 computer but on the XP Embedded computer the USB port is still not recognized.

— Reply to this email directly or view it on GitHub https://github.com/chipKIT32/chipKIT32-MAX/issues/466#issuecomment-44861313 .

EmbeddedMan commented 10 years ago

OK, another question. When you get the error on your XP Embedded system (indicating that the PC can't connect to the chipKIT over USB), is the sketch running on the chipKIT board, or is it hung? You can add a blinking light code to your sketch to find out.

mskoczen commented 10 years ago

I added the blinking light as you suggested and the light continued to blink even though the USB post was not working. I just used external power on the board and moved the USB connection back and forth between the two computers a few times and when plugged into 7 the serial port worked and failed on Embedded.

majenkotech commented 10 years ago

Is it that you can't open the port, or that the USB isn't being evaluated, or that the usb device isn't being recognised and the right drivers being installed?

EmbeddedMan commented 10 years ago

OK, this is really good. It confirms that this problem is completely different than the one that got fixed. So, I wonder what would happen if, instead of using the mdmcpq.inf file you used the one that comes with MPIDE - "Stk500v2.inf" (in the /drivers/chipKIT Drivers/ directory). And/or try running the chipKITDriverInstaller_v10.exe that's in there.

mskoczen commented 10 years ago

The Stk500v2.inf file references the mdmcpq.inf file, and this file was one of the files omitted from XP Embedded vs regular XP. I just re-installed the driver using chipKITDriverInstaller_v10.exe from the latest test build and it did not help.

EmbeddedMan commented 10 years ago

Ahh, I see. Drat. I'm not quite sure where to go next with this one - the change in compiler inside MPIDE changed something that breaks USB serial under XP Embedded (I wonder if it's also broken for XP as well). Without having an XP embedded system here to test with, I'm not sure how I can help much.

JacobChrist commented 10 years ago

Brian,

Remember, that this is MPIDE version specific. The board works fine and enumerates properly with an older version of MPIDE.

Jacob

On Mon, Jun 2, 2014 at 10:28 AM, mskoczen notifications@github.com wrote:

The Stk500v2.inf file references the mdmcpq.inf file, and this file was one of the files omitted from XP Embedded vs regular XP. I just re-installed the driver using chipKITDriverInstaller_v10.exe from the latest test build and it did not help.

— Reply to this email directly or view it on GitHub https://github.com/chipKIT32/chipKIT32-MAX/issues/466#issuecomment-44866609 .

Jacob Christ ProLinear/PONTECH, Inc. 1-877-985-9286 Phone 1-413-235-1651 Fax http://www.pontech.com

EmbeddedMan commented 10 years ago

Right. It's because of the change to the new 'mx' compiler. That's when things broke.

mskoczen commented 10 years ago

I am downloading all the test builds between the known working version and the one we know fails. I will update when I have tested to narrow down the problem.

mskoczen commented 10 years ago

Version Works with XP Embedded 20130715 yes 20130724 yes 20130817 yes 20130918 yes 20131118 yes 20140121 no 20140307 no 20140316 no It would be nice if the git repo had a tag for each test build. Comparing the revisions between those dates shows significant changes to HardwareSerial_cdcacm.c. I tested copying HardwareSerial_cdcacm.c and HardwareSerial_cdcacm.h from the 20131118 to 20140121 and Xp embedded was able to recognize the serial port created with the composite version.

JacobChrist commented 10 years ago

I don't know, but I'm just guessing that this might have broke when Android host to CDC-ACM device broke as well (blame [as in git blame] majenko).

Jacob

On Mon, Jun 2, 2014 at 12:06 PM, mskoczen notifications@github.com wrote:

Version Works with XP Embedded 20130715 yes 20130724 yes 20130817 yes 20130918 yes 20131118 yes 20140121 no 20140307 no 20140316 no It would be nice if the git repo had a tag for each test build.

— Reply to this email directly or view it on GitHub https://github.com/chipKIT32/chipKIT32-MAX/issues/466#issuecomment-44877854 .

Jacob Christ ProLinear/PONTECH, Inc. 1-877-985-9286 Phone 1-413-235-1651 Fax http://www.pontech.com

majenkotech commented 10 years ago

(hides) Me? What commit?

JacobChrist commented 10 years ago

https://github.com/chipKIT32/chipKIT32-MAX/commit/f6f88bfc4425103d33ec0e27416ca1789fd4e2b3

We first detected and related to this issue:

https://github.com/chipKIT32/chipKIT32-MAX/issues/402

At the time Mike and I were working with Android, today its XP Embedded. We haven't been pushing the issue, but we are currently undergoing an effort to use the latest version of MPIDE for everything we do to make sure things are not breaking.

Jacob

On Mon, Jun 2, 2014 at 1:21 PM, Matt Jenkins notifications@github.com wrote:

(hides) Me? What commit?

— Reply to this email directly or view it on GitHub https://github.com/chipKIT32/chipKIT32-MAX/issues/466#issuecomment-44885993 .

Jacob Christ ProLinear/PONTECH, Inc. 1-877-985-9286 Phone 1-413-235-1651 Fax http://www.pontech.com

majenkotech commented 10 years ago

The major change there is the generation of the gConnected variable. That broke OS X. Later a change fixed OS X ("> 0" instead of "& 0x01"). The change somehow got lost in a later version with the change to the MZ compiler, and has since been put back in again.

JacobChrist commented 10 years ago

So the Embedded XP / Android USB / USB for Serial issues deepens...

Turns out the problem is not isolated to Embedded XP. The VB.NET application we are running on Embedded XP has the same behavior when run on regular Windows 7 when trying to communicate with an application complied in 20140316 with USB for Serial. The behavior is as such:

o. The device enumerates on the PC. o. We can open the COM port. o. We can send commands to the board (and they are received by verification of moving motors). o. There is just no response from the board. (as if the gConnected bit is not set) o. However, we do get a response when using the terminal with MPIDE.

o Compiling the exact same code in 20130715 fixes the problem and communications with the VB.NET application is bi-directional.

Jacob

JacobChrist commented 10 years ago

Okay, setting DTR and RTS in the VB.NET fixed the problem with the Windows 7 VB.NET communications...

This may be the same issue in Android as well.

It is still not enumerating in XP Embedded with USB for Serial complied in 20140316.

It may be an issue with the following files in XP Embedded.

usbscr.sys mdmcpq.inf

Jacob

On Tue, Jun 3, 2014 at 3:40 PM, wrote: My guess is that WIndows is being naught and not setting the handshaking signals properly when you open a serial port. You should therefore set DTR and RTS in your program to signal to the remote end that you are ready to accept serial data.

If this is affecting us then it is probably affecting Arduino too, since they do it the exact same way. And so do many other people.

Maybe there is something in our .inf file that's affecting it...?

JacobChrist commented 10 years ago

So, this problem is rearing its head again for me today. This time its not XP Embedded, but a regular desktop XP computer. I think its related to this issue so I'm not opening a new issue but augmenting this issue.

USB For Serial Enumeration Issue: Using USB for Serial with a board that is essentially a PONTECH UAV100 compatible board. ) the USB Serial will not enumerate on some computers but will on others with certain versions of MPIDE. When the device doesn't enumerate it will not even show up in the device manager (to allow picking a new driver) so this is really bad.

Test Setup: Windows 7 PC using (I think) old unsigned inf driver. Windows XP PC using signed driver (also tried unsigned inf driver).

Possible causes: OS Version, inf driver vs chipKIT signed drivers

mpide-0023-windows-20130715: Enumerates Win7, and XP. mpide-0023-windows-20140316: Enumerates ONLY on Win7. mpide-0023-windows-20140821: Enumerates ONLY on Win7.

Notes: I tried changing drivers between the signed chipKIT driver and the inf driver on the XP computer, but I'm not sure if I'm successfully doing this. No effect of course.

I think the course of action to fix this is to do a commit by commit diff between 20130715 and 20140316 until the issue can be pin pointed.

majenkotech commented 10 years ago

We should tag the repo for every test release so we know just where everything is. Github has the option of setting a tag to be a "prerelease" for our test versions.

JacobChrist commented 10 years ago

Agreed.

On Mon, Aug 25, 2014 at 12:02 PM, Matt Jenkins notifications@github.com wrote:

We should tag the repo for every test release so we know just where everything is. Github has the option of setting a tag to be a "prerelease" for our test versions.

— Reply to this email directly or view it on GitHub https://github.com/chipKIT32/chipKIT32-MAX/issues/466#issuecomment-53311612 .

Jacob Christ ProLinear/PONTECH, Inc. 1-877-985-9286 Phone 1-413-235-1651 Fax http://www.pontech.com

ricklon commented 10 years ago

We can tracce the history of these files and compare with a last know working version. Also, need to review the changes and see if good intentions caused things to go from better to worse. There was a revert in the middle of summer that could have had a negative effect.

On Mon, Aug 25, 2014 at 3:03 PM, Jacob Christ notifications@github.com wrote:

Agreed.

On Mon, Aug 25, 2014 at 12:02 PM, Matt Jenkins notifications@github.com wrote:

We should tag the repo for every test release so we know just where everything is. Github has the option of setting a tag to be a "prerelease" for our test versions.

— Reply to this email directly or view it on GitHub < https://github.com/chipKIT32/chipKIT32-MAX/issues/466#issuecomment-53311612>

.

Jacob Christ ProLinear/PONTECH, Inc. 1-877-985-9286 Phone 1-413-235-1651 Fax http://www.pontech.com

Reply to this email directly or view it on GitHub https://github.com/chipKIT32/chipKIT32-MAX/issues/466#issuecomment-53311894 .

Co-founder Fair Use Building and Research (FUBAR) Labs http://fubarlabs.org

majenkotech commented 10 years ago

Question: when it fails to enumerate in Windows, does the bootloader enumerate? I.e. if you can't enumerate it at all in windows in normal running mode, and you then switch to the bootloader, does that enumerate, since that is a CDC/ACM device as well? (I'm guessing the answer is "Yes" otherwise you couldn't upload code...)

JacobChrist commented 10 years ago

Yes, the bootloader enumerates. On Aug 26, 2014 1:48 AM, "Matt Jenkins" notifications@github.com wrote:

Question: when it fails to enumerate in Windows, does the bootloader enumerate? I.e. if you can't enumerate it at all in windows in normal running mode, and you then switch to the bootloader, does that enumerate, since that is a CDC/ACM device as well?

— Reply to this email directly or view it on GitHub https://github.com/chipKIT32/chipKIT32-MAX/issues/466#issuecomment-53391855 .

EmbeddedMan commented 9 years ago

I believe that commit 5c8e43a fixes this issue. Here is the summary of what was changed:

We now refrain from sending any USB data up to the PC until one or more of the following happens:

The test sketch that I posted above in this thread also passes with these changes applied.

ricklon commented 9 years ago

confirmed closed.