Author Topic: SD Card using demo file print command limited to 4096 byte files  (Read 16894 times)

Offline Kevin

  • Newbie
  • *
  • Posts: 30
    • View Profile
I'm using the simulator with SD CARD support and the debug disk command print.

When I use the disk > print file command on a file larger than 4096 bytes,  I get "READ ERROR occured".  Is this a limit in uTFat or just in the debug print command?

-Kevin

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3236
    • View Profile
    • uTasker
Re: SD Card using demo file print command limited to 4096 byte files
« Reply #1 on: June 25, 2010, 10:48:56 AM »
Hi Kevin

There shouldn't be any limit here. I was working with a real card yesterday and did a test print of a file of more than 100k without any problems (although the Windows TELNET client doesn't like printing such large files very much). There may be something when simulating so I will look into it. Also make sure that you have all patches applied.

I will also compare results with a release build in case there has been an improvement in the development version.

Once I know I will get back.

Regards

Mark

Offline Kevin

  • Newbie
  • *
  • Posts: 30
    • View Profile
Re: SD Card using demo file print command limited to 4096 byte files
« Reply #2 on: June 25, 2010, 05:33:45 PM »
I'm not sure if it will make a difference, but in the UART set to use COM1 and was monitoring it with TeraTerm using a USB serial port at com13 on the same PC.

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3236
    • View Profile
    • uTasker
Re: SD Card using demo file print command limited to 4096 byte files
« Reply #3 on: June 25, 2010, 11:16:42 PM »
Hi Kevin

I have just tested the SD card operation in the simulator using a file of about 6k in length. First the output was TELNET and then a UART (virtual com port).

In both case the files were completely printed.

This was using my most up-to-date development version (shouldn't make any difference but simulating a SAM7X processor). I will next try the LPC release version to verify.
Update: I repeated tests with the LPC2XXX release from 5.1.2010 via TELNET and UART and in both cases the print sent the full file content (about 6k). This means that I can't reproduce any restriction at the moment - can you repeat over TELNET to see whether there is maybe a difference?

Regards

Mark

Note also this post with a correction which may be useful for your work: http://www.utasker.com/forum/index.php?topic=939.msg4283#msg4283
« Last Edit: June 25, 2010, 11:24:17 PM by mark »

Offline Kevin

  • Newbie
  • *
  • Posts: 30
    • View Profile
Re: SD Card using demo file print command limited to 4096 byte files
« Reply #4 on: July 01, 2010, 03:35:41 AM »
Mark-

I tried it out on a previous version (prior to adding my first task) and print works great with both uart and telnet.

Sorry, I should have checked first.

-Kevin

Offline Kevin

  • Newbie
  • *
  • Posts: 30
    • View Profile
Re: SD Card using demo file print command limited to 4096 byte files
« Reply #5 on: July 05, 2010, 03:36:25 PM »
Mark-

Sometimes it works, sometimes not.  

I went back and started with the original LPC V1.4

application.c - Seached for 192.168.0 and changed to local network address

config.h - un-comment #define LPC2478FBD208
config.h - comment //  #define LPC2378FBD144

http://www.utasker.com/forum/index.php?topic=690.msg4208#msg4208

1) In webInterface.c. At every conditional define for SUPPORT_GLCD  add also || defined SUPPORT_TFT  {4 locations if I counted correctly}

2) In app_user_files.h. At every conditional define for SUPPORT_GLCD add also || defined SUPPORT_TFT {2 locations}


FTP Put text files in D:/dir1.

Files over 4096 bytes give me "READ ERROR occured". in telnet (Uart not working in the simulator)

When compiling I get 2 warnings (no errors)


c:\documents and settings\kevin\my documents\downloads\development\utasker\utaskerv1.4_lpc\applications\aabv1-0\tft.c(406) : warning C4244: 'initializing' : conversion from 'unsigned long' to 'unsigned short', possible loss of data

c:\documents and settings\kevin\my documents\downloads\development\utasker\utaskerv1.4_lpc\utasker\utfat\mass_storage.c(2637) : warning C4146: unary minus operator applied to unsigned type, result still unsigned

