AMS AS7341 SMUX Configuration is Critical Yet Absent from Datasheet
I want to understand the capabilities of the AMS AS7341 11-channel spectral color sensor and started orienting myself with its datasheet. The sensor seems quite capable but also quite complex to operate. The biggest barrier on the critical path (I must understand it to do anything with the sensor) is SMUX or sensor multiplexor. The onboard ADC (analog to digital converter) only has 6 channels to serve 11 sensor channels, the SMUX decides which subset of 6 is read at any given time.
Given their importance, I was quite baffled to find no documentation in the datasheet describing SMUX configuration registers. The closest thing I found was in section 8.4:"ams provides reference code and an application note on how to configure the SMUX." [UPDATE: Found the Application Note.] First of all, sample code is not a substitute for proper documentation. Second, I see neither sample code nor SMUX configuration application note on the product's supporting documents section. This is... unsatisfactory.
I hope I can resolve that "WTF?" item later, so I set that aside and continued learning about sensor parameters. I started thinking of this sensor as a small digital camera and I could use photography analogies to understand AS7341 parameters. A digital camera has three important variables in every shot:
- Aperture size
- Shutter speed controlling duration of exposure
- Film ISO equivalent controlling sensor sensitivity.
For an AS7341:
- It is a point sensor, so its aperture size is a pinhole camera and not adjustable.
- Integration time parameters control duration of exposure, equivalent to shutter speed.
- Gain parameter control sensor sensitivity, equivalent to ISO.
Integration time is controlled via parameters ATIME and ASTEP. ATIME is a single register at 0x81, and the entire range of 8-bit values (0-255) are valid. ASTEP is a 16-bit value split across two registers: 0xCA (low byte) and 0xCB (high byte.) 65535 is a reserved value for ASTEP, but 0-65534 are valid. Together they control the ADCfullscale parameter, which is defined as (ATIME+1)*(ASTEP+1) and has this footnote:
"The maximum ADC count is 65535. Any ATIME/ASTEP field setting resulting in higher ADCfullscale values would result in a full-scale of 65535"
This I found curious: if the maximum is 65535, the maximum possible representation in 16-bits, why do we need ATIME at all? ASTEP can cover the entire 16 range all by itself rendering ATIME superfluous. There's a story here missing from the datasheet.
As a starting point for exploration, the datasheet listed 50ms (ATIME 29 ASTEP 599) as the typical integration time. I'll start there and go higher or lower as needed. And as I'm just starting out, I hope I can safely ignore some of the auxiliary features until later.