Connecting the peripherals
Last updated
Last updated
Now that we have initialized the different peripherals that we will use to interface with the outside world (from the point of view of the microcontroller), we are ready to wire everything up! Make sure that the STM32 board is not powered, i.e. unplugged, while connecting the microphone and DAC breakout boards.
For this task, we will have to refer to the card provided with the STM32 board (see below) and the image of the chip on the "Pinout" tab of our CubeMX project (further below).
As previously mentioned, make sure that the STM32 board is powered off! We can then begin by connecting the microphone's ground pin. In electronics, it is common practice to first ground a component/circuit.
TASK 3: Connect the microphone's GND pin to one of the STM32 board's GND pins, e.g. slot 22 on the CN7 (left) header.
Tip: try to keep all the connector cables attached to each other to avoid messy wiring!
We can now connect the supply voltage pin.
TASK 4: Connect the microphone's 3V pin to the STM32 board's 3V3 pin.
Note: the microphone component accepts voltage levels between 1.6V and 3.6V so do not use the STM32 board's 5V pin!
Previously, we configured I2S2 for the microphone so we will have to connect the following pins (see image of chip from "Pinout" tab for the names on the left side of the arrow) to the corresponding pins on the microphone breakout board (right side of the arrow):
TASK 5: From the "Pinout" configuration on CubeMX, determine which pins of the STM32 board are used by I2S2. Using the card provided with the board (see PDF figure above), use the jumper cables to wire the pins from the STM32 board to the appropriate pins on the microphone breakout board.
Hint: for example, from the "Pinout" tab we can see that I2S2_SD is output on pin PC3. From the card provided with the board, we see PC3 is located in the bottom left corner of the board's pin header extensions. Therefore, we will use a wire to connect this pin to the DOUT pin of the microphone breakout board.
Finally, we configured an additional GPIO pin in order to select whether we would like the microphone to be assigned to the left or right channel.
TASK 6: Connect the microphone's SEL pin to the pin on the STM32 board corresponding to LR_SEL.
BONUS: do we have to connect the microphone's SEL pin for the passthrough to work? What would happen if we didn't?
As previously mentioned, make sure that the STM32 board is powered off! We can then begin by connecting the DAC's power supply, starting with the ground pin.
TASK 7: Connect the DAC's GND and VIN pins to the STM32 board.
Note: you can provide 5V to the VIN pin and the built-in regulator will produce a 3.3V supply, which is also available on the 3VO pin.
Previously, we configured I2S1 for the DAC so we will have to connect the following pins to the appropriate pins on the DAC breakout board:
I2S1_SD
I2S1_CK
I2S1_WS
Moreover, we configured an additional GPIO pin in order to mute the output.
MUTE
TASK 8: Connect the above four pins from the STM32 board to the appropriate pins on the DAC breakout board.
Hint: see the DAC chip explanation and Adafruit's site for more information on wiring the DAC component.
With everything correctly wired up, we can proceed to coding the passthrough on the SW4STM32 software!
Sadly we cannot connect all the wires for you or double check your connections. However we did our best to help you with this wiring by making a step-by-step video accessible at this address.
Are you sure you are ready to see the solution? ;)
I2S2_SD DOUT
I2S2_CK BCLK
I2S2_WS LRCL