How to fix FRDM-KL25Z USB errors under Linux

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to fix FRDM-KL25Z USB errors under Linux

Jump to solution
7,755 Views
bikenomad
Contributor IV

I'm trying to use my new FRDM-KL25Z boards and am running into problems with the mass-storage peripheral (both in bootloader mode and in normal target-loader mode).

Though this board appears to work OK under Windows, connecting it to my Linux (Ubuntu 12.04 64-bit) system results in errors that keep me from being able to program the target processor.

Here's what happens when I connect to the debug USB connector, then plug in board with the reset button held:

kernel: [21855.408099] usb 2-4.2: new full-speed USB device number 72 using ehci_hcd
kernel: [21855.496096] usb 2-4.2: device descriptor read/64, error -32
kernel: [21855.710350] scsi35 : usb-storage 2-4.2:1.0
mtp-probe: checking bus 2, device 72: "/sys/devices/pci0000:00/0000:00:1d.7/usb2/2-4/2-4.2"
mtp-probe: bus: 2, device: 72 was not an MTP device
kernel: [21856.708856] scsi 35:0:0:0: Direct-Access     FSL      FSL/PEMICRO MSD  0001 PQ: 0 ANSI: 4
kernel: [21856.709567] sd 35:0:0:0: Attached scsi generic sg12 type 0
kernel: [21856.710095] sd 35:0:0:0: [sdl] 1983999 512-byte logical blocks: (1.01 GB/968 MiB)
kernel: [21856.710590] sd 35:0:0:0: [sdl] Write Protect is off
kernel: [21856.710594] sd 35:0:0:0: [sdl] Mode Sense: 00 00 00 00
kernel: [21856.712913] sd 35:0:0:0: [sdl] Asking for cache data failed
kernel: [21856.712919] sd 35:0:0:0: [sdl] Assuming drive cache: write through
kernel: [21856.715967] sd 35:0:0:0: [sdl] Asking for cache data failed
kernel: [21856.715971] sd 35:0:0:0: [sdl] Assuming drive cache: write through
kernel: [21856.725391]  sdl:
kernel: [21856.727595] sd 35:0:0:0: [sdl] Asking for cache data failed
kernel: [21856.727599] sd 35:0:0:0: [sdl] Assuming drive cache: write through
kernel: [21856.727603] sd 35:0:0:0: [sdl] Attached SCSI removable disk
kernel: [21886.904105] usb 2-4.2: reset full-speed USB device number 72 using ehci_hcd
udevd[12506]: timeout '/sbin/blkid -o udev -p /dev/sdl'
kernel: [21918.008112] usb 2-4.2: reset full-speed USB device number 72 using ehci_hcd
udevd[12506]: timeout: killing '/sbin/blkid -o udev -p /dev/sdl' [12702]
6]: last message repeated 30 times
kernel: [21948.984120] usb 2-4.2: reset full-speed USB device number 72 using ehci_hcd
udevd[12506]: timeout: killing '/sbin/blkid -o udev -p /dev/sdl' [12702]
6]: last message repeated 30 times
kernel: [21979.960133] usb 2-4.2: reset full-speed USB device number 72 using ehci_hcd
udevd[12506]: timeout: killing '/sbin/blkid -o udev -p /dev/sdl' [12702]
6]: last message repeated 30 times
kernel: [22010.936139] usb 2-4.2: reset full-speed USB device number 72 using ehci_hcd
udevd[12506]: timeout: killing '/sbin/blkid -o udev -p /dev/sdl' [12702]
6]: last message repeated 30 times
kernel: [22041.912148] usb 2-4.2: reset full-speed USB device number 72 using ehci_hcd
udevd[12506]: '/sbin/blkid -o udev -p /dev/sdl' [12702] terminated by signal 9 (Killed)
udevd[12506]: timeout 'udisks-part-id /dev/sdl'
kernel: [22042.020900] sd 35:0:0:0: [sdl] Unhandled error code
kernel: [22042.020904] sd 35:0:0:0: [sdl]  Result: hostbyte=DID_ABORT driverbyte=DRIVER_OK
kernel: [22042.020909] sd 35:0:0:0: [sdl] CDB: Read(10): 28 00 00 1e 45 00 00 00 08 00
kernel: [22042.020918] end_request: I/O error, dev sdl, sector 1983744
kernel: [22042.020923] Buffer I/O error on device sdl, logical block 1983744
kernel: [22042.020928] Buffer I/O error on device sdl, logical block 1983745
kernel: [22042.020930] Buffer I/O error on device sdl, logical block 1983746
kernel: [22042.020933] Buffer I/O error on device sdl, logical block 1983747
kernel: [22042.020935] Buffer I/O error on device sdl, logical block 1983748
kernel: [22042.020938] Buffer I/O error on device sdl, logical block 1983749
kernel: [22042.020941] Buffer I/O error on device sdl, logical block 1983750
kernel: [22042.020943] Buffer I/O error on device sdl, logical block 1983751