-Kevin
« Last Edit: July 05, 2010, 03:38:34 PM by Kevin »

Offline Kevin

  • Newbie
  • *
  • Posts: 30
    • View Profile
Re: SD Card using demo file print command limited to 4096 byte files
« Reply #6 on: July 05, 2010, 03:44:34 PM »
The READ error seems to be file/pattern dependent.

I can print f430_320x240_24.bmp  with no read error, but uTasker_320x240.bmp gives me a READ ERROR.

-Kevin

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3236
    • View Profile
    • uTasker
Re: SD Card using demo file print command limited to 4096 byte files
« Reply #7 on: July 05, 2010, 05:18:25 PM »
Hi Kevin

At the moment I an working on adding "picture frame" operation to the project. This allows a certain directory on an SD card to be created and filled with BMP images (the copy can take place with the SD card in a PC or in the board via FTP or via USB Mass Storage device [i.e. the SD card looks like a memory stick to the PC]).

When the directory is found and the images are valid they will be displayed one after the other (slide show) on the TFT display (also can be viewed via web browser directly from TFT display content - nothing new here though).

This means that I will be more or less repeating the steps that you have been trying (in simulator and on HW target). Once I know how things go I will be able to report on any difficulties involved, which may help explain what you are experiencing(?). In the mean time ensure that you also have all patches mentioned here: http://www.utasker.com/forum/index.php?topic=792.0

Regards

Mark

Offline Kevin

  • Newbie
  • *
  • Posts: 30
    • View Profile
Re: SD Card using demo file print command limited to 4096 byte files
« Reply #8 on: July 05, 2010, 08:16:30 PM »
Mark-

I applied all the patches (except 7a because it would not compile).  

With he changes, even the f430_320x240_24.bmp cannot print without the read errors.  utasker320x240.bmp runs about 1/2 way through before the read error happens.



I added an extra command to the disk commands called view (DO_VIEW_FILE) which works pretty well except for the read errors.

I'm just adding a view file command to the print file command in debug.c


                 if (DO_VIEW_FILE == ucType) {                     // {kevin 1}
                  fnDisplayBitmap(ucTemp, utFile.usLastReadWriteLength);   // {kevin 1} display bmp on tft
               }                                          // {kevin 1}
               else {                                       // {kevin 1}
                  for (iLoop = 0; iLoop < utFile.usLastReadWriteLength; iLoop++) {
                     if ((ucTemp[iLoop] < 0x0a) || (ucTemp[iLoop] > 'z')) {
                        ucTemp[iLoop] = '.';                         // non-printable characters replaced
                     }
                  }
                       fnWrite(DebugHandle, ucTemp, utFile.usLastReadWriteLength); // print the read data buffer
               }                                          // {kevin 1}
« Last Edit: July 05, 2010, 08:19:41 PM by Kevin »

Offline Kevin

  • Newbie
  • *
  • Posts: 30
    • View Profile
Re: SD Card using demo file print command limited to 4096 byte files
« Reply #9 on: July 06, 2010, 01:07:44 PM »
This morning I tried re-formatting the sd card and everything started working!  (note this is all in the simulator).

I added DO_VIEW_FILE to the debug command list, ftp the bmp files to the sd-card and type "view [file.bmp]" and the picture shows up on the simulator tft display.

Next, I'm going to try compiling for the target (after hooking up the spi bus to the sd card).

-Kevin

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3236
    • View Profile
    • uTasker
Re: SD Card using demo file print command limited to 4096 byte files
« Reply #10 on: July 07, 2010, 11:29:35 AM »
Hi Kevin

If corruption takes place a re-format will always solve it. It is possible to send me the SD_CARD.bin file if you do have the feeling that something is not right since I may then be able to identify what has gone wrong.

I have now realised a "picture frame" demo in a new project where the BMPs are stored in a directory on the SD card. I simulated this and also ran it on the HW where both worked the same. Note that the SD card simulator slows down as the size of the data increases - this is due to the fact that each access requires a search through increasingly large amounts of data in a file but it is accurate without requiring large amounts of simulation memory space.

Hopefully your HW runs well too!

Regards

Mark