Need help please... How to program AL422B?

hi guys, i’m now in the project of AL422b. I have the code like this:

#include <avr/io.h>
#include <Arduino.h>

#define WRITE_ENABLE CONTROL_PORT |= AL422_WEN
#define WRITE_DISABLE CONTROL_PORT &= ~(AL422_WEN)

#define READ_CLOCK_HIGH CONTROL_PORT |= AL422_RCK; delayMicroseconds(1);
#define READ_CLOCK_LOW CONTROL_PORT &= ~(AL422_RCK); delayMicroseconds(1);

#define READ_RESET_HIGH CONTROL_PORT |= AL422_RRST
#define READ_RESET_LOW CONTROL_PORT &= ~(AL422_RRST)

#define WRITE_RESET_HIGH CONTROL_PORT |= AL422_WRST
#define WRITE_RESET_LOW CONTROL_PORT &= ~(AL422_WRST)

#define READ_RESET READ_RESET_LOW; READ_CLOCK_HIGH; delayMicroseconds(1); READ_RESET_HIGH; READ_CLOCK_LOW; delayMicroseconds(1);

#define WRITE_RESET WRITE_RESET_LOW; WRITE_RESET_HIGH;

void initAL422B(){
  DO_DDR = 0x00;
  DO_PORT = 0xFF; //Enable int-pullup resistors
  
  CONTROL_DDR = AL422_RCK | AL422_WEN | AL422_RRST | AL422_WRST;
  CONTROL_PORT = AL422_RRST | AL422_WRST;
  CONTROL_PORT &= ~(AL422_WEN);
}

is there any mistakes in my code? because i’m always getting the same data when doing the read sequence. if you have some suggesstion, i would like to hear your opinions about my code above. thanks

Note :
i’m using the al422b with the OV7670.

if you have some suggesstion, i would like to hear

Post links to the hardware. Post your code correctly, using the code icon (#), not the quote icon.

mardikarifqi:
i'm now in the project of AL422b.

What does this mean?

i'm using the al422b with the OV7670.

What are these devices?
Describe what they do and what you are using them for and post links to their datasheets

...R

PaulS:

if you have some suggesstion, i would like to hear

Post links to the hardware. Post your code correctly, using the code icon (#), not the quote icon.

Hey paulS, i've changed my post above. And here some link about the hardware:
http://www.averlogic.com/pdf/AL422B_Flyer.pdf

Robin2:

mardikarifqi:
i'm now in the project of AL422b.

What does this mean?

i'm using the al422b with the OV7670.

What are these devices?
Describe what they do and what you are using them for and post links to their datasheets

...R

So actually ov7670 is a camera sensor. I've already discussed that device in sensor category. And the al422 is the memory buffer for the camera sensor.

what is a al422b ?

and where is the link to its datasheet?

is there any mistakes in my code?

cannot tell, the code is not a full sketch ....

mardikarifqi:
So actually ov7670 is a camera sensor. I've already discussed that device in sensor category. And the al422 is the memory buffer for the camera sensor.

Is it your contention that I should have known that without you telling me or (even yet) not bothering to provide a link to your other Thread.

Need help please... How to program AL422B?

You have already been asked to provide a link to the datsheet for the device - how can you expect to know how to use the device without that?

You have not told us what you want to use the device for?
You have not told us what the code you posted is supposed to do?
You have not told us what the code actually does?

Over to you ....

...R

robtillaart:
what is a al422b ?

and where is the link to its datasheet?

is there any mistakes in my code?

cannot tell, the code is not a full sketch …

Robin2:

mardikarifqi:
So actually ov7670 is a camera sensor. I’ve already discussed that device in sensor category. And the al422 is the memory buffer for the camera sensor.

Is it your contention that I should have known that without you telling me or (even yet) not bothering to provide a link to your other Thread.

Need help please... How to program AL422B?

You have already been asked to provide a link to the datsheet for the device - how can you expect to know how to use the device without that?

You have not told us what you want to use the device for?
You have not told us what the code you posted is supposed to do?
You have not told us what the code actually does?

Over to you …

…R

sorry, that’s the wrong link.

i’ll give you the another one :http://www.frc.ri.cmu.edu/projects/buzzard/mve/HWSpecs-1/Documentation/AL422B_Data_Sheets.pdf

so, al422b is like a RAM, but it called buffer for video. we can do a read and write in the same time. the camera put out the data very fast, but our MCU only have 16MHZ clock, its a low speed to read the data from the camera directly. so we use the buffer. So the fast data, stored in this buffer, then we read it as slowly as we want.

to use this buffer, there is some sequences.

  1. Write sequences
    the write pin, from DI7-DI0, WCK is connected to the camera. and let the camera write the data to al422b
    (this is not my question, just a knowledge for more info, please refer to the datasheet)

  2. Read sequences
    (this is my question)
    to do a read sequences :
    -Open up the arduino and include my code.
    -to do a read sequences, we must reset the read pointer inside the buffer by matching timing sequences based on the timing diagram(read reset cycle). Please look at the datasheet
    -read the data in the buffer by matching the read timing diagram, by pulling the Read clock high, and low.

so it will be look like this :

#include <avr/io.h>
#include <Arduino.h>

#define WRITE_ENABLE CONTROL_PORT |= AL422_WEN
#define WRITE_DISABLE CONTROL_PORT &= ~(AL422_WEN)

#define READ_CLOCK_HIGH CONTROL_PORT |= AL422_RCK; delayMicroseconds(1);
#define READ_CLOCK_LOW CONTROL_PORT &= ~(AL422_RCK); delayMicroseconds(1);

#define READ_RESET_HIGH CONTROL_PORT |= AL422_RRST
#define READ_RESET_LOW CONTROL_PORT &= ~(AL422_RRST)

#define WRITE_RESET_HIGH CONTROL_PORT |= AL422_WRST
#define WRITE_RESET_LOW CONTROL_PORT &= ~(AL422_WRST)

#define READ_RESET READ_RESET_LOW; READ_CLOCK_HIGH; delayMicroseconds(1); READ_RESET_HIGH; READ_CLOCK_LOW; delayMicroseconds(1);

#define WRITE_RESET WRITE_RESET_LOW; WRITE_RESET_HIGH;

void initAL422B(){
  DO_DDR = 0x00;
  DO_PORT = 0xFF; //Enable int-pullup resistors
  
  CONTROL_DDR = AL422_RCK | AL422_WEN | AL422_RRST | AL422_WRST;
  CONTROL_PORT = AL422_RRST | AL422_WRST;
  CONTROL_PORT &= ~(AL422_WEN);
}

void setup(){
   initAL422B();
}

void loop(){
READ_RESET;
for(uint32_t p=0;p<76800;p++) { //76800 is QVGA size (320*240)
   READ_CLOCK_HIGH;
   delayMicroseconds(1); //There must be a delay in about (15 ns)
   uint8_t data = PINA; //so DO7-DO is attached to PORTA7:0
   READ_CLOCK_LOW;
}
}

the problem is,
When i’m trying to dump the “uint8_t data” in Serial, it always put out the same data.
The data output should be different from one to another.

So can anyone learn the datasheet, and tell me how to do a read cycle based on the datasheet? am i make some mistakes

For anyone that already know what AL422, please answer my question.
thank you
Thanks