Then I unplug the board, and see a disconnect. Re-connecting it without the reset button held results in a similar set of problems:

kernel: [22075.824154] usb 2-4.2: new full-speed USB device number 73 using ehci_hcd
kernel: [22075.934856] cdc_acm 2-4.2:1.0: This device cannot do calls on its own. It is not a modem.
kernel: [22075.934878] cdc_acm 2-4.2:1.0: ttyACM0: USB ACM device
kernel: [22075.935530] scsi36 : usb-storage 2-4.2:1.2
mtp-probe: checking bus 2, device 73: "/sys/devices/pci0000:00/0000:00:1d.7/usb2/2-4/2-4.2"
mtp-probe: bus: 2, device: 73 was not an MTP device
kernel: [22076.932792] scsi 36:0:0:0: Direct-Access     FSL      FSL/PEMICRO MSD  0001 PQ: 0 ANSI: 4
kernel: [22076.933544] sd 36:0:0:0: Attached scsi generic sg12 type 0
kernel: [22076.934072] sd 36:0:0:0: [sdl] 1983999 512-byte logical blocks: (1.01 GB/968 MiB)
kernel: [22076.936039] sd 36:0:0:0: [sdl] Write Protect is off
kernel: [22076.936049] sd 36:0:0:0: [sdl] Mode Sense: 00 00 00 00
kernel: [22076.936674] sd 36:0:0:0: [sdl] Asking for cache data failed
kernel: [22076.936678] sd 36:0:0:0: [sdl] Assuming drive cache: write through
kernel: [22076.939779] sd 36:0:0:0: [sdl] Asking for cache data failed
kernel: [22076.939783] sd 36:0:0:0: [sdl] Assuming drive cache: write through
kernel: [22076.950187]  sdl:
kernel: [22076.952411] sd 36:0:0:0: [sdl] Asking for cache data failed
kernel: [22076.952416] sd 36:0:0:0: [sdl] Assuming drive cache: write through
kernel: [22076.952420] sd 36:0:0:0: [sdl] Attached SCSI removable disk
kernel: [22107.896168] usb 2-4.2: reset full-speed USB device number 73 using ehci_hcd
kernel: [22107.984167] usb 2-4.2: device descriptor read/64, error -32
kernel: [22108.176164] usb 2-4.2: device descriptor read/64, error -32
kernel: [22108.368167] usb 2-4.2: reset full-speed USB device number 73 using ehci_hcd
kernel: [22108.456165] usb 2-4.2: device descriptor read/64, error -32
kernel: [22108.648169] usb 2-4.2: device descriptor read/64, error -32
kernel: [22108.840168] usb 2-4.2: reset full-speed USB device number 73 using ehci_hcd
kernel: [22109.248017] usb 2-4.2: device not accepting address 73, error -32
kernel: [22109.336163] usb 2-4.2: reset full-speed USB device number 73 using ehci_hcd
kernel: [22109.744017] usb 2-4.2: device not accepting address 73, error -32
kernel: [22109.744320] sd 36:0:0:0: Device offlined - not ready after error recovery
kernel: [22109.744330] sd 36:0:0:0: [sdl] Unhandled error code
kernel: [22109.744332] sd 36:0:0:0: [sdl]  Result: hostbyte=DID_ABORT driverbyte=DRIVER_OK
kernel: [22109.744337] sd 36:0:0:0: [sdl] CDB: Read(10): 28 00 00 00 01 20 00 00 08 00
kernel: [22109.744346] end_request: I/O error, dev sdl, sector 288
kernel: [22109.744351] Buffer I/O error on device sdl, logical block 288
kernel: [22109.744355] Buffer I/O error on device sdl, logical block 289
kernel: [22109.744357] Buffer I/O error on device sdl, logical block 290
kernel: [22109.744360] Buffer I/O error on device sdl, logical block 291
kernel: [22109.744362] Buffer I/O error on device sdl, logical block 292
kernel: [22109.744365] Buffer I/O error on device sdl, logical block 293
kernel: [22109.744367] Buffer I/O error on device sdl, logical block 294
kernel: [22109.744370] Buffer I/O error on device sdl, logical block 295
kernel: [22109.744387] sd 36:0:0:0: rejecting I/O to offline device
kernel: [22109.744395] sd 36:0:0:0: killing request
kernel: [22109.744406] sd 36:0:0:0: rejecting I/O to offline device
kernel: [22109.744414] usb 2-4.2: USB disconnect, device number 73
kernel: [22109.744427] sd 36:0:0:0: rejecting I/O to offline device
kernel: [22109.744436] sd 36:0:0:0: rejecting I/O to offline device
kernel: [22109.744442] sd 36:0:0:0: rejecting I/O to offline device
kernel: [22109.744448] sd 36:0:0:0: rejecting I/O to offline device
kernel: [22109.744453] sd 36:0:0:0: rejecting I/O to offline device
kernel: [22109.744459] sd 36:0:0:0: rejecting I/O to offline device
kernel: [22109.744464] sd 36:0:0:0: rejecting I/O to offline device
kernel: [22109.744532] sd 36:0:0:0: rejecting I/O to offline device
kernel: [22109.744545] sd 36:0:0:0: rejecting I/O to offline device
kernel: [22109.744550] sd 36:0:0:0: rejecting I/O to offline device
kernel: [22109.744556] sd 36:0:0:0: rejecting I/O to offline device
kernel: [22109.744561] sd 36:0:0:0: rejecting I/O to offline device
kernel: [22109.744567] sd 36:0:0:0: rejecting I/O to offline device
kernel: [22109.744572] sd 36:0:0:0: rejecting I/O to offline device
kernel: [22109.744577] sd 36:0:0:0: rejecting I/O to offline device
kernel: [22109.744583] sd 36:0:0:0: rejecting I/O to offline device
kernel: [22109.744601] sd 36:0:0:0: rejecting I/O to offline device
kernel: [22109.744610] sd 36:0:0:0: rejecting I/O to offline device
kernel: [22109.744616] sd 36:0:0:0: rejecting I/O to offline device
kernel: [22109.744621] sd 36:0:0:0: rejecting I/O to offline device
kernel: [22109.832163] usb 2-4.2: new full-speed USB device number 74 using ehci_hcd
kernel: [22109.920162] usb 2-4.2: device descriptor read/64, error -32
kernel: [22110.112165] usb 2-4.2: device descriptor read/64, error -32
kernel: [22110.304163] usb 2-4.2: new full-speed USB device number 75 using ehci_hcd
kernel: [22110.392163] usb 2-4.2: device descriptor read/64, error -32
kernel: [22110.584166] usb 2-4.2: device descriptor read/64, error -32
kernel: [22110.776164] usb 2-4.2: new full-speed USB device number 76 using ehci_hcd
kernel: [22111.184019] usb 2-4.2: device not accepting address 76, error -32
kernel: [22111.272164] usb 2-4.2: new full-speed USB device number 77 using ehci_hcd
kernel: [22111.680020] usb 2-4.2: device not accepting address 77, error -32
kernel: [22111.680182] hub 2-4:1.0: unable to enumerate USB device on port 2

