Test example using RC Servo (Eng)

From Neuromeka Wiki
Jump to: navigation, search


STEP BBB Test

  • User can control RC Servo Motor using STEP BBB.

Preparations

  1. STEP BBB
  2. NRMKFoundation & NRMKPlatform have to be installed in user PC.
  3. RC Servo Motor


Setting up test environment

1. Connect STEP BBB to user PC.
2. In RC Servo motor, connect G(PWR) / DIO5-1 / 5V(PWR).
STEP BBB RC servo test pic 000.png

3. Run Eclipse in NRMK Launcher -> Move to STEP BBB workspace(File->Switch Workspace)
STEP BBB RC servo test pic 001.png

4. Modify contents of 'GPMCCapeDAE/gpmccapedae.cpp' supported basically in STEPPlatform.

gpmccapedae.cpp

void gpmc_run(void *arg){

uint16_t val=0;
float t=0, f=100.0;
rt_task_set_periodic(NULL, TM_NOW, 5e6);

while(1){
...
//DIO demo
gpmc_cape_write_dio(5, 0x1f); //write DIO5
dio_in[5]=gpmc_cape_read_dio(6); //reading DIO6

//============================= add ============================
if(dio_in[5] == 1)
rt_task_sleep(2e6);
else if(dio_in[5] == 0)
rt_task_sleep(1e6);

gpmc_cape_write_dio(5, 0x00);
//==============================================================
...
}
}


int main(int argc, char *argv[]) {
...

//======================================== remove ========================================
uint16_t dio_param= (DIO_PuPd_DOWN<<PIN5_PULL_POS)|(DIO_PuPd_DOWN<<PIN4_PULL_POS)|(DIO_PuPd_DOWN<<PIN3_PULL_POS)|
(DIO_PuPd_DOWN<<PIN2_PULL_POS)|(DIO_PuPd_DOWN<<PIN1_PULL_POS); //all pull down
dio_param |=0x0000; //all IN
//========================================================================================

gpmc_cape_setup_dio(6, 0);
}


Test

1. Select project - Build Configurations - Set Active - Choose '2.Release'
2. Select project - Build Project - complete
3. Select project - Run As - Run Configurations - Create item of this project - run
STEP BBB RC servo test pic 002.png

4. If you run it at first time, you can see below popup. Enter 'root' value, then proceed continually.
STEP BBB RC servo test pic 005.png

5. While touching 3.3V and G to pin1 of input port DIO6 alternately, Observe rotation of RC Motor.
6. If it touched to 3.3v, motor is rotated to right. If it touched to G, motor is rotated to left.
7. You can observe signal using oscilloscope. Using 'G' and empty pin of DIO5, you can see data below.
STEP BBB RC servo test pic 003.png
Touch to 'G' -> Rotate to left.(It outputs signal of 1millisecond length every 5milliseconds)

STEP BBB RC servo test pic 004.png
Touch to 3.3V -> Rotate to right.(It outputs signal of 2millisecond length every 5milliseconds)