Zync Zedboard vs ZC702 and I2C

Chris Johns chrisj at rtems.org
Sun Feb 26 02:10:34 UTC 2017


On 26/02/2017 00:58, Scott Zemerick wrote:
> I've been reading the forum posts over the last couple of days regarding
> the Zync Zedboard and Microzed.  Does anyone have any experience or
> suggestions on the following?
>
> * I have both the Zedboard and the ZC702 eval board - both of these use
> the same chip.  Anyone tried putting rtems on the ZC702?  I imagine that
> it would work since people have been successful with the microzed.

Do you mean this board http://xilinx.wikidot.com/zc702-boards-and-kits ? No.

I have run RTEMS on 
https://www.xilinx.com/products/boards-and-kits/ek-z7-zc706-g.html 
before moving to XC7Z045 custom boards. I have RTEMS running on a Microzed.

> * How is the I2C support in the rtems Zync Zedboard BSP?  Anyone using
> it with either the Zedboard or ZC702?  Example code to share?  What I2C
> slave device are you using?
>
> General thoughts/suggestions are appreciated!

There is I2C support for the Zynq. I have a few boards running different 
mixes of I2C devices on both built-in buses and I also have a driver for 
the Xilinx AXI I2C IP you can embed in the FPGA fabric I need to submit.

I will add something to the wiki page when the wiki returns. Until then ..

Chris

This code has not been built and entered in here:

#include <rtems.h>
#include <dev/i2c/i2c.h>
#include <bsp/i2c.h>

void board_init(void)
{
   int r;

   if (zynq_register_i2c_0() < 0) {
     fprintf(stderr, "error: i2c-0 reg: %s\n", strerror(errno));
     return;
   }

   r = i2c_dev_register_gpio_nxp_pca9535("/dev/i2c-0",
                                         "/dev/i2c-0.gpio-0",
                                         0x23);
   if (r < 0) {
     fprintf(stderr, "error: i2c gpio reg: %s\n", strerror(errno));
   }
}

void toggle(void)
{
   int fd;
   int r;

   fd = open("/dev/i2c-0.gpio-0", O_RDWR);
   if (fd < 0) {
     fprintf(stderr, "error: i2c gpio open: %s\n", strerror(errno));
     return;
   }

   /* config value is made up */
   r = gpio_nxp_pca9535_set_config(fd, 0x1234);
   if (r < 0) {
     fprintf(stderr, "error: i2c gpio set config: %s\n",
             strerror(errno));
     close(fd);
     return;
   }

   r = gpio_nxp_pca9535_set_output(fd, 0);
   if (r < 0) {
     fprintf(stderr, "error: i2c gpio set 0: %s\n", strerror(errno));
     close(fd);
     return;
   }

   r = gpio_nxp_pca9535_set_output(fd, 1);
   if (r < 0) {
     fprintf(stderr, "error: i2c gpio set 1: %s\n", strerror(errno));
     close(fd);
     return;
   }

   r = gpio_nxp_pca9535_set_output(fd, 0);
   if (r < 0) {
     fprintf(stderr, "error: i2c gpio set 0: %s\n", strerror(errno));
     close(fd);
     return;
   }

   close(fd);
}


More information about the users mailing list