SD Card with Kinetis K70 Hi-Speed USB Device I/O Errors

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

SD Card with Kinetis K70 Hi-Speed USB Device I/O Errors

Jump to solution
1,663 Views
video_man
Contributor III

I've set up a Kinetis K70 as a Hi-Speed USB MSC device to read/write an SD Card from a PC. I'm using the Tower K70 board with a TWR-SER2 board for the Hi-speed USB interface.

I'm having a problem with I/O errors while copying files from the SD Card to a PC/Mac, which I suspect is related to using the SDHC/eSDHC drivers in MQX, rather than the USB drivers, because the I/O errors are semi-repeatable in the same places during the transfer of particular files, as I will describe in more detail below. I've been unable to find a problem in my code, and now I'm wondering if anyone else has had this problem, or if my problem could be related to any of the 10 SDHC related issues listed in the Kinetis 4N30D Mask Set Errata (Feb 2013)? I'm hoping someone with knowledge of the SDHC/eSDHC drivers might know if they are dependent on any of those issues.

Long description of the I/O error symptoms:

I can format the SD Card "drive" and read/write files using a PC or Mac USB connection, but I get an I/O error (reported by the PC or Mac) when copying particular files from the SD Card to the PC/Mac, which terminates a file transfer. I never get an error when writing files from the PC/Mac to the SD Card, only when transferring (reading) files from the SD Card to the PC/Mac. I can format the SD Card from a PC or Mac with FAT-32, or with the Mac HFS file system, and still have the same problem. So it isn't specific to the file system.

Although I can sometimes copy (read from the SD Card) 200-300 MB of files to the PC or Mac without an error after powering up the K70/SD Card, I eventually get an I/O error (which terminates a copy transfer) on particular files. Once I get an I/O error on a particular file, I get the same error, in the same place during each subsequent attempt to transfer that file. I also get the same error, in the same place, when trying to transfer copies of that same file (which I had previously written on the SD Card). So the I/O error appears to be related to the content/structure of the files, and not the particular location of the files on the SD Card. Even after getting an error transferring a particular file, I can transfer some other files (even much larger files) without errors.

The problem does not appear related to how files are written to the SD Card by the K70 SDHC/eSDHC drivers, since I can ALSO write files on the SD Card with it plugged directly into a Mac or a separate USB SD Card Reader/Writer, and then have the same reading problem when the SD Card is back in the K70 USB device.

I'd appreciate any information, thoughts, or ideas on how to troubleshoot the problem. This is critical to using the K70/MQX for my project. Thanks.

Labels (2)
0 Kudos
Reply
1 Solution
916 Views
video_man
Contributor III

I finally identified the problem causing I/O errors when using the HS USB MSC device function. The problem is caused by the design of the Tower K70 processor board.

I received a 2nd K70 processor board and a 2nd TWR-SER2 board. The problem was even worse with the 2nd K70 board (the 2nd TWR-SER2 worked the same as the 1st).

The problem is caused by the TRACE signals going to the 20-pin mini-JTAG connector (which connects to a PE Micro Multilink Universal FX debugger) on the K70 board. The same K70 pins used for the TRACE signals are also used for the ULPI signals to the HS USB Phy on the TWR-SER2 board. The TRACE_CLKOUT/ULPI_CLK signal is actually disconnected from the mini-JTAG connector by not populating a 0-ohm resistor pads on the board. But four other ULPI signals, including the ULPI_DATA0 60 MHz data bit signal are connected to the mini-JTAG connector. The 9" ribbon cable from the mini-JTAG connector to the PE Micro debugger causes ringing on the ULPI signal and produces the USB data errors. Those ULPI signals should have also been disconnected from the mini-JTAG connector by jumpers or unpopulated resistor positions.

The workaround to fix the problem was to cut the 9" ribbon cable wires (14-20) right next to the mini-JTAG board connector, which were fortunately at the edge of the ribbon cable. After that the HS USB port works perfectly without I/O errors.

View solution in original post

0 Kudos
Reply
3 Replies
917 Views
video_man
Contributor III

I finally identified the problem causing I/O errors when using the HS USB MSC device function. The problem is caused by the design of the Tower K70 processor board.

I received a 2nd K70 processor board and a 2nd TWR-SER2 board. The problem was even worse with the 2nd K70 board (the 2nd TWR-SER2 worked the same as the 1st).

The problem is caused by the TRACE signals going to the 20-pin mini-JTAG connector (which connects to a PE Micro Multilink Universal FX debugger) on the K70 board. The same K70 pins used for the TRACE signals are also used for the ULPI signals to the HS USB Phy on the TWR-SER2 board. The TRACE_CLKOUT/ULPI_CLK signal is actually disconnected from the mini-JTAG connector by not populating a 0-ohm resistor pads on the board. But four other ULPI signals, including the ULPI_DATA0 60 MHz data bit signal are connected to the mini-JTAG connector. The 9" ribbon cable from the mini-JTAG connector to the PE Micro debugger causes ringing on the ULPI signal and produces the USB data errors. Those ULPI signals should have also been disconnected from the mini-JTAG connector by jumpers or unpopulated resistor positions.

The workaround to fix the problem was to cut the 9" ribbon cable wires (14-20) right next to the mini-JTAG board connector, which were fortunately at the edge of the ribbon cable. After that the HS USB port works perfectly without I/O errors.

0 Kudos
Reply
916 Views
c0170
Senior Contributor III

Hello video_man,

I just want to ask for more details which might facilitate others to provide an answer.

There's no MQX version you are using. Can you share a code snippet with the file which causes IO error?

Regards,

c0170

0 Kudos
Reply
916 Views
video_man
Contributor III

I was using MQX 4.0.0, but I upgraded this weekend to MQX 4.0.1 with no change in behavior.

Quick background – I’ve developed products with S08 processors and Codewarrior for 6-7 years, but this is my first attempt with Kinetis, MQX, Codewarrior Eclipse (10.4), and the Tower System. So I could be making all sorts of rookie mistakes.

However, note that the application runs without problems (if a little slower than I expected) when I first power up the Tower System. I can copy 300 MB or so of files from the Tower to a PC before errors start occurring, and that includes the same files that later produce the I/O errors. So if this problem is caused by a firmware error it is somewhat subtle or it wouldn’t be working when I first power up the Tower.

In fact, I’m now suspicious that the I/O errors may be caused by a bad board/part in the Tower (all new boards, not previously proved to be reliable on other projects) after the parts (USB Hi-Speed Phy? or K70?) warm up. (I’ve already tried multiple SD Cards.) Just today I realized that the application ALWAYS works when the Tower is first plugged in. Rebooting the PC does not fix the problem once it begins to occur. Powering the Tower on and off also does not fix the problem. But if I leave the Tower off for 10 minutes before turning it back on it works without I/O errors again.

Although my typical problems are seldom caused by bad hardware, it’s impossible to ignore the repeatable behavior in the above paragraph. I think I will call Freescale and see if they will do a warranty exchange on the Tower boards before I spend more time beating my head against this wall looking for a firmware bug.


0 Kudos
Reply