Legacy Forum: Preserving Nearly 20 Years of Community History - A Time Capsule of Discussions, Memories, and Shared Experiences.

example.c problems

Bioloid robot kit from Korean company Robotis; CM5 controller block, AX12 servos..
8 postsPage 1 of 1
8 postsPage 1 of 1

example.c problems

Post by Ess » Thu Apr 02, 2009 11:18 am

Post by Ess
Thu Apr 02, 2009 11:18 am

Hi! i´m new in this forum and i´m spanish so i apologize for my poor English :oops: (blessed google! :wink: )

I am doing my final thesis project with Bioloid (starting)

I need to program with c/c++ so i start with example.c, but i have a problem and i dont find it.

This is what i did: (all software for bioloid and drivers installed and runing perfectly)

1. installed winavr
2. open proyect example
3. modify makefile (target "example" source "the route of example.c")
4. compile (no errors, all right)
5. run robot terminal (ok, conects)
6. enter boot loader (ok)
7. load (enter file .hex and transmit, ok)
8. go! (the program starts, press any key..)
9 pressed key and it starts

Ok, now the program dont find any dinamixel (but one is conected, (and is ok, and i tried with others and the conectors)

in tx it sends ok but in rx it dont! and says "[Error : Rxd timeout ]
this happens with all rx, Len is 00, and dinamixels have a little little torque.

the cm5 is connected by an usb to serial adapter. and i try in two computers.

I dont know what is happend and i´m stacked with this!

Help me please!!!!

Thanks a lot!!!
Hi! i´m new in this forum and i´m spanish so i apologize for my poor English :oops: (blessed google! :wink: )

I am doing my final thesis project with Bioloid (starting)

I need to program with c/c++ so i start with example.c, but i have a problem and i dont find it.

This is what i did: (all software for bioloid and drivers installed and runing perfectly)

1. installed winavr
2. open proyect example
3. modify makefile (target "example" source "the route of example.c")
4. compile (no errors, all right)
5. run robot terminal (ok, conects)
6. enter boot loader (ok)
7. load (enter file .hex and transmit, ok)
8. go! (the program starts, press any key..)
9 pressed key and it starts

Ok, now the program dont find any dinamixel (but one is conected, (and is ok, and i tried with others and the conectors)

in tx it sends ok but in rx it dont! and says "[Error : Rxd timeout ]
this happens with all rx, Len is 00, and dinamixels have a little little torque.

the cm5 is connected by an usb to serial adapter. and i try in two computers.

I dont know what is happend and i´m stacked with this!

Help me please!!!!

Thanks a lot!!!
Ess
Robot Builder
Robot Builder
Posts: 21
Joined: Tue Mar 31, 2009 5:19 pm

Post by Dewey » Thu Apr 02, 2009 6:05 pm

Post by Dewey
Thu Apr 02, 2009 6:05 pm

Example.c sets the RS232 baud rate to 57600 which is OK.

It also sets the RS485 baud rate (the dynamixel bus) to 57600 baud. This is NOT Ok as by default the AX12s are set to 1000000 baud! So you won't be able to talk to them.

You can alter either Example.c to 1000000 baud or 'reprogram' the AX12s to 57600 baud.

Actually Example.c is full of errors and is best avoided, download the C code/toolkit developed here by Stuart and Matt. See the libavr/libbiooid topic.

Dewey
Example.c sets the RS232 baud rate to 57600 which is OK.

It also sets the RS485 baud rate (the dynamixel bus) to 57600 baud. This is NOT Ok as by default the AX12s are set to 1000000 baud! So you won't be able to talk to them.

You can alter either Example.c to 1000000 baud or 'reprogram' the AX12s to 57600 baud.

Actually Example.c is full of errors and is best avoided, download the C code/toolkit developed here by Stuart and Matt. See the libavr/libbiooid topic.

Dewey
Dewey
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 78
Joined: Sat May 12, 2007 1:17 pm
Location: Worcester UK

Post by Ess » Thu Apr 02, 2009 6:34 pm

Post by Ess
Thu Apr 02, 2009 6:34 pm

Thanks!!!!

Ok, but i´m with example.c to see it working (it´s suposed to work :roll:)

its my first attempt, the next is the libbioloid:)

Thanks a lot!!!

:D :D :D :D :D :D :D :D :D :D :D :D :D
Thanks!!!!

Ok, but i´m with example.c to see it working (it´s suposed to work :roll:)

its my first attempt, the next is the libbioloid:)

Thanks a lot!!!

:D :D :D :D :D :D :D :D :D :D :D :D :D
Ess
Robot Builder
Robot Builder
Posts: 21
Joined: Tue Mar 31, 2009 5:19 pm

Post by siempre.aprendiendo » Thu Apr 02, 2009 6:49 pm

Post by siempre.aprendiendo
Thu Apr 02, 2009 6:49 pm

I think that for the first tests it's easier to use the serial cable to use the example.c, at least until you have more experience with it.

The example.c it's no a wonderful way to learn, but it works. There are other examples/APIs here and here. Some of them based on the example.c but more clear.

(Spanish)
Creo que para las primeras pruebas es más fácil usar el cable serie con el example.c, al menos hasta que tengas más experiencia.

El ejemplo.c no es maravilloso modo de aprender, pero funciona. Hay otros ejemplos/APIs. Algunos de ellos basados en el ejemplo.c, pero más claros.
I think that for the first tests it's easier to use the serial cable to use the example.c, at least until you have more experience with it.