So it appears that the behavior of the mass-storage emulation on the K20 is not reliable, at least on my system. I have no problem with other USB devices, though, even somewhat peculiar composite devices with strange storage layouts.

It may even be that the device is not following the requirements of the USB spec for the mass storage class. After all, "it seems to work in Windows" is not a guarantee of correct operation.

I could get USB traces next week to verify the behavior, if that would help.

Can anyone suggest how I might be able to fix this problem?

0 Kudos
Reply
1 Solution
4,763 Views
mnorman
NXP Employee
NXP Employee

A new version of the MSD Flash Programmer OpenSDA Application is available here: http://www.pemicro.com/opensda/

This adds support for Linux. 

HOWEVER, note that there isn't yet an update for your bootloader (also a mass-storage interface) to add Linux support.  So, you'll need to find a Windows machine to use the bootloader to swap out (upgrade) the OpenSDA Applications.  Sorry for this temporary inconvenience.

-Michael

View solution in original post

0 Kudos
Reply
14 Replies
4,763 Views
larsknudsen
Contributor II

All these posts are pretty old. 

We just bought 2 "freedom" boards to be used in a (hopefully) larger education initiative.

Nobody here uses anything but Ubuntu (13.04 and 12.04, 64bit) - there is NO windows available and it it not feasible to require customers to have windows to get the "freedom" (yeah right) board flashed.

