Page 4 of 7 FirstFirst 1234567 LastLast
Results 31 to 40 of 64

Thread: Bioloid Premium CM530 Help

  1. #31

    Re: Bioloid Premium CM530 Help

    It's all good.
    We've actually researched the CM510 Controller a bit, and we've decided to order that and use it. We've looked at the library and some of the examples and personally I'm wondering why this wasn't used for the CM530 as well? Or at least made backwards-compatible. It's so simple! I've been dabbling in C for the past year but this simplifies what we've dealt with for the past month so much.
    I was curious if you have any good websites, documents, or example libraries/projects for the CM510 that we could read? I've already been looking around the Google-sphere and saw your post about some CM5 SDK, tried to find it but to no avail. Also, is there an SDK for the CM510 Embedded-C?

  2. #32

    Re: Bioloid Premium CM530 Help

    Upon examining these examples a bit more, I noticed pretty much all of the use #include <avr/*> so.. Obviously we, or I, don't have or know what this AVR library is, but I'm assuming it's from the AVR Studio or something. I'm going to try and see if I can download and set it up on my Mac, but, as with all my endeavors with Embedded C and products from Robotis, I will probably need some help from you (Cheers!).

  3. #33
    Join Date
    Sep 2010
    Location
    ಠ_ಠ
    Posts
    2,283
    Images
    27
    Rep Power
    275

    Re: Bioloid Premium CM530 Help

    avr-gcc and avr-libc, although AVR Studio can be used with a bit of effort.

    The CM-510 uses an ATmega2561, which is an 8-bit 16MHz AVR microcontroller.
    The CM-530 uses an STM32, which is a 32-bit 72MHz ARM Cortex-M3 microcontroller.
    Big difference in processing power and programming requirements. The AVR core and all processors are made by a single company (Atmel), while the ARM core architecture is licensed to multiple companies that all add their own peripherals and accessories to produce a wide variety of processors. Almost everything other than the ARM core requires the manufacturer's library to use and configure to work on the particular processor (clocks, memory, etc.).
    Please pardon the pedantry... and the profanity... and the convoluted speech pattern...
    "You have failed me, Brain!"
    bleh

  4. #34

    Re: Bioloid Premium CM530 Help

    Alright, I mean we're just senior high school students, so I mean we're not going to be doing anything that needs a lot of processing power. Could you compare AVR to ARM on a more macro scale? I understand processing speed and the bit count, but for us, the ease of use with AVR as opposed to ARM outweighs the need for a faster processor and a higher bit-count.
    But would you happen to have any example programs for CM510? If not it's fine, it's so simple that I can probably write a little something based on the example program.

    And now for those questions I mentioned in my last post (lol):
    1. In the embedded_c(cm510....) folder, under the lib/ there's three files libdynamixel.a, libserial.a, and libzigbee.a, are these files needed at all for the program to function, because they're not included anywhere. (Going to Google what a .a file is.)
    2. Under the /src/ folder, there's three folders, Dynamixel, Serial, and Zigbee, why do they all have different Makefiles? Because I thought they were for the library, but obviously they must be their own separate pieces?.. Do they build into the lib+suffix.a?
    Last edited by Ech0riginal; 03-21-2013 at 08:06 AM.

  5. #35
    Join Date
    Sep 2010
    Location
    ಠ_ಠ
    Posts
    2,283
    Images
    27
    Rep Power
    275

    Re: Bioloid Premium CM530 Help

    The src directories contain the source code for each of the three libraries, and the makefiles are configured to compile and archive each library into its own static library file. The lib files are precompiled static libraries/archives that have to be linked against if you use only the library headers and do not compile the library source files directly into each program.

    I built an easy-function system for the CM-510/700 using the same design as the CM-530 stuff, but easier to get up and running because of the avr build system not needing lots of configuration like the STM32 does. It has not been pushed to github yet, but there is an older version on the Robotis Gallery site for one of the HaViMo2 blob tracking projects.

    We just posted some videos to the robotsource HaViMo2 forum comparing the CM-510, CM-530, and CM-900 in controlling a HaViMo2 while running mostly the same program built using RoboPlus Task, the embedded-c easy-functions, and the CM-900/Maple IDE (slightly modified dxl library).
    Please pardon the pedantry... and the profanity... and the convoluted speech pattern...
    "You have failed me, Brain!"
    bleh

  6. #36

    Re: Bioloid Premium CM530 Help

    Can you explain something to me? By the way I love the code for the CM510, it's soo much more simple and easy to use. But I am a bit confused on how exactly this example works, I know what it does, but I"m curious as to the HOW:
    Code:
    int main(void) {
      DDRC  = 0x7F;
      PORTC = 0x7E;
        while (1) {
          int i;
          for(i = 0; i <= 6; i++) {
            PORTC = ~(1<<i);
            _delay_ms(250);
          }
        }
      return 1;
    }
    1. What does the PORTC = ~(1<<i) do? I know that << means a left-shift bitwise op, but.. Not too familiar with bitwise operations. ( I know that ~ is a bitwise NOT)
    2. Obviously the _delay_ms(250) causes a 250ms delay, but how do the line above it make an LED turn on? Because all it's doing is pushing the leftmost bit into PORTC.. I don't see how that makes the LED pin set to 1.
    3. How does it even set a Pin to 1? Or back to 0??.. There's no code in here that even specifies pins and which one should be on or not, so how does it know? Or am I missing some HUUGELY obvious thing?..

  7. #37
    Join Date
    Sep 2010
    Location
    ಠ_ಠ
    Posts
    2,283
    Images
    27
    Rep Power
    275

    Re: Bioloid Premium CM530 Help

    In AVR: DDRn is Data Direction (Control) Register (set bit for output, clear bit for input), PORTn sets pin state (set bit for high output, clear bit for low output; set bit for internal pull-up resistor on input, clear bit to disable pull-up resistor - High-Z input), and PINn reads pin states (and toggles state if set). The LEDs are actually controlled through PNP transistors that invert the pin state (set bit for off, clear bit for on) (all pins default to high-z inputs at reset, so will float and keep LEDs turned off until direction and state are changed by user code).

    All the pins and ports should be defined/declared in the the CM-510 schematic and pinmap on the Robotis support site (also in the easy-functions at the top of cm510.c).

    Basically, the code sets all the bits (corresponding to pins) of the DDR of the port to which all the LEDs are connected to be outputs. Then it sets all those outputs to be high, which turns off all LEDs (inverted by PNP). Then it starts an infinite loop. The "1<<n" is bitshift left (multiply 1 by 2^n), "1>>n" would be bitshift right (divide 1 by 2^n). The "~" command inverts the 8-bit variable to set the desired pin's output to be low (LED on) while keeping all other pins high (LEDs off) ("1<<0" => "0000 0001" => "1111 1110"). This enables only a single LED to be on at a given point in time and easily cycle through them without manually declaring each pin with a bunch of if-else statements or a sequence of manually setting the PORT then delaying.
    Please pardon the pedantry... and the profanity... and the convoluted speech pattern...
    "You have failed me, Brain!"
    bleh

  8. #38

    Re: Bioloid Premium CM530 Help

    Wow that was confusing.. This is why I'm going into computer software, not hardware haha. Is the CM-510.c files on your github repo now?
    So... To turn on a single LED, without any iteration throughout the other LEDS, I have just use:
    Code:
    int LED = 5;  // 5th LED
    PORTC = ~(1<<LED);
    Last edited by Ech0riginal; 03-22-2013 at 12:25 PM.

  9. #39
    Join Date
    Sep 2010
    Location
    ಠ_ಠ
    Posts
    2,283
    Images
    27
    Rep Power
    275

    Re: Bioloid Premium CM530 Help

    Pretty much. Although, that will also turn off all other LEDs that might be on already. If you want to turn on an LED without modifying any others, then you would use:
    Code:
    int LED = 5;
    PORTC &= ~(1<<LED);  // Clear only pin of interest by AND'ing with one's complement
    and to turn off a single LED without affecting others, you would use:
    Code:
    int LED = 5;
    PORTC |= (1<<LED);  // Set only pin of interest by OR'ing
    Just pushed it to a new repo, but might not work too well as I have not tested it in a bit (does not compile if you attempt to use "util/delay.h"). The countdown timer (TIMER5) was definitely set to the wrong clock divisor and/or counter limit, but it may be fixed now (do not have a CM-510 with me to test the change right now - lazy day at home).


    Edit: Although it was a bit annoying at the time, I'm glad we had to learn microcontrollers using assembly (Motorola 68HC11 in 2009/2010). The biggest annoyance was that when the software used to compile the programs (and eventually upload) them would crash, it would delete all your work.
    Last edited by tician; 03-22-2013 at 01:08 PM.
    Please pardon the pedantry... and the profanity... and the convoluted speech pattern...
    "You have failed me, Brain!"
    bleh

  10. #40
    Join Date
    Sep 2010
    Location
    ಠ_ಠ
    Posts
    2,283
    Images
    27
    Rep Power
    275

    Re: Bioloid Premium CM530 Help

    Also just pushed a restructured version of the cm530 easy-functions repo to try to keep the library separate from the applications, so I don't have to keep track of multiple versions of the library. It's a start...
    Please pardon the pedantry... and the profanity... and the convoluted speech pattern...
    "You have failed me, Brain!"
    bleh

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Premium Bioloid Kit with AX-S1
    By Hellfire in forum Robotics General Discussion
    Replies: 1
    Last Post: 02-27-2012, 10:12 PM
  2. Bioloid Premium Kit for Sale
    By Dizzer in forum Garage Sale
    Replies: 4
    Last Post: 02-09-2012, 08:19 PM
  3. WTB - Bioloid Premium
    By xnonox in forum Garage Sale
    Replies: 3
    Last Post: 12-27-2011, 11:22 PM
  4. Bioloid Premium for sale
    By RoboFlop in forum Garage Sale
    Replies: 0
    Last Post: 02-25-2011, 10:40 AM
  5. Bioloid Premium Kit
    By cdraptor in forum Robotics General Discussion
    Replies: 3
    Last Post: 08-05-2009, 11:26 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •