OpenServo.com Forum Index OpenServo.com
Discussion of the OpenServo project
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Best Way to Program

 
Post new topic   Reply to topic    OpenServo.com Forum Index -> Software
View previous topic :: View next topic  
Author Message
wpotter



Joined: 18 Jun 2010
Posts: 50
Location: Valencia, Spain

PostPosted: Mon Jun 21, 2010 9:40 am    Post subject: Best Way to Program Reply with quote

While I'm on a roll starting topics, I have another question that might be just based on opinion. I'm looking for an easy way to program my OpenServo V3 and I'm not sure whether it is easier to use AVRStudio and create a new version of the firmware, or whether it's better to use C++ command line and just control it through the OSIF.

Thoughts?
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
rotdrop



Joined: 15 Dec 2009
Posts: 16
Location: Germany, Ruhrpott

PostPosted: Tue Jun 22, 2010 7:27 am    Post subject: Reply with quote

The OSIF behaves like an USB-Tiny, however, at least the one I ordered from Robotfuzz uses 1964:0001 as vendor and product id. I found it necessary to patch avrdude in order to use it. Something like the patch below should work (avrdude-5.8 ). There is a note in the wiki how to set up the cabling:

http://www.openservo.com/OSIF_programmer

You have to use the _second_ variant ("First time firmware installation") to use the device with avrdude.

Hope this helps,

Claus

Addition: the following patch applies to avrdude-5.8, you can get it from

http://www.very-clever.com/download/nongnu/avrdude/avrdude-5.8.tar.gz.

Assuming you are using some flavour of Unix (FIXME: Cygwin under Windows?), you can do the following to apply the patch:


    1.) Fetch the avrdude sources

    2.) Copy and paste the patch from the code-listing below and save it under some name, say "blah.patch".

    3.) Unpack the source and apply the patch
    Code:

    tar xf avrdude-5.8.tar.gz
    cd avrdude-5.8
    patch -p0 -l < blah.patch

    The "-l" switch instructs the patch program to ignore white space characters.

    4.) Compile and install the package in the "usual" way, whatever that means.



Code:

--- usbtiny.c~  2009-03-06 21:09:11.000000000 +0100
+++ usbtiny.c   2010-01-03 22:30:30.545676687 +0100
@@ -206,8 +206,11 @@
   // now we iterate through all the busses and devices
   for ( bus = usb_busses; bus; bus = bus->next ) {
     for        ( dev = bus->devices; dev; dev = dev->next ) {
-      if (dev->descriptor.idVendor == USBTINY_VENDOR
-         && dev->descriptor.idProduct == USBTINY_PRODUCT ) {   // found match?
+      if ( ( dev->descriptor.idVendor == USBTINY_VENDOR
+            && dev->descriptor.idProduct == USBTINY_PRODUCT )
+          ||
+          ( dev->descriptor.idVendor == OSIF_VENDOR
+            && dev->descriptor.idProduct == OSIF_PRODUCT ) ) {   // found match?
 
        PDATA(pgm)->usb_handle = usb_open(dev);           // attempt to connect to device
 
@@ -222,8 +225,13 @@
   }
 
   if (!PDATA(pgm)->usb_handle) {
-    fprintf( stderr, "%s: Error: Could not find USBtiny device (0x%x/0x%x)\n",
-            progname, USBTINY_VENDOR, USBTINY_PRODUCT );
+    fprintf( stderr,
+            "%s: Error: \n"
+            "Could not find USBtiny device (0x%x/0x%x) "
+            "or OSIF device (0x%x/0x%x)\n",
+            progname,
+            USBTINY_VENDOR, USBTINY_PRODUCT,
+            OSIF_VENDOR, OSIF_PRODUCT );
     return -1;
   }
 
--- usbtiny.h~  2009-03-06 21:09:11.000000000 +0100
+++ usbtiny.h   2010-01-03 22:30:30.545676687 +0100
@@ -29,6 +29,9 @@
 #define USBTINY_VENDOR  0x1781
 #define USBTINY_PRODUCT 0x0C9F
 
+#define OSIF_VENDOR  0x1964
+#define OSIF_PRODUCT 0x0001
+
 // Generic requests to the USBtiny
 #define        USBTINY_ECHO         0      // echo test
 #define        USBTINY_READ         1      // read byte (wIndex:address)


Last edited by rotdrop on Tue Jun 22, 2010 1:46 pm; edited 4 times in total
Back to top
View user's profile Send private message Visit poster's website
wpotter



Joined: 18 Jun 2010
Posts: 50
Location: Valencia, Spain

PostPosted: Tue Jun 22, 2010 7:31 am    Post subject: Reply with quote

Thanks Claus,

I will give it a shot and let you know how it goes. Appreciate the help.

- Will
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
rotdrop



Joined: 15 Dec 2009
Posts: 16
Location: Germany, Ruhrpott

PostPosted: Tue Jun 22, 2010 9:38 am    Post subject: Reply with quote

Oops, actually, intentionally my previous post should have been a reply to this post

http://www.openservo.com/Forums/viewtopic.php?t=1040&highlight=

of yours. Also, my post was a little bit sparse. But obviously you know AVRDude, so: the USBTiny is one of the numerous programmers for the ATmega. After patching and compiling avrdude you should be able to program the Openservo V3 board through the OSIF using

avrdude -c usbtiny -p m168 [other stuff]

Claus
Back to top
View user's profile Send private message Visit poster's website
wpotter



Joined: 18 Jun 2010
Posts: 50
Location: Valencia, Spain

PostPosted: Tue Jun 22, 2010 9:42 am    Post subject: Reply with quote

Yes. I'm generally familiar with AVR programming, but I don't have that much experience, so I figured why spend time doing trial and error until it works, when I can just ask someone who knows how!

Thank you for your help!
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
Collard



Joined: 01 Mar 2011
Posts: 3
Location: USA

PostPosted: Mon Mar 07, 2011 12:41 pm    Post subject: Reply with quote

No, I am not well aware of this topic.
When I installed the AVR programming then it can't access the drive
_________________
Beacon Hill Homes for Sale
Back to top
View user's profile Send private message
johnlewis250



Joined: 08 May 2011
Posts: 1
Location: Los Angeles

PostPosted: Sun May 08, 2011 3:39 am    Post subject: Reply with quote

But why? i think that you need to search about AVR programming because i always use it.
_________________
xtreme no | xenadrine
Back to top
View user's profile Send private message Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic    OpenServo.com Forum Index -> Software All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group