Shop OBEX P1 Docs P2 Docs Learn Events
Timeout Error — Parallax Forums

Timeout Error

Hello, I'm trying to upload code to the Propeller Activity Board but am running into occasional issues with the "Verifying RAM" step. Certain programs seem to fail to verify.
I can successfully upload the "Follow with Ping" example, but with minor modifications it fails to Verify. This seems to me like either a driver issue of a RAM space issue (though with programs this small I don't know how it could be).

Here's the code modified from "Follow with Ping" that does upload and verify:
#include "simpletools.h"                      // Include simpletools header
#include "abdrive.h"                          // Include abdrive header
#include "ping.h"                             // Include ping header  

int distance, setPoint, errorVal, kp, speed;  // Navigation variables
int turn_d, last_d;
double alpha;
char did_turn;

int main()                                    // main function
{
  setPoint = 32;                              // Desired cm distance
  kp = -10;                                   // Proportional control
  turn_d = 200;
  did_turn = 0;
  //alpha = 0.2;
  
  last_d = ping_cm(8);  

  drive_setRampStep(6);
  while(1)                                    // main loop
  {
    distance = (int)(0.2*ping_cm(8) + 0.8*last_d);
    
    //if (distance>turn_d){
    //  did_turn = 1;
    //  drive_speed(64, -64); 
    //}      
    //while ((distance=ping_cm(8))>turn_d);
    //if (did_turn) { 
    //  did_turn = 0;
    //  distance = distance;
    //  drive_speed(0,0);
    //}
         
    errorVal = setPoint - distance;           // Calculate error
    speed = kp * errorVal;                    // Calculate correction speed

    if(speed > 128) speed = 128;              // Limit top speed
    if(speed < -128) speed = -128;

    drive_rampStep(speed, speed);             // Use result for following
    last_d = distance;
  }
}

And here's code that doesn't.
#include "simpletools.h"                      // Include simpletools header
#include "abdrive.h"                          // Include abdrive header
#include "ping.h"                             // Include ping header  

int distance, setPoint, errorVal, kp, speed;  // Navigation variables
int turn_d, last_d;
double alpha;
char did_turn;

int main()                                    // main function
{
  setPoint = 32;                              // Desired cm distance
  kp = -10;                                   // Proportional control
  turn_d = 200;
  did_turn = 0;
  //alpha = 0.2;
  
  last_d = ping_cm(8);  

  drive_setRampStep(6);
  while(1)                                    // main loop
  {
    distance = (int)(0.2*ping_cm(8) + 0.8*last_d);
    
    if (distance>turn_d){
      did_turn = 1;
      drive_speed(64, -64); 
    }      
    //while ((distance=ping_cm(8))>turn_d);
    //if (did_turn) { 
    //  did_turn = 0;
    //  distance = distance;
    //  drive_speed(0,0);
    //}
         
    errorVal = setPoint - distance;           // Calculate error
    speed = kp * errorVal;                    // Calculate correction speed

    if(speed > 128) speed = 128;              // Limit top speed
    if(speed < -128) speed = -128;

    drive_rampStep(speed, speed);             // Use result for following
    last_d = distance;
  }
}
with the following Build Rescue:
Project Directory: /Users/USER/Documents/SimpleIDE/

SimpleIDE Version 1.0.2
/Users/USER/Documents/SimpleIDE/Learn/Simple Libraries/
/Users/USER/Documents/SimpleIDE/ Updated on: 2016-01-03

propeller-elf-gcc -v GCC 4.6.1 (propellergcc_v1_0_0_2435)
propeller-elf-gcc -I . -L . -I /Users/USER/Documents/SimpleIDE/Learn/Simple Libraries/Utility/libsimpletools -L /Users/USER/Documents/SimpleIDE/Learn/Simple Libraries/Utility/libsimpletools/cmm/ -I /Users/USER/Documents/SimpleIDE/Learn/Simple Libraries/TextDevices/libsimpletext -L /Users/USER/Documents/SimpleIDE/Learn/Simple Libraries/TextDevices/libsimpletext/cmm/ -I /Users/USER/Documents/SimpleIDE/Learn/Simple Libraries/Protocol/libsimplei2c -L /Users/USER/Documents/SimpleIDE/Learn/Simple Libraries/Protocol/libsimplei2c/cmm/ -I /Users/USER/Documents/SimpleIDE/Learn/Simple Libraries/Robotics/ActivityBot/libabdrive -L /Users/USER/Documents/SimpleIDE/Learn/Simple Libraries/Robotics/ActivityBot/libabdrive/cmm/ -I /Users/USER/Documents/SimpleIDE/Learn/Simple Libraries/TextDevices/libfdserial -L /Users/USER/Documents/SimpleIDE/Learn/Simple Libraries/TextDevices/libfdserial/cmm/ -I /Users/USER/Documents/SimpleIDE/Learn/Simple Libraries/Sensor/libping -L /Users/USER/Documents/SimpleIDE/Learn/Simple Libraries/Sensor/libping/cmm/ -o cmm/Testing.elf -Os -mcmm -m32bit-doubles -fno-exceptions -std=c99 Testing.c -lm -lsimpletools -lsimpletext -lsimplei2c -labdrive -lfdserial -lping -lm -lsimpletools -lsimpletext -lsimplei2c -labdrive -lfdserial -lm -lsimpletools -lsimpletext -lsimplei2c -labdrive -lm -lsimpletools -lsimpletext -lsimplei2c -lm -lsimpletools -lsimpletext -lm -lsimpletools -lm
propeller-load -s cmm/Testing.elf
propeller-elf-objdump -h cmm/Testing.elf
Done. Build Succeeded!

propeller-load -Dreset=dtr -I /Applications/SimpleIDE.app/Contents/MacOS/../propeller-gcc/propeller-load/ -b ACTIVITYBOARD cmm/Testing.elf -e -r -p /dev/cu.usbserial-DAYUEMTYPropeller Version 1 on /dev/cu.usbserial-DAYUEMTY
Loading cmm/Testing.elf to EEPROM via hub memory
9292 bytes sent

Verifying RAM ... Timeout Error!
error: load failed
error: load failed

Timeout Error!
error: load failed
error: load failed

Any help would be greatly appreciated!

Comments

  • Hmmm, we've tried it on a couple Macs in the office, and both programs worked. Our tech support has not seen this particular behavior either.

    What Mac OS are you running, and which driver did you install?

    Do you have another (preferably different) computer available to try the programming the Propeller? This might give us an early indication of whether this particular behavior has a hardware or software cause.

    Andy
  • Which version of Simple IDE are you running? If I'm not mistaken Simple IDE for Mac has had a few revisions since it was first introduced. I would try download the latest version if you haven't done so already. I tried your code on my Mac a good amount of times with no errors and I know some of the staff Parallax did also.

    Miguel Rodriguez
    Parallax Tech Support
  • I just remembered seeing similar problems with certain USB hubs and FireWire to USB adapters. Are you programming through one of these devices, or directly from one of your Mac's on-board USB ports?
  • We are encountering a similar problem here (at a university with a lot of students using Mac computers who are seeing the SAME problem).

    My own machine is as follows: MacBook Pro (Retina, 15-inch, Late 2013), running El Capitan (10.11.2) with SimpleIDE 1.0.2 (RC2). No hub and or other peripheral devices are attached to the computer. The Propeller board is connected to /dev/cu.usbserial-DAYNP9AL

    I downloaded a fresh copy of the IDE from http://learn.parallax.com/propeller-c-set-simpleide/mac this morning to confirm that I am using the latest version.

    The issue we were seeing seemed to be related to the size of the file upload - with files above about 9300 bytes, the probability that the memory check would fail would rise. I checked out the source code for https://github.com/dbetz/propeller-load this morning. I instrumented PLoadLib.c to see what was happening (lines 363-377):

    for(n = 0; n < wv; n++) {
    if(tx(buf, 1) == 0) return 1;
    rc = getAck(&ack, 20);
    printf("n=%d, wv=%d, rc=%d, ack=%d\n", n, wv, rc, ack);
    if(ack) break;
    }

    /*
    * Check for a Timeout or Checksum Error
    */
    if(n >= wv) {
    if(pload_verbose)
    printf("Timeout Error n=%d, wv=%d!\n", n, wv);
    return 1;
    }

    I tried with the "Activity Bot Display Calibrate" program (which is one program which would not work). This compiles without error, but always fails with memory validation.

    Running the code gave:

    ====

    Verifying RAM ...
    n=0, wv=100, rc=1, ack=0
    n=1, wv=100, rc=1, ack=0
    n=2, wv=100, rc=1, ack=0

    ....

    n=97, wv=100, rc=1, ack=0
    n=98, wv=100, rc=1, ack=0
    n=99, wv=100, rc=1, ack=0
    Timeout Error n=100, wv=100!

    ====

    Upping the retry count to 1000 then gave:

    ====

    Verifying RAM ...
    n=0, wv=1000, rc=0, ack=0
    n=1, wv=1000, rc=0, ack=0

    .....

    n=133, wv=1000, rc=0, ack=0
    n=134, wv=1000, rc=0, ack=0
    n=135, wv=1000, rc=0, ack=0
    n=136, wv=1000, rc=0, ack=1
    OK

    ====

    Further tests suggest that roughly 130-140 retries were consistently required for this example. Therefore, there appears it be an issue with the timeout, at least on OSX.

    We did not experience these problems on a Windows 10 machine. A student is current building the propeller gcc toolchain and we will check to see the behaviour there.

  • Wow, thank you for the detailed information! Also, sorry about the problems; I will let our developers know right away and keep you posted on what we find.

    I'm assuming this is not going through a hub, just USB plugged straight into the Mac, right? The only other piece of info to verify would just be to verify that you are using the 2.2.18 driver from this page: http://www.ftdichip.com/Drivers/VCP.htm.

    Andy
  • Thanks. I thought I had the driver installed, but I'm not sure. I installed it again to be sure but kextstat doesn't list it right now. I won't have access to a board until tomorrow, but I'll check it then.

    I haven't heard back from the student who was working on Linux.
  • I updated to the new driver and I can confirm that I still see the same behaviour.
  • Thanks for the update. We are still working on it.

    I recently noticed that, in Windows, SimpleIDE sometimes starts timing out with load EEPROM until I use the Run with Terminal button. Then, it starts working again.

    With that in mind, I'm wondering if there's something quirky that might work as a temporary remedy while the developers work on something more permanent. That in mind, is there a possible relationship between PWR being in position 1 or 2? Does load RAM fail if used with SimpleIDE terminal open vs. closed? Does either Run with Terminal or Load EEPROM & run work consistently when Load RAM & Run fails?

    I sent some additional questions in a PM. Please check your forum inbox.

    Thanks, Andy
  • We had already tried these combinations early on when investigating the behaviour, and we saw no difference.
  • On your Mac, have you checked the Console for any Diagnostic and Usage Messages or anything under System Diagnostic Reports? Sometime this will give a clue as to where the issue is.

    The code seems to build and load on a QuickStart board using Simple IDE 1.0.2 (RC2) and a Mac running 10.9.5. Perhaps it is something to do with the newer Mac OS?
  • Hussein35Hussein35 Posts: 1
    edited 2016-02-01 14:38
    I had the same problem. I always got timeout error when trying ActivityBot Display Calibration.c
    Had the same problem with the code you posted.
    However after installing FTDI driver ,as mention above by Andy (but you should use version 2.3 for mac os x 10.9 and above instead of 2.2.18. http://www.ftdichip.com/Drivers/VCP/MacOSX/FTDIUSBSerialDriver_v2_3.dmg ), restarted my mac and both ActivityBot Display Calibration.c and your code were complied, uploaded and run without any error.

    I use MacBook Pro (Retina, 15-inch, Early 2013), running El Capitan (10.11.4 beta) with SimpleIDE 1.0.2 (RC2)
  • Apologies - I thought I had some kind of automatic notification, but I didn't.

    I upgraded to the 2.3 version of the driver and just tried it a few minutes ago. I didn't see any difference.
  • I had same issue (consistent timeout while loading display calibration example). MacBook Pro, OS X 10.11.5, VCP driver v 2.3, Simple IDE 1.0.2 RC2.
    My mac has 2 USB ports, it was failing very consistently with timeout on right side USB (one that close to HDMI), then i switched to left side USB (one that close to audio out) and it worked just fine. Then I switched to right side again and it seems to work fine on both sides now.
    Probably some kind of driver issue.
Sign In or Register to comment.