To control my camera module, I'm going to use a X-Y gimbal made from RC servos.

I will run the servos from the MiniZed.

To do this, I have modified the code from the IP training to run two RC servos instead (and addition to) the PL leds.

The new Vivado Block Design is as follows:

I added another instance of the IP PWM_w_Int, and connected it to PL_LED_G

The new address of the second PWM channel (Green LED) is 0x40002000:

The green and red PL LED pins are also available on the Arduino headers as A3 and A4 so I didn't have to add any new port definitions:

The Implementation schematic is shown below.

I stumbled upon the IO Bank definitions after getting many bitstream generation errors and set up the Green LED PWM2 on E13:

It turns out that theHW lab example code PWM period is set to 20ms, which is what RC servos use, so that didn't need to be changed.

The test code for setting a PWM pulse from 1ms (50,000 clock cycles) to 2ms (100,000 clock cycles) was changed to the following:

brightnessRed = (period * 5000)+50000;

brightnessGreed = (period * 5000)+50000;

#define PWM_BASE_ADDRESS               0x43C00000

#define PWM_BASE_ADDRESS2              0x40002000

Xil_Out32(PWM_BASE_ADDRESS, brightnessRed);

Xil_Out32(PWM_BASE_ADDRESS2, brightnessGreen);

A period value of 0 is now approx. -45deg servo travel (1000us pulse), and a period value of 10 is approx. +45deg servo travel (2000us pulse).

Here's my servo test setup:

Here's a scope trace of the PWM signal:

I may have to boost the PWM signal from 3.2V to 5VDC for the servos to operate consistently.

Currently the video streamer and the servo drivers are on two separate MiniZed boards, although I am trying to get everything to work together on one board.

**update 19 Jan

I added a level shifter to the AO3 and AO4 outputs and ran a short test program that runs the servos in sine wave patterns:

    for (i = 1; i < 3610; i++){

     Xil_Out32(PWM_BASE_ADDRESS,75000+(25000*sin(i*3.14/1800)));

     Xil_Out32(PWM_BASE_ADDRESS2,75000+(25000*sin(i*3.14/900)));

         for (i2 = 1; i2 < 40000; i2++){

         }

    }

   

Here's a video of the gimbal operating.