Has there been ANY solution to getting everything running from pure Linux (without windows)?

also - is there any source available to get it flashed/handled from RaspberryPi (or other devices)?

If not:

1. Please remove "freedom" from the name

2. Please give us a refund

If yes:

Thank you very much for fixing it - please provide a link!

0 Kudos
Reply
4,763 Views
bobpaddock
Senior Contributor III

Lars, take a look at "Arrow's Cloud Connect":

http://arrow.transim.com/arrowcloudconnect/home

"Arrow's Cloud Connect is a free online tool chain for building Internet of Things application on ARM® Cortex™-M0+ platform. You can write, compile and program code to your Freescale Freedom Development Platform. ... Our dashboards will visualize data in a meaningful format.

With Arrow's Cloud Connect, you can now avoid purchasing and downloading cumbersome IDEs. You will have access to a code library, so getting started is easy. You simply login to our webpage, enabling a fast and effective approach. With our secure system, you own your I.P. and product design.

Arrow Cloud Connect is the only online compiler available for ARM© Cortex™-M0+ and the only end-to-end solution to prove your Internet of Things application without expensive hardware or software."

Sounds great for an educational type setting.  I'd still be concerned of using it in a production design that requires long term support.  When was the last time you saw a website not change or go away over a ten to twenty year period?

0 Kudos
Reply
4,763 Views
bobpaddock
Senior Contributor III

"Has there been ANY solution to getting everything running from pure Linux (without windows)?"

DS-5 Community Edition | ARM Development Studio 5

was released recently.

"The ARM Development Studio 5 (DS-5) Community Edition is a free professional quality toolchain developed by ARM to accelerate the development of native (C/C++) embedded Linux and Android™ applications. Based on DS-5 Professional Edition, this toolkit offers essential debug and system analysis for you to create robust and highly optimized applications for ARM processor-based devices, without the fuss and inefficiencies usually attached to fragmented open source tools."

Don't know if it has Kinetis support or not yet.  Does run on both Windows and Linux.  Loading the files with "Open"SDA may still be an issue?

0 Kudos
Reply
4,763 Views
mnorman
NXP Employee
NXP Employee

Bob, Lars,

Thanks for your frank feedback. Please know that we hear you can are working to correct the issues that are affecting you on openSDA. I'll message you to provide a few more details.

Regarding tools for Linux, I don't think DS-5 is going to be right for you for now.  The free community edition supports embedded Linux and Android development only and is meant for higher-end applications processors. It doesn't support Cortex-M devices. Have you experimented with GCC ARM Embedded in Launchpad?

-Michael

0 Kudos
Reply
4,763 Views
larsknudsen
Contributor II

Hi Michael,

Thanks for the response! - my outburst yesterday may have been a bit harsh (I have been working day and night for 1/2 year on an education system for poor schools in developing countries ... the KL25Z seems like a perfect addition .. and then it requires Windows to get enabled => big explosion :smileywink:)

On the positive side:  I actually managed to get it working eventually by:

1. find a friend with a windows machine

2. get the board updated to the latest BOOTUPDATEAPP.SDA and MSD-FRDM-KL25Z_Pemicro_v109.SDA

3. get the bare metal solution that payne92 put together here:  payne92/bare-metal-arm · GitHub  (This should really get promoted some official place - it's just perfect for Linux users)

It might not include a great API description, etc - but it gets the job done with minimal resources.

What I really need to be able to use the board in a larger scale in our http://www.empirikit.com project:  Boards preloaded with the updated firmware so we don't have to upgrade all of them by hand - if we choose to go with KL25Z and not Arduino (which has a great community base and is VERY easy to replace)

br

Lars

0 Kudos
Reply
4,763 Views
BlackNight
NXP Employee
NXP Employee

I have used it for Windows ;-),

Red Suite 5: Eclipse Juno, Processor Expert and unlimited FRDM-KL25Z | MCU on Eclipse

but CodeRed is provided for Mac and Linux.

It worked very well with the Freedom board for me, so you might give it a try?

0 Kudos
Reply
4,763 Views
bobpaddock
Senior Contributor III

"Red Suite 5: Eclipse Juno, Processor Expert and unlimited FRDM-KL25Z | MCU on Eclipse"

