6 years, 8 months ago.

USBDevice on FRDM-K64F sometimes crash my laptop

/media/uploads/hchanon/frdm-k64f_usbdevice_test.png Hi everyone,

First, it is my second post on this topic but could not locate my old one. Sorry for the repeated post then. However, I am bringing more info this time.

I am currently having issues with the USBDevice library when deployed on the FRDM-K64F. I built a very simple image for target which only instantiate one USBMidi object. (see attached image) When I connect the usb port of the target to my Windows 8.1 development laptop, I get one of the following results: - Unknown device message, and a floating unknown usb device in the "Device Manager", sometimes reporting that descriptors could not be retrieved. - A frozen screen which requires a computer reset - A blue screen which report one of the following messages : PAGE_FAULT_IN_NONPAGE_AREA, IRQL_NOT_LESS_OR_EQUAL, KERNEL_SECURITY_CHECK_FAILURE - Sometimes works (when I am very lucky)

Another thing I observed is that the FRDM-K64F usb port sometimes has to be connected multiple times before the firmware achieves proper start-up. When the firmware does not start, only the Ethernet port led is on. Could there be power sequencing issues?

The host laptop is a DELL XPS 15" and has a Intel(R) series 8/C220 USB 3.0 controller.

I tested the same target/firmware on other computers and USBDevice/FRDM-K64F worked fine. (Intel(R) series 6/C200 and Intel(R) series 7/C216)

I considered the fact that the problem might be the laptop itself. However, what worries me here is that I have been using this laptop with all kind of USB devices for at least a year and never experienced any issue. (Including USB sound cards with midi ports)

Too add to my observations, I tested the same cases with a second FRDM-K64F board and got the same results.

After conducting some researches, I came across this post http://developer.mbed.org/questions/4252/USBKeyboard-on-KL25Z-only-works-intermit/ where the reported problem appeared to be similar to mine. Sadly, I tested the http://developer.mbed.org/users/mjr/code/USBDevice/ library and It did not fixed my issue.

I also tested this with 2 different 2.0 USB Hubs. No luck there either.

Does anybody observed similar issue or has any idea of what could be going on? At this point, I am planning the purchase of an external USB sniffer to try to solve this.

If anybody as an idea for a patch, I would be more then happy to test it!

Not really an anwer, but that code you linked in the meantime has been included in the main mbed branch, so if you used an up to date USBDevice file that should work properly.

And what happens if you do a USBMouse example (doesn't need any kind of special drivers, so my favorite USBDevice example program)?

I haven't heard of this issue before (outside of the issue which is solved by the user whos lib you also linked). In general obviously a blue screen should never be allowed to happen due to an external USB device.

posted by Erik - 07 Oct 2014

Mike R. fix (the link you provided above) was also pushed to the USB lib as I recall. If you suspect the power issue, try to power your board via adapter . K64F board provide more options.

Please always provide the library version for all libs you are using (mbed, usb). ARe they in the latest revision?

IF you get around this problem, please consider creating a new pull request on github https://github.com/mbedmicro/mbed


posted by Martin Kojtal 08 Oct 2014

Hi again,

I conducted additional tests, and at some point, my problematic machine would not restart from a blue screen. (something to do with windows cache metadata) I am now out of a machine to reproduce the problem for at least a few days.

Still, I am fronting something interesting. As Erik suggested, I tested the latest samux/USBMouse_HelloWorld program with updated libraries (USBDevice r31 and mbed r89) on one of the machine where USBDevice always worked. First, I observed that system would never work the first time I connected the FRDM-K64F usb port in the host, but always worked the second time. After playing with it, it seems that leaving the FRDM-K64F without power for about 10s or more would require a USB connector reconnection. Could the impedance on usb power line be inadequate? (out of spec?)

For fun, I also played with software delays, but it did not changed anything. I ended up testing the usb connection issue with a simple led toggling firmware. The usb connection issue was still there.. meaning that it might be an hardware issue after all.

At this point, I'll submit the issue to Freescale. I suspect that my original USBDevice problem might be due to the mentioned powering issue and that my problematic PC might have been more sensible to it, somehow..

I'll update the post when I get more info.

posted by H. Chanon 08 Oct 2014

I created this post on Freescale:


posted by H. Chanon 08 Oct 2014

There has been some development on this issue.

It appears that NMI can get called early when the FRDM-K64F boots due to the PTA4 line left floating on R75 capacitor. (A least on my board revision (700-28163 REV B, SCH-28163 REV D)) See https://community.freescale.com/message/443763?et=watches.email.thread. Freescale staff suggests that the NMI interrupt at boot up should be managed.

Since I am fairly new to the mbed community and that I do not know the mbed core well enough to emit a statement on the Freescale suggestion, could somebody tell me where I should forward this issue?

In the context of the Freescale post, I tested an hardware patch which fixes the booting issue. (removing C55 capacitor) However, I would not expect this to be the final solution. I'll wait for final input from Freescale.

This still leaves the root issue open, which is the FRDM-K64F crashing my development computer when connected to the USB port. I will get access access to my initial test setup in about a week and will retest it then, with the C55 patch or any upcoming hardware or firmware patch. Again, I'll update this post when done.

posted by H. Chanon 13 Oct 2014

I finally got back my problematic computer and got to some sort of conclusion.

On the question of why my computer was sometimes crashing when I connected the FRDM-K64F with the USBDevice called, I cannot provide a better answer than the following one: re-installing my system from scratch fixed it. (starting from an empty hard drive) I am still somehow surprised by the fact that I was observing the problem only with the mbed/FRDM and not with other usb devices. (tested a lot of them)

The question of the FRDM-K64F not booting on first connection of K64F USB port is now fairly clear. The presence of a problematic situation has been asserted by Freescale staff and discussed in details in the Freescale forum ticket provided earlier. Removing the C55 capacitor appears to be a fair compromise and fixes the problem although an "official" fix has not been explicitly provided by Freescale yet. Adding NMI handling to the mbed K64F core in my opinion should also be considered. I'll check with mbed K64F people on this and might create a pull request.

At this point, I got my answers.


posted by H. Chanon 16 Oct 2014

1 Answer

2 years, 7 months ago.

The information about the USB device on FRDM-K64F is so helpful and valuable. I hope that we will get this kind of stuff in the future also. https://www.pcsupportnumber.co.uk/blog/fix-windows-error-code-0x80004005/