2013-11-04

BMPCC LANC and Sysclk DX (USBee DX clone)



I received my Sysclk DX from China. It's an affordable clone of the USBee DX.
A 2 channel USB Mixed Signal oscilloscope paired with an integrated 16 channel logic analyser.
The first task I'm giving it is to analyse the LANC protocol on the Blackmagic Pocket Cinema Camera.
Why? Because I need to have a way to meassure what's supposed to be on the wire and what is actually there to implement LANC into an Atmel microcontroller and build a better LANC remote. ;)

First try:
On a breadboard I pulled the data line high and tried to analyse the signal. The camera is supposed to send data packets... absolutely no luck. :(

Second try:
I put the breadboard in between a working LANC remote and the camera and ran the logic analyser.
I may be doing something wrong but I can't see anything on the wire. The LANC remote however works fine!

UPDATE: Third try:
I dumped the Sysclk DX and got my old Usbee AX and it worked fine.
I found the following LANC commans on the Blackmagic Pocket:
//LANC(0x18, 0x33); //send REC command to camera
//LANC(0x28, 0x45); //send MANUAL FOCUS FAR command to camera
//LANC(0x28, 0x47); //send MANUAL FOCUS NEAR command to camera
//LANC(0x28, 0x53); //send IRIS+ command to camera
//LANC(0x28, 0x55); //send IRIS- command to camera

LANC(0x28, 0x43); // AUTO FOCUS  
Update: Blackmagic answered: IrisAutoAdjust =  0x28 0xAF
I search in the area of 0x55 and 0x47 but could not find anything that triggers auto iris or auto focus.
Aparently these commands do exist but I don't know the command code.

UPDATE:
Using the code from "Control your camera" it seems to work more reliable when removing the -8ms adjsutment for the digitalWrite command and replacing that with a macro from here:

#define fastWrite(_pin_, _state_) ( _pin_ < 8 ? (_state_ ?  PORTD |= 1 << _pin_ : PORTD &= ~(1 << _pin_ )) : (_state_ ?  PORTB |= 1 << (_pin_ -8) : PORTB &= ~(1 << (_pin_ -8)  )))
// the macro sets or clears the appropriate bit in port D if the pin is less than 8 or port B if between 8 and 13


my send-byte routing now looks like this:
void send_8(char dat) {
  char abit;
  char index;
  for(index = 0; index <= 7; index++) {
  abit = ((dat>>index) & 0x01);
  if(abit==1) {
    fastWrite(cmdPin, HIGH);
  } else {
    fastWrite(cmdPin, LOW);
  }
  delayMicroseconds(bitDuration);
}

//Byte is written now put LANC line back to +5V
fastWrite(cmdPin, LOW);

}


Also: I can successfully power the Arduino Uno from the LANC cable.