HVAC demo - USB logging fails

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

HVAC demo - USB logging fails

1,884 Views
gorakk
Contributor IV

We have a custom board that uses a K61. Using MQX 4.0 and CodeWarrior 10.5

One of the features on our custom board is a USB host that is used to save data to a flash drive. We have seen that several hundred lines of data can be saved to the drive and then something happens and no further writes occur.  This functionality is based on what is in the HVAC demo.  Located in: Freescale_MQX_4_0\demo\hvac

One of the features of the HVAC demo is the ability to log data to a USB flash drive.  After seeing the issue in our application on our custom board I loaded the HVAC demo on a TWR-K60N512 connected to a TWR-SER. Data is logged to the drive but after a time (426 lines in one instance) it stops writing and the LED on the flash drive no longer blinks. This is the same problem we are seeing on our custom board.  I performed this test with the Int Flash Debug configuration.

I then installed MQX 4.1, loaded it's version of the HVAC demo onto the TWR-K60N512, and the same problem occurs.

When using the TWR-K60N512 I used the standard BSP and only made two changes to the HVAC application:

changed this define to 1:

#define DEMOCFG_ENABLE_USB_FILESYSTEM  1   /* enable USB mass storage */

changed this from 15 to 5 so the logging occurs every 5 seconds:

#define HVAC_LOG_CYCLE_IN_CONTROL_CYCLES 5

Has anyone seen this on the HVAC demo? Or can duplicate?

Labels (2)
0 Kudos
9 Replies

1,290 Views
kaifalkenberg
Contributor I

Hi,

I'm having the same problems here with the K60 board and MQX 4.0.

The problem seems to occur in function _io_usb_mfs_write_sector_internal() in file usbmfs.c. In my case the call to _lwsem_wait_ticks() fails. I have increased USBCFG_MFS_LWSEM_TIMEOUT by factor 20 and now it seems to work. Need to do more testing though.

My guess is that the USB stick is too slow to process the command queue and as a result returns the misleading error code MFS_SECTOR_NOT_FOUND.

Can you guys implement this change and run your tests against it?

Cheers

Kai

0 Kudos

1,290 Views
kaifalkenberg
Contributor I

The bug just popped up again.. :smileyangry: But it still seems to be a lot more stable. I'll experiment with even higher timeouts.

0 Kudos

1,290 Views
gorakk
Contributor IV

The flash drives that I have been testing.

Lexar 8GB Jumpdrive S70

************************************************************************

Vendor Information:       Mass Storage Device

Product Identification:

Product Revision Level:

************************************************************************

Note: this is the one that failed after 426 lines as previously mentioned. In another instance it had 517 lines before failing.

Memorex 1GB

************************************************************************

Vendor Information:     Memorex  Mass Storage Device

Product Identification: TD Classic 003C

Product Revision Level: 5.00

************************************************************************

Note: this drive saved 10,311 lines before a failure in one run, and 8,282 lines in another run.

0 Kudos

1,290 Views
CarlosCasillas
NXP Employee
NXP Employee

Hi Allen,

I just tested the mentioned example with the same modifications that you applied, using MQX v4.1 and CodeWarrior v10.6, and it didn’t failed. It was running the whole weekend (about 56 hours), and the log file includes about 40,000 lines.

Have you verified with a different USB stick? How about your hardware and the operating temperature of the system?


Hope this will be useful for you.
Best regards!
/Carlos

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,290 Views
gorakk
Contributor IV

Carlos,

I have three tower systems set up and have been cycling the drives that I have through each one.  Each tower system is running the Freescale HVAC demo.

I'm going to leave the systems set up to run over the weekend.  I'm curious to see how the 16 GB Sandisk drive performs on system #1 - I haven't seen a drive go as long as it has so far.

#1 (TWR-K60N512)

  • A Memorex 1 GB drive has already run and failed on this system.  It saved 9,311 lines before stopping.
  • It is currently running a Sandisk 16 GB drive – this one has now been running for over 24 hours

#2 (TWR-K60N512)

  • A Transcend 4 GB drive has already run and failed on this system.  It saved 11,818 lines before stopping.
  • A Kingston 64 GB drive has already run and failed on this system.  It saved 5,211 lines before stopping.
  • A Lexar 8 GB drive has already run and failed on this system.  It saved 518 lines before stopping.
  • It is currently running a Memorex 1 GB drive. 

#3 (TWR-K40X256)

  • A Verbatim 8 GB drive has already run and failed on this system.  It saved 4,096 lines before stopping.
  • A Lexar 8 GB drive has already run and failed on this system.  It saved 521 lines before stopping.
  • A Codewarrior branded 16 GB drive has already run and failed on this system.  It saved 2,048 lines before stopping.
  • A no-name 1 GB drive has already run and failed on this system.  It saved 3,209 lines before stopping.
  • It is currently running the Transcend 4 GB drive. 

Regards,

Allen

Monday Update - the LED on the Sandisk 16 GB drive was no longer blinking this morning.  It had 21,129 lines in the file.

0 Kudos

1,290 Views
wiilliam_powell
Contributor I

Allen,

Did you ever find a solution to the USB write problem?

I'm using MQX 4.1 and a Kinetis K70 on my target hardware and I'm writing data to a file on various USB drives and "intermittently" the USB task (or the KHCI task) will stop writing data to the file.  Other tasks within MQX continue to operate.

Let me know if you found a solution please,

Thanks,

Bill

0 Kudos

1,290 Views
gorakk
Contributor IV

Bill,

We did not find a workaround or explanation.  We actually put the feature that uses a USB flash drive on hold in our product - we may revisit at some time in the future.

Allen

0 Kudos

1,290 Views
wiilliam_powell
Contributor I

Thanks for the response.  If I find a solution, I'll post...

0 Kudos

1,290 Views
gorakk
Contributor IV

Carlos,

Thanks for looking into this!

I will get a different tower system from one of my co-workers and try the same test again.  I will also get a couple more USB sticks.

Could any of the jumper settings on the tower boards cause something like this?

Regards,

Allen

0 Kudos