No announcement yet.

Problem with file_Run

  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem with file_Run

    I'm using a uLCD-32PTU[v4.4] with Picaso Designer and have been trying to call a program from the USB card using the file_Run function.

    What seems to be happening is file_Run returns straight away without calling the program. For testing the called program has a 3 line main routine that simply displays, or in this case doesn't display, a string using print. My calling program checks to see that the USB file exists before calling file_Run and reports that it does. Other file accesses, e.g. to sound files, are working fine. Also, I get the same (lack of) result with file_Exec. Memory available after the calling program loads is over 5000 and the stack is set to 1000.

    So to try and rule out any silly mistakes I might have made, I looked at the "Run From Disk" sample. I copied the .4XE files it uses to the USB card and compiled and loaded the sample to flash. The result is that the sample does not seem to be able to call the demo programs from disk either!

    The sample program displays its window with 4 buttons with 2 messages. At the top of the screen it prints "Memory available = 12674" and at the bottom of the window it prints "Disk mounted".

    If I click the top "R_CLOCK.4XE" button the message at the top of the screen is replaced by "R_CLOCK.4XE returned 0000" and the buttons are redisplayed. Pressing any of the other 3 buttons causes "Memory available = 12636" to be displayed at the top of the screen and again the buttons are redisplayed.

    Any ideas?

  • #2
    Small update. I have just tried both my program and the "Run from disk" sample on a uLCD-43PT[4.2] and both work OK. This seems odd as the sample seems to have been written for the 32PTU in the first place. The 43PT is out of a working bit of kit that I do not want to upset, so loath to update it to 4.4 in case that is the problem.


    • #3
      Are you definitely using an 8.3 filename in the file_Run function?
      What brand of uSD are you using?
      Can you show the output of a dir and a chkdsk run against the uSD?

      If you still can't figure it out zip up and attache both programs.

      Provided you don't use functions specific to a particular display, in general a Picaso program will run on any other Picaso display.


      • #4
        Mark. Thank you for your reply. I think you must already have the "Run From Disk" sample program as it is distributed with the Workshop 4 IDE. You can find it, along with pre-compiled versions of the 4 programs to be called, in the Picaso Designer samples folder. I've checked, and yes the file names assigned by 4D in this sample are all 8.3. When the sample works on the 43PT it is with the same uSD I'm using when your sample doesn't work on the 32PTU. Nevertheless, I have also copied the appropriate pre-compiled files from the sample onto 2 other cards with exactly the same results. I'm using 2Gb Transcend Micro cards, the same ones I've used with a dozen different 4D screens now. Never had any file accessing problems and my current project can read, write and create custom files on the 32PTU using all the cards I have tried in the course of trying to find a solution to this problem.


        • #5
          We strongly discourage using Transcend cards, they can cause all sorts of odd issues. Please try a different brand.

          If you still have problems, please zip up and attach the code that doesn't work, this is too unusual to expect it to be repeatable without exactly the same circumstances


          • #6
            Mark. Can you confirm that you do not have a copy of the sample code distributed by 4D with the IDE? If that is the case I will be glad to send you a copy.

            Also, could you please explain why I can read, write and create files on these cards on both 43PT and 32PTU displays and successfully use file_Run on the 43PT but not the 32PTU? Also, the same cards can be read and written by 3 different PCs, 2 tablets and a phone. Why would these 4D displays not be able to do what other devices have no trouble with? The evidence really does not seem to point to the uSD being the source of the problem unless file_Run implements file access in an entirely different fashion to that used by the other file operations. Is that the case?


            • #7
              I have a copy, but I know they work.

              I copied C:\Users\Public\Documents\4D Labs\Picaso Designer\COPY TO DISK to a uSD card
              I loaded C:\Users\Public\Documents\4D Labs\Picaso Designer\PICASO - RUN FROM DISK\R_RUNPROGRAM.4DG onto a uLCD-32PTU and ran it.

              All examples work fine.

              Our displays use SPI mode to access the uSD cards. TRANSCEND cards do not work properly in SPI mode. If you have an SPI mode card reader, try you Transcend cards in a standard PC, they don't work. Windows will keep telling you that cards have been unexpected removed. As I said they don't work properly, so sometimes they will appear to work, but eventually they will cause headaches.

              The only other possibility is that your 5v supply is closer to 3v, but I doubt you would have those sorts of issues

              BTW what PmmC release are you running?


              • #8
                As I said in my first and second posts, I'm using uLCD-32PTU[v4.4] and uLCD-43PT[v4.2] devices. I may try v4.4 firmware on the 43PT and see if that makes any difference because I have the PmmC file for v4.2 so I should be able to restore it if there is a problem. As I said, the 43PT is out of a working bit of kit that I don't want to mess up. This is the first time I have had cause to use a 32PTU or any of the smaller displays.
                All the tests have been powered by a lab grade PSU that is subject to annual calibration checks. Its display reads 5.000 volts and I'm inclined to believe it.
                Not sure what you mean by “Transcend cards do not work properly in SPI mode”. If you mean they do not stick to the physical layer specification 100%, that may be true, but very few things do. I wrote an SPI driver for uSD a few years ago, and as far as I can remember the only problem you get with some cards, Transcend may have been one of them, is that they violate the specification slightly by defaulting to CRC ON mode. This is not hard to work around. We used SPI to drive uSD because it is a mandatory part of the specification and end users tend to think that a uSD card is a uSD card unless it has fake stamped on it in big letters!
                As for PCs not being able to access Transcend uSD cards - I run Workshop 4 on one of 3 different PCs and write files to the uSD cards I use by sticking them in the slot on the front panel using a passive uSD to SD card adaptor.
                I will certainly try a different kind of card when I get the chance, but it may take a while. I'm not responsible for ordering consumables and the bean counters round here really like Transcend because of their bits/$ specification. However, I still don't understand why file_Run does not work when other file reads (and writes) are perfectly OK.


                • #9
                  Update: OK I seem to have found a simple work round for this that fixes both the sample and my original program (see attached code). It works on both the devices I have been testing with using the same Transcend card I started out with. Removing the mod causes the failure to reappear.

                  I'm happy now so I'll leave you in peace.