Quantcast
Channel: Intel Communities: Message List
Viewing all articles
Browse latest Browse all 20984

Issues with i2c on Galileo gen2 board

$
0
0

I have been trying to connect OV7670 to my galileo gen2 board but am unable to detect the device using i2c scanner arduino sketch or using a custom linux program.  Is someone able to use i2c port on Galileo gen2 board ?

 

Arduino Playground - I2cScanner

 

Linux i2c scanner:

#include <stdio.h>
#include <stdlib.h>
#include <dirent.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <inttypes.h>
#include <linux/i2c-dev.h>
#define MAX_BUF 100
union i2c_smbus_data {  __u8 byte;  __u16 word;  __u8 block[MAX_BUF + 2]; /* block[0] is used for length */                                             /* and one more for PEC */
};
int main(void)
{  uint8_t addr = (0x60 >>1);  puts("hello world !!");  char buf[MAX_BUF];  int i2c_fd = 0;  int i2c_adapter_nr = 0;  int ret,command;  snprintf(buf, sizeof(buf), "/dev/i2c-%d", i2c_adapter_nr);  if ((i2c_fd = open(buf, O_RDWR)) < 1) {  puts("Failed to open adapter");  return -1;  }
for (addr = 0; addr<= 127; addr ++)
{  if (ioctl(i2c_fd, I2C_SLAVE_FORCE, addr) < 0) {  fprintf(stderr, "Failed to set slave address %d:", addr);  puts("Failed to set slavea ddress");  return -1;  }  struct i2c_smbus_ioctl_data args;  union i2c_smbus_data data;  args.read_write = 1; // I2C_SMBUS_READ  args.command = 0;  args.size = 1; //I2C_SMBUS_BYTE;  args.data = &data;  ret = ioctl(i2c_fd,I2C_SMBUS,&args);  if ( ret < 0)  {  // printf ("Write failed: Command%d: Errno %d\n", command, errno);  }  else  {  printf("Received ack from address : 0x %x \n", addr);  }
}  return 0;

}

 

 

I get the same output whether OV7670 is connected or not.    I am assuming these are standard I2C slave devices to control GPIO extensions and EEPROM.

 

Received ack from address : 0x 25

Received ack from address : 0x 26

Received ack from address : 0x 27

Received ack from address : 0x 47

Received ack from address : 0x 54

Received ack from address : 0x 55

Received ack from address : 0x 56

Received ack from address : 0x 57

Received ack from address : 0x 70

 

 

Following is the board configuration.

1. IOREF Jumper configured to 3.3v

2. 3.3 v to Pin 1 of OV7670

3. GND to Pin 2 of OV7670

4. SCL from Galileo to SCL of OV7670

5. SDA from Galileo to SDA of OV7670.

 

thanks

Sam


Viewing all articles
Browse latest Browse all 20984

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>