The example.c it's no a wonderful way to learn, but it works. There are other examples/APIs here and here. Some of them based on the example.c but more clear.

(Spanish)
Creo que para las primeras pruebas es más fácil usar el cable serie con el example.c, al menos hasta que tengas más experiencia.

El ejemplo.c no es maravilloso modo de aprender, pero funciona. Hay otros ejemplos/APIs. Algunos de ellos basados en el ejemplo.c, pero más claros.
siempre.aprendiendo
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 559
Joined: Wed Aug 08, 2007 9:13 pm
Location: Barcelona

Post by Ess » Wed Apr 15, 2009 6:08 pm

Post by Ess
Wed Apr 15, 2009 6:08 pm

Dewey wrote:Example.c sets the RS232 baud rate to 57600 which is OK.

It also sets the RS485 baud rate (the dynamixel bus) to 57600 baud. This is NOT Ok as by default the AX12s are set to 1000000 baud! So you won't be able to talk to them.

You can alter either Example.c to 1000000 baud or 'reprogram' the AX12s to 57600 baud.

Actually Example.c is full of errors and is best avoided, download the C code/toolkit developed here by Stuart and Matt. See the libavr/libbiooid topic.

Dewey


ok, back to work, and reading the code :

SerialInitialize(SERIAL_PORT0,DEFAULT_BAUD_RATE,RX_INTERRUPT);//RS485 Initializing(RxInterrupt)

and DEFAULT_BAUD_RATE is 34 at 16Mhz (clock of atmega i supose) for 57600 bps

watching the sheet of atmega it says ubrr +1 =fosc(16mhz?) / (16or8or2) * baudrate (57600bps?)

i don´t found the prescaler in the code.

how it works?? what value should use in ubrr for 1mbps?

thanks!!!
Dewey wrote:Example.c sets the RS232 baud rate to 57600 which is OK.

It also sets the RS485 baud rate (the dynamixel bus) to 57600 baud. This is NOT Ok as by default the AX12s are set to 1000000 baud! So you won't be able to talk to them.

You can alter either Example.c to 1000000 baud or 'reprogram' the AX12s to 57600 baud.

Actually Example.c is full of errors and is best avoided, download the C code/toolkit developed here by Stuart and Matt. See the libavr/libbiooid topic.

Dewey


ok, back to work, and reading the code :

SerialInitialize(SERIAL_PORT0,DEFAULT_BAUD_RATE,RX_INTERRUPT);//RS485 Initializing(RxInterrupt)

and DEFAULT_BAUD_RATE is 34 at 16Mhz (clock of atmega i supose) for 57600 bps

watching the sheet of atmega it says ubrr +1 =fosc(16mhz?) / (16or8or2) * baudrate (57600bps?)

i don´t found the prescaler in the code.

how it works?? what value should use in ubrr for 1mbps?

thanks!!!
Ess
Robot Builder
Robot Builder
Posts: 21
Joined: Tue Mar 31, 2009 5:19 pm

Post by siempre.aprendiendo » Wed Apr 15, 2009 6:26 pm

Post by siempre.aprendiendo
Wed Apr 15, 2009 6:26 pm

Did you test it with the serial cable?

It doesn't matter! I misunderstand your problem...
Did you test it with the serial cable?

It doesn't matter! I misunderstand your problem...
Last edited by siempre.aprendiendo on Thu Apr 16, 2009 7:31 pm, edited 1 time in total.
siempre.aprendiendo
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 559
Joined: Wed Aug 08, 2007 9:13 pm
Location: Barcelona

Post by Bullit » Thu Apr 16, 2009 4:03 am

Post by Bullit
Thu Apr 16, 2009 4:03 am

Set to 1 for 1Mbaud.
Set to 1 for 1Mbaud.
Bullit
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 291
Joined: Wed May 31, 2006 1:00 am
Location: Near robot

Post by Ess » Thu Apr 16, 2009 11:10 am

Post by Ess
Thu Apr 16, 2009 11:10 am

I tried setting the value to 1 but it doesnt works :x

Code: Select all
int main(void)
{
  byte bCount,bID, bTxPacketLength,bRxPacketLength;
 
  PortInitialize(); //Port In/Out Direction Definition
  RS485_RXD; //Set RS485 Direction to Input State.
  SerialInitialize(SERIAL_PORT0,1,RX_INTERRUPT);//RS485 Initializing(RxInterrupt)       HERE!!
  SerialInitialize(SERIAL_PORT1,DEFAULT_BAUD_RATE,0); //RS232 Initializing(None Interrupt)
 
  gbRxBufferReadPointer = gbRxBufferWritePointer = 0;  //RS485 RxBuffer Clearing.
:cry:
I tried setting the value to 1 but it doesnt works :x

Code: Select all
int main(void)
{
  byte bCount,bID, bTxPacketLength,bRxPacketLength;
 
  PortInitialize(); //Port In/Out Direction Definition
  RS485_RXD; //Set RS485 Direction to Input State.
  SerialInitialize(SERIAL_PORT0,1,RX_INTERRUPT);//RS485 Initializing(RxInterrupt)       HERE!!
  SerialInitialize(SERIAL_PORT1,DEFAULT_BAUD_RATE,0); //RS232 Initializing(None Interrupt)
 
  gbRxBufferReadPointer = gbRxBufferWritePointer = 0;  //RS485 RxBuffer Clearing.
:cry:
Ess
Robot Builder
Robot Builder
Posts: 21
Joined: Tue Mar 31, 2009 5:19 pm


8 postsPage 1 of 1
8 postsPage 1 of 1