AS7265x Sensor Select

My AS7265 just arrived today. I’ve been using a AS7262 with a STM32F103 microcontroller and it works great.

I used the Sparkfun code from GitHub as a guide to write the C Code functions in Keil IDE to read and write to the virtual registers and set up the mode, integration time etc. I realize that most of this code will be the same working with the AS7265. However, I’m looking at the code for the AS7265 and notice that there is a register called

#define AS7265X_DEV_SELECT_CONTROL 0x4F.

The datasheet talks about a device select but it doesn’t actually say how it works or how you use it. This register isn’t defined in the datasheet - just referred to. I gather it is the way to select which of the 3 chips (51, 52, or 53 or some combination) you want to read from. How does this register work? Is it a virtual register or an actual register where you select the chip (s)?

I assume that when you set things like gain and integration time, they apply to all 3 of the chips - correct?

The datasheet shows 12 registers shared by the 3 chips. For example, register 0x08 is the RAW value of either R, G, or A. How do you know which it is when you read it?

Thanks for any help/advice.

The Device Select Register for this device doesn’t seem to be documented anywhere.

However, after looking at the Spakfun Code on GitHub I found that the following code works:

#define NIR 0x00
#define VISIBLE 0x01
#define UV 0x02

#define Device_Sel_Control 0x4F

void select_device(uint8_t device)
{
	virtualWriteRegister(Device_Sel_Control, device);
}

int getChannel(uint8_t channelRegister, uint8_t device)
{
	select_device(device);
	int colorData = virtualReadRegister(channelRegister)<<8;     //high byte
	colorData |= virtualReadRegister(channelRegister +1);           //low byte
	return colorData;
}

I think each of the 3 devices have the same 6 registers (starting at 0x08 through 0x13) that hold the raw data of whatever wavelength they use. So after a conversion cycle you just read bit 1 of Register 0x04 to see if there are any data to read. If bit 1 is set you can read each of the 18 registers (assuming you set the mode for all of them).

The Sparkfun code reads each register as uint16_t. I found if you read them as an integer you still get a hex value but you can easily convert it to a float with a simple cast, such as:

float color = (float) getChannel(Red, VISIBLE);

I’ve compared the output of this device for a Cobalt complex to a spectrum I took with an Ocean Optics Red Tide 650 and the two spectra, while not identical, were fairly close in shape and lambda max.