Looking at the datasheet not of the OPT9221 It’s a beast of a controller. It comes in a BGA package with 256 pins. I’m not even going to attempt to solder that myself, a Chinese PCBA factory will do.
The OPT9221 Functional Block Diagram is shown on page 14 of the datasheet.
Starting at the top left and moving counter clockwise we have:
Temperature Compensation - Feedback from the Illumination element for temp compensation
To OPT8241 - Synchronization, Clock pulse, reset and I2C communication to the OPT8241. I2C is too slow for high data throughput so in this case it’s only used to configure settings and transfer small amounts of data.
From OTP8241 - This is where the 16 parallel CMOS data pins connect along with their accompanying clock signal
Optional EEPROM - We’re given the option to store the OPT9221 Firmware in external Serial Peripheral Interface (SPI) Electrically Erasable Programmable Read Only Memory (EEPROM). SPI is a very common protocol that requires 4 Lines. The block diagram labels these TIC_MS for some weird reason which is confusing because that label isn’t use anywhere else in the document. Anyways, the 4 lines are Master In Slave out (MISO), Master Out Slave IN (MOSI), Serial Clock (SCLK), and Slave Select (SS) also called Chip Select (CS) .
To DDR This is where we connect to external RAM. About 43 of those 256 pins will be used here. That’s a relief, it knocks off a sizable chunk. We have to be extremely careful to keep best practices when routing DDR on the PCB
Master I2C I2C lines with the OPT9221 as a master and optional temp sensor as a slave
Slave I2C This is where we come in. The Microcontroller will connect here as a master to configure and control the OPT9221
Flow Control This is where Data and Synchronization signals flow back and forth. We have the option of using Digital Vidoe Port (DVP) or Synchronous Serial Interface. We’ll use DVP. It consists of 3 synchronization lines Vertical Sync, Horizontal Sync, Pixel Clock and a number of data lines. In this case 8 data lines that will be updated with each pulse of the pixel clock. You’ll see these sync pins with different names in different documentation.
GPIOs General Purpose Input Output. We may or may not end up using those. If we don’t use them we’ll have to find out whether we need to tie them High, Low, or leave them floating.
Configuration The OPT9221 has 3 configuration pins that are sampled on power up. based on the state of these 3 pins it knows where it ought to load it’s firmware from. See chart below from page 39 of the datasheet
I may be jumping ahead a little with the next diagram but while we’re at it let’s look at the boot sequence on that same page 39
Very important information here, I’ll walk through the diagram. Looking at the Vcc line we learn that our supply voltage can’t turn on too fast or too slow. T_ramp gives us our tolerance. The supply voltage must take between 50 and 3000 microseconds to turn on, that’s what T_ramp represents.
The internal POR line represents an Internal Power ON Reset where the device clears all data and restores itself to default. T_por represents this time frame. The chart tells us it could take up to 200ms.
After POR it samples the Boot Configuration pins and loads the firmware from the specified path. This could take any amount of time based on the config mode, clock rate, amount of data and so forth. This is what T_conf represents.
The device then takes another 2 ms just to get ready after which it will pull the INT_OUT pin low. INT_OUT is pin No. G2 on the OPT9221. Our microcontroller has to make sure this pin has been driven low before attempting any comunication.
Back to the Block Diagram…
Next on the diagram are 6 separate voltage sources with 4 different voltage values. We will have to use a power management IC to handle all of those different voltages. At this point, manual reflow soldering is out of the question. Too many expensive BGA parts.
SYSCLK_IN An external Clock signal that needs to be either 6, 12, 24, or 48 MHz. (Page 12 of datasheet)
Lastly there’s VD_IN which is just an external synchronization pin used when the OPT9221 Timing Generator is in slave mode. We’ll be using the Timing generator as a master so we won’t worry about this. We need only to know whether to tie it High, Low, or leave it floating.
Of the 256 pins, these functional parts take up less than half maybe, I haven’t counted. Point is there are a bunch of pins either tied High or Low, or left unconnected. A lot to digest here. One remaining question is how exactly will our Illumination element work. I’d imagine the use of a near infrared laser that is diffracted to get a wide viewing angle. I don’t know, will cross that bridge when we get to it.