Funny. :-(  Code Red Technologies is now owned by NXP.  NXP will discontinue non-NXP support in 2014.

This is *exactly* why we want Linux (and anything else that is not Windows) support with Open Source Tools, for the whole tool chain..  In industry we need to support our product for decades.  In ten years I might be asked to make a change to a product that has not been touched for those ten years.

We do not want to be tied to vendor supplied tool chains be it NXP/Code Red, Freescale/Codewarrior etc.

We never know when the next Big Fish is going to swallow the Little Fish.  If we have the source code to *everything* we have some hope of continuing support.

Putting names like "Freedmon" and "Open" on OpenSDA is disingenuous at best, to be polite about it.

Being told (in a different thread) that Codewarrior will not be updated at all for Linux just seems like a classic bate-and-switch. As developers we spend more time with the tools that we do selecting parts. 

Poor tool support, such as limited choices as to operating environments, just means we move on to companies that do support their users in the environments that we choose  use it, or are forced to use.

When a developer asks how to interface a display to a Freescale part and the first thing coming from a Freescale representative is to threaten legal action (in thread on display drivers) it does not present Freescale in a good light.

Freescale needs to start giving the users, us, better documentation (see thread on I2C 5V tolerance), truly "Open" debugging support, truly "free" development environments if it wants to get any repeat design wins.

I really regret having chosen Freescale for my project based on early marketing, "Open"SDA, being lead on by nonexistent  Linux support from Freescale.  The chip still seems like the best out there, however nothing in the supporting infrastructure has lived up to that.  Please lets get with the program, stop ignoring our requests and start supporting them!

0 Kudos
Reply
4,763 Views
larsknudsen
Contributor II

Thanks for the hint about Red Suite.  However, there is no free version - which we would need for the schools.

Freescale should seriously consider removing the "Freedom" part of the name until they really are providing freedom with the board.  The name is misleading.

For Arduino, I can just download the tools for any platform - same goes for RaspberryPi - and if there is no support for the platform you have, there is always the source code available.

Maybe it would be a good community/university project to hack and release bootstrapping and development tools for the KL25Z.  From the specs it looks interesting - including the built in RGB LED, capacitive touch and accelerometer.  It only needs some proper open tools.

0 Kudos
Reply
4,764 Views
mnorman
NXP Employee
NXP Employee

A new version of the MSD Flash Programmer OpenSDA Application is available here: http://www.pemicro.com/opensda/

This adds support for Linux. 

HOWEVER, note that there isn't yet an update for your bootloader (also a mass-storage interface) to add Linux support.  So, you'll need to find a Windows machine to use the bootloader to swap out (upgrade) the OpenSDA Applications.  Sorry for this temporary inconvenience.

-Michael

0 Kudos
Reply
4,763 Views
bikenomad
Contributor IV

Hi Michael,

The version at the PE Micro link you gave is the same one (1.05, Sept. 21 2012) that I have on my boards. This is the version that I can't get to work with Linux.

I saw a mention of 1.07 but have not yet found it.

Is there another link I could try?

Thanks...

0 Kudos
Reply
4,763 Views
mnorman
NXP Employee
NXP Employee

I just now hit the link and downloaded the Pemicro_OpenSDA_Debug_and_MSD_Apps_2012_11_09.zip file. Inside I found:

Capture.PNG

MSD-FRDM-KL25Z_Pemicro_v107.SDA is the file you want to use.

http://www.pemicro.com/opensda/

By the way, there has been development on an application that will upgrade the OpenSDA bootloader in the field.  We've solved the Linux issue for the Bootloader as well (same issue as the MSD flash programmer). Soon you should be able to upgrade the Bootloader and not have to go back to windows to swap out the OpenSDA applications. Stay tuned and let me know how this goes for you.

-Michael

0 Kudos
Reply
4,763 Views
injunear1
Contributor IV

Did you get it running yet? If so, what is your set up? Perhaps others can use it too.

0 Kudos
Reply
4,763 Views
injunear1
Contributor IV

I originally tried to run my FRDM board on Ubuntu 12.04 32 bit and was not successful. It may well be able to be done but I gave up and installed the newest version of VirtualBox, then an old version of XP. After a couple days of puttering and putzing, I finally got it working.

If you choose to go this way, I or others can probably help you get it set up.

4,763 Views
bikenomad
Contributor IV

Thanks for the offer.

I also tried using it from a VMWare 9 virtual machine with Windows XP guest, and had no luck either there.

I'm about to try it on my Hackintosh with OS/X Mountain Lion; will post how it goes.

I'd prefer, of course, to have this work right under Linux.

0 Kudos
Reply