top of page

MicroZed Chronicles: Ultra96V2 and BLDC Motor Control.

I recently ran a build along with Hackster.io where we walked through how to get a simple BLDC motor up and running using the Avnet ZUBoard 1CG, the Brushless 3 click, and PetaLinux.



During the class, someone asked if they could follow along with the Ultra96-V2. The project is fairly simple because it primarily uses the PS and PetaLinux to control the motor using I2C. The tutorial is more about how to effectively work with PetaLinux in embedded systems. As a result, porting it to the Ultra96-V2 should be pretty simple although there are a few differences. It’s important to note that the Ultra96-V2 also has a Click Mezzanine which enables me to use the same Brushless 3 click.

 

The first thing we need to do is consider the differences between the ZUBoard and the Ultra96-V2. The main difference is in the I2C connectivity. On the ZUBoard, we connected to the I2C interfaces on the click by using AXI I2C controllers in the PL which means there is a direct connection between the PL IO pins and the click. By comparison, when working with the Ultra96-V2, we interface with the click via the Click Mezzanine which connects to the Ultra96-V2 via the low-speed connector.

 

The I2C connectivity to the low-speed connector is provided by the PS I2C1. However, this goes through a I2C switch which includes two channels for the two sites on the Click Mezzanine while other channels include the high-speed expansion connector, the USB, and PMIC.


The first thing to do is to create a new Vivado project and configure the processing system for the Ultra96-V2.

The project is simple for the Ultra96-V2 migration. We don’t need anything in the PL so we can re-customize the IP block and turn off the AXI PL masters.

 

We can then create the HDL wrapper and build the project, exporting the XSA to be used in the PetaLinux project.

 

The next step is to create a PetaLinux project and configure it for the hardware just exported from Vivado using the following commands:

 

petalinux-create -t project -n mz534  - -template ZynqMP
 
petalinux-config - -get-hardware-description=<path to XSA>

 

Within the resultant PetaLinux configuration dialog, we first need to change the stdin/stdout to use psu uart 1. 

I also want to use a USB Ethernet dongle to provide Ethernet capabilities. To do this, I need to enable a couple of device drivers and close the current configuration dialog and then save it.

 

Run the command petalinux-config -c kernel and the kernel dialog will open. Here we need to enable the following drivers, USB Modem (CDC ACM) Support and Ethernet .



We need to know the chipset in the USB dongle we are using. In this case, I’m using the TP Link dongle which uses the RTL8153 chipset.

Again, save the changes and exit the dialog. The next step is to add in the I2C tools to enable us to scan and work with the I2C network. These need to be included in the rootfs. To do this, we need to reconfigure the rootfs using the command petalinux-config -c rootfs into the rootfs we are going to include the I2C tools.

Exit and save this dialog and we can build the image with the command petalinux-build.

 

The next step is to put the image.ub boot.bin and boot.scr on a SD card, fit the Click Mezzanine and Brushless 3 click wired to the motor, and power on the system.

 

Once powered on, we can use the I2C tools to detect the I2C switch which controls the connection to the low-speed connector. If everything is working as expected we should be able to see it present at address 0x75.

We can then use Vitis to develop the SW application and this can be largely the same as it was for the ZUBoard with a couple of changes.

 

  1. We need to change the I2C device used to the only one present in the design i2c-0.

  2. Write a simple routine to select the I2C switch and configure it for the correct path.

 

With these simple changes, the same code we had working on the ZUBoard results in a working solution for the Ultra96-V2.

 


There we have it, a simple port from the from the ZUBoard to the Ultra96-V2 which shows how easy it is to port designs between devices.


Workshops and Webinars


If you enjoyed the blog why not take a look at the free webinars, workshops and training courses we have created over the years. Highlights include



Embedded System Book   


Do you want to know more about designing embedded systems from scratch? Check out our book on creating embedded systems. This book will walk you through all the stages of requirements, architecture, component selection, schematics, layout, and FPGA / software design. We designed and manufactured the board at the heart of the book! The schematics and layout are available in Altium here   Learn more about the board (see previous blogs on Bring up, DDR validation, USB, Sensors) and view the schematics here.



Sponsored by AMD

0 comments

Comments


bottom of page