Welcome, Guest. Please Login.
Surveyor Corporation Surveyor SRV-1
Home Help Search Login

Surveyor Robotics Forum

Welcome to the user support forum for Surveyor SRV-1 robots, SRV-1 robot controllers and SVS stereo vision systems. To register for this forum, please send an email to support@surveyor.com which includes your desired forum user name, your registration email address, and a brief explanation of why you wish to join, and we will create a forum account for you.

Please note that there is a Search button in the forum toolbar for forum topics. Another effective search method for the entire surveyor.com site is to use Google, e.g. "xyz site://www.surveyor.com" where "xyz" is the search topic.



Pages: 1 2 3 4
Send Topic Print
Executing C-programs (Read 31730 times)
Erik
YaBB Newbies
*




Posts: 11
Executing C-programs
03/06/08 at 9:35am
 
Hi
 
I am now using the shamcom program to communicate with the SRV. I am already able to put my C-program into the flashbuffer,
and the 'zw' command seems to write the program to a flash sector. However, when I press 'Q' then, the program seems to crash
(I can't do nothing for over 2 minutes, and the C-test.c program isn't that heavy. the terminal won't accept any input)
 
What am I doing wrong? If you have a suggestion, it would really help my team a lot.  
 
Erik
 
P.S should it matter, my OS is windows XP
Back to top
 
 
  IP Logged
admin
YaBB Administrator
*****




Posts: 3676
Re: Executing C-programs
Reply #1 - 03/06/08 at 9:53am
 
Something to check first is that your C program is actually in the flash buffer.  You use the 'zd' command to view the contents of the flash buffer.
 
One thought is to add print() statements to your program to monitor its progress along the way, e.g.
 
 
print("checkpoint 1");
...
...
print("checkpoint 2");
...
...
etc.
Back to top
 
 

SRV-1 Development Team
Surveyor Corporation
Email WWW   IP Logged
Erik
YaBB Newbies
*




Posts: 11
Re: Executing C-programs
Reply #2 - 03/06/08 at 10:17am
 
I used the zd command, which returned the C-code, followed by some squares.
I included the printf("checkpoints"), but I am pretty sure the C-code is okay (it is one of your demos, c-test.c)
 
P.S Does the Q command executes a c-program stored in a flash sector or in the flash buffer? I thaught it executed a c-program in
a flash sector, but http://www.surveyor.com/blackfin/SRV_protocol_bf.html says otherwise...
 
Thnx
 
E.
Back to top
 
 
  IP Logged
admin
YaBB Administrator
*****




Posts: 3676
Re: Executing C-programs
Reply #3 - 03/06/08 at 10:31am
 
'Q' executes from the memory buffer, not directly from flash memory.  An earlier version of firmware worked as you describe, but that's been changed, and today we updated http://www.surveyor.com/blackfin/SRV_protocol_bf.html to correctly describe the way it now functions.
Back to top
 
 

SRV-1 Development Team
Surveyor Corporation
Email WWW   IP Logged
Erik
YaBB Newbies
*




Posts: 11
Re: Executing C-programs
Reply #4 - 03/09/08 at 5:29am
 
Okay
 
So now I put my C-program (code: see below) into the flash buffer using 'X' and checked with 'zd' that the program was successfully
uploaded to the buffer (which seemed to be the case).
However, 'Q' still resulted in my connection crashing.
 
this is the code of my program, main.c, which should resolve in the robot spinning around its axis.
 
int main()
{
motors(50, -50);
return 0;
}
Back to top
 
 
  IP Logged
admin
YaBB Administrator
*****




Posts: 3676
Re: Executing C-programs
Reply #5 - 03/09/08 at 10:45am
 
Try without the 'int' declaration -
 
main() {
  motors(50, -50);
  delay(1000);
  motors(0, 0);
}
Back to top
 
 

SRV-1 Development Team
Surveyor Corporation
Email WWW   IP Logged
Erik
YaBB Newbies
*




Posts: 11
Re: Executing C-programs
Reply #6 - 03/11/08 at 10:16am
 
Right
 
I removed the "int" from my program, so now I have that simple 5-line program you suggested.
However, Q still does nothing.
 
I thaught maybe the blackfin firmware was out-of-date, so I uploaded a recent version of it (10 march 2008).
This did not seem to solve the problem...
 
 
P.S After I press Q, the robot is completely jammed, so I have to power it off. My guess is that the blackfin tries to run the C-program, but gets stuck doing so...?
Back to top
 
 
  IP Logged
admin
YaBB Administrator
*****




Posts: 3676
Re: Executing C-programs
Reply #7 - 03/11/08 at 10:39am
 
I don't think this would cause a problem, but try to get rid of any CR (carriage returns) from your file and make certain there is a LF after the closing bracket }
 
Back to top
 
 

SRV-1 Development Team
Surveyor Corporation
Email WWW   IP Logged
Erik
YaBB Newbies
*




Posts: 11
Re: Executing C-programs
Reply #8 - 03/11/08 at 11:23am
 
hm, now I get a "function undefined" message. (and no input can be interpreted afterwards).
Back to top
 
 
  IP Logged
admin
YaBB Administrator
*****




Posts: 3676
Re: Executing C-programs
Reply #9 - 03/11/08 at 12:48pm
 
You might just try to upload and run C-test.c from the source archive to see what happens.  I suspect either a problem with the upload process or something wrong with the file.  You could also try using the new 'E' command to invoke the line editor and  directly enter you C code.  The editor has some issues, but you should be able to insert text without too much trouble.
Back to top
 
 

SRV-1 Development Team
Surveyor Corporation
Email WWW   IP Logged
Erik
YaBB Newbies
*




Posts: 11
Re: Executing C-programs
Reply #10 - 03/12/08 at 8:16am
 
I uploaded C-test.c, which seemed to be no problem. When reading out the flash-buffer content, I saw the program C-test.c,
followed by 10 arrows to the right.
 
Again, execution resulted in a crash.
 
I also tried writing the program directly via the 'E' command. (first 'zc' to clear the buffer, then 'E', 'I' and then:
main(){
print("hello");
exit(0);
}
 
after the last brace, I hit "enter", then "esc", then "X").
'zd' printed the program to the screen, this time without the arrows on the bottom.
However, the robot still crashed after hitting 'Q' .
 
P.S I also tried the program without the exit(0); line, but that didn't seem to matter much...
     when I put a "motors(0,50);" line in the program, I get a "unknown function" before the robot crashes, so I guess my  
     robot does try to read the C-program...
Back to top
 
 
  IP Logged
admin
YaBB Administrator
*****




Posts: 3676
Re: Executing C-programs
Reply #11 - 03/12/08 at 8:20am
 
There's no exit() function in this implementation.
 
Do you have more than one SRV-1 ?  If so, have you tried running this on a different one ?
  Also, what version of firmware are you now running ?
Back to top
 
 

SRV-1 Development Team
Surveyor Corporation
Email WWW   IP Logged
Erik
YaBB Newbies
*




Posts: 11
Re: Executing C-programs
Reply #12 - 03/12/08 at 8:39am
 
We only have one SRV, since we are given a limited budget Smiley
The firmware is  ##Version - TVM SRV-1 Blackfin w/C interpreter - 11:02:07 - Mar 10 2008
 
Back to top
 
 
  IP Logged
Erik
YaBB Newbies
*




Posts: 11
Re: Executing C-programs
Reply #13 - 03/12/08 at 8:42am
 
If I get a "unknown function" error when using the function motors,
could it be that there are no libraries installed on my SRV?
Are those libraries updated automatically together with the blackfin firmware?
Back to top
 
 
  IP Logged
admin
YaBB Administrator
*****




Posts: 3676
Re: Executing C-programs
Reply #14 - 03/12/08 at 9:13am
 
First send the 'V' command to confirm that you have a good connection.  You should see something like this -
 
##Version - SRV-1 Blackfin - 09:54:22 - Oct 10 2008 (stereo slave)
 
 
Then send the 'E' command to enter the line editor
 
E
(T)op (B)ottom (P)revious line (N)ext line (L)ist  
(I)nsert until ESC (D)elete line (H)elp (X)exit  
 
*  
*  
 
Then enter a simple program  -   send ESC to exit the Insert mode
 
* i
 
main()
{
print("hello");
}
 
*  
*  t             (points to top of buffer)
*  l             (lists the first 20 lines)
 
main()
{
print("hello");
}
 
* x    
leaving editor  
 
 
Then send the 'zd' command to display the contents of the flash buffer which holds the program
 
zd
##zdump:  
 
main()
{
print("hello");
}
 
 
Then send the 'Q' command to execute
Back to top
 
« Last Edit: 10/12/08 at 8:25am by admin »  

SRV-1 Development Team
Surveyor Corporation
Email WWW   IP Logged
Pages: 1 2 3 4
Send Topic Print