ArduChip Registers

Published by Lee Jackson on

ArduChip is the core of the ArduCAM, which incoperates a Altera MAXII CPLD EPM240 as main processor. The main task of the ArduChip is do the real time DMA transfer between Camera module and the 3.2″ LCD and act as Arduino, Camera and LCD bus multiplexer. It also provides AVR like GPIO expansion, it can be set as input or output and resolve the problem of limited IO resources in Arduino board. The GPIOs can be used as event trigger in and trigger out. 

AddressNameModeDescription
0x00DDRR/WData Direction RegisterBit[7:6]: ReservedBit[5]: IO5 input/output selectionBit[4]: IO4 input/output selectionBit[3]: IO3 input/output selectionBit[2]: IO2 input/output selectionBit[1]: IO1 input/output selectionBit[0]: IO0 input/output selection1 = output, 0 = input
0x01PORTR/WOutputPortRegisterThe value will reflect on the Pin IO0~IO6 correspondinglyBit[7:6]: ReservedBit[5]: IO5 output valueBit[4]: IO4 output valueBit[3]: IO3 output valueBit[2]: IO2 output valueBit[1]: IO1 output valueBit[0]: IO0 output value1 = High, 0 = Low
0x03MODER/WBus ModeDetermine who is owner of the data bus, only one owner is allowed.Bit[7:3]: ReservedBit[2]: MCU read LCD busBit[1]: Camera write LCD busBit[0]: MCU write LCD bus
0x80PINROInput Pin RegisterThe value will reflect the IO0~IO6 Pin status correspondinglyBit[7:6]: ReservedBit[5]: IO5 input valueBit[4]: IO4 input valueBit[3]: IO3 input valueBit[2]: IO2 input valueBit[1]: IO1 input valueBit[0]: IO0 input value1 = High, 0 = Low
0x81TriggerROTrigger input RegisterBit[7:2]: ReservedBit[1]: Capture button status, 0 = pressed, 1 = releasedBit[0]: Frame start signal, equal to VSYNC
0x82Revision IDROBit[7:6]: Revision integer partBit[5:0]: Revision decimal partFirst revision released ID is 0x40, means V1.00

Examples:

ArduCAM GPIO Write demo

// ArduCAM GPIO Write demo (C)2012 Lee
// web: http://www.ArduCAM.com
// This program is a demo of how to use GPIOs in ArduCAM to turn on/off
// LEDs or trigger any ohter devices.
//
// This program requires the ArduCAM library.
//
#include <Wire.h>
#include <ArduCAM.h>
#include <avr/pgmspace.h>
#include <SoftwareSerial.h>

#define ARDUCHIP_DDR       0x00  //GPIO direction register
#define ARDUCHIP_PORT      0x01  //GPIO output register
#define ARDUCHIP_PIN       0x80  //GPIO input register
//ArduCAM(byte model,int RS, int WR, int RD, int CS)
ArduCAM myCAM(OV7670,A2,A1,A0,A3);
//Uncomment if use software serial
SoftwareSerial mySerial(8, 9); // RX, TX
void setup()
{
  mySerial.begin(9600);
  mySerial.println("hello");
  myCAM.write_reg( ARDUCHIP_DDR, 0xff);     //Set GPIO as output

}

void loop()
{
  uint8_t val = 0xff;
  uint8_t read_val;
  while(1)
  {
    delay(1000);
    myCAM.write_reg( ARDUCHIP_PORT, val);       //Output Register
    val = val ^ 0xff;                           //toggle output value
    read_val = myCAM.read_reg(ARDUCHIP_PORT);   //Read it back
    mySerial.write(read_val);
  }
  return;

}

ArduCAM GPIO Read demo

// ArduCAM GPIO Read demo (C)2012 Lee
// web: http://www.ArduCAM.com
// This program is a demo of how to use GPIOs in ArduCAM to read 
// trigger signals from any ohter devices.
//
// This program requires the ArduCAM library.
//
#include <Wire.h>
#include <ArduCAM.h>
#include <avr/pgmspace.h>
#include <SoftwareSerial.h>

#define ARDUCHIP_DDR       0x00  //GPIO direction register
#define ARDUCHIP_PORT      0x01  //GPIO output register
#define ARDUCHIP_PIN       0x80  //GPIO input register

//ArduCAM(byte model,int RS, int WR, int RD, int CS)
ArduCAM myCAM(OV7670,A2,A1,A0,A3);
//Uncomment if use software serial
SoftwareSerial mySerial(8, 9); // RX, TX
void setup()
{
  mySerial.begin(9600);
  mySerial.println("hello");
  myCAM.write_reg( ARDUCHIP_DDR, 0x00);     //Set GPIO as input
}

void loop()
{
  uint8_t temp;
  while(1)
  {
    temp = myCAM.read_reg(ARDUCHIP_PIN);      //Read from GPIO
    mySerial.write(temp);                  //Send value read from GPIO
    delay(1000);
  }
  return;

}

 


4 Comments

Frank · December 9, 2012 at 6:08 pm

Hello,

first of all, job well done with this webpage!
I’m thinking of creating a small ‘security camera’ that will be used to take a photo each time somebody urinates against our front door. A combination of a light + humidity + temperature sensor should do the trick. I wouldn’t need the LCD display just saving the pics to an SD or send them by network would be ideal.
In case i’m not using the LCD display, is there any use for the ARDUcam Shield ?

Thank you for the reply and keep up the good work!

    admin · December 10, 2012 at 6:57 am

    Hi bigguc,
    Thanks for your comment. It is more wise to use a PIR module to detect the human body and trigger the snapshot of the ArduCAM.
    The ArduCAM shield do support external trigger from some kind of sensors.
    Currently we can’t live with the LCD screen, because it is used as the frame buffer. If we don’t use the LCD we have no way to
    store image. But it is a good question though, we are considering to use AL422B fifo as a frame buffer to substitute the LCD screen.
    There is a AL422B footprint on the ArduCAM shield, we can test the idea without change the PCB.

Geertjan · October 6, 2020 at 6:27 am

Nicely done, but i’m curious what kind of fpga from altera/intel did you use (device number) ?

    Lee Jackson · October 7, 2020 at 1:20 am

    Used to use Altera MAXII series, now moved to Lattice XO2.

Leave a Reply

Your email address will not be published. Required fields are marked *

0
Your Cart is empty!

It looks like you haven't added any items to your cart yet.

Browse Products