DualMCU for Audio Processing Pipeline
The DualMCU is an extension board used in combination with the STM32F7 Discovery board. It acts as an audio processing engine. It creates an Audio Processing Pipeline (APP). It can work stand-alone, without a Discovery board. In this case the SAI2 is looped back. With the Discovery board it acts as the main processing engine, e.g. running all the audio filters. The Discovery board can still generate or receive the audio stream, e.g. in order to use the on-board-ADC/DAC (Line In, Line Out) or to display FFT etc.
The DualMCU board is intended to be connected on a DIGI-FP interface board which provides an SRC chip and different interfaces such as AES3, SPDIF, TOSLINK. The SAI1 of the STM32F7 MCU is the port for the bi-directional audio from/to DIGI-FP board. The SAI2 of the MUC is used to connect other audio hardware, processing engines, e.g. STM32F7 Discovery board, Raspberry Pi, USB-to-I2C, I2S DACs etc.
The SAI1 and 2 build an Audio Processing Pipeline. This pipeline is extended by the Discovery board. The load can be shared and split into two (Dual) MCUs.
All audio processing is based on 32bit samples.
The Discovery board, Raspberry Pi etc. can configure and control the system via a SPI interface. The DualMCU board acts as SPI slave.
The user can control, configure and monitor the DualMCU via an UART Shell command interpreter.
There is UART6 used on a USB-to-UART bridge. The user can use a terminal and control, configure the system. The baud rate is 115200, 8bit, no parity, no flow control, 1 stop bit.
The commands are quite simple, as single letter commands, e.g. 'f 0' or 'f 1' for disable or enable filters. In order to see implemented commands - there is a command 'h' as help which displays the list and short description of the commands available.
Remark: The Discovery board connected cannot and must not use the UART at the Arduino header. But there is a way to send a text via the SPI Inter-MCU communication which is forwarded by the DualMCU board to the UART port.
For the DualMCU board a dedicated BSP was designed. Find the BSP files as BSP_DualMCU in a separate folder. The BSP uses the HAL drivers provided by ST Microelectronics.
Some code is generated by the CubeMX, e.g. the main.c file. The structure of such file is kept to make it possible to merge again with CubeMX project file generation.
This is the project with BSP and system files to run DualMCU board on an STM32F745 or STM32F767. The difference is mainly on the available flash size (1 MByte vs. 2 MByte) or the available SRAM (and DTCM) size. Very important is to use the appropriate linker script LinkerScript.ld file. Building for 2 MB flash size device (STM32F767) will not work when an 1 MB device is used (STM32F745).
This project could run stand-alone, without a Discovery board. Via UART Shell it can be configured. If the Discovery board is connected - it will send commands via SPI and use the DualMCU board. If Discovery is not connected - a jumper can be set in order to cross-connect the SAI2 audio interface, as external loop-back as Discovery would do.
With Discovery board connected - be aware of:
The DualMCU uses the two SAI blocks (SAI1 and SAI2). Both SAIs run as slaves (input for clocks), in bi-directional mode. Therefore, SAIx_A and SAIx_B are used. SAIx_A is the input, SAIx_B is the output for the I2S data.
The clocks are received on the input interface SAIx_A. Output SAIx_B follows as a synchronized slave device (internal clock routing, SAIx_B does not have any clock inputs). Therefore, the receiver SAIx_A must be enabled and active always, even not using the received data.
Hardware-wise, both SAIx are connected to the same I2S interface, so they receive both the same synchronous I2C clock for an external I2S master (DIGI-FP). The entire DualMCU system runs with synchronous I2S clocks. The only exception exists when the Discovery board is connected and used: the SAI2 connected to the on-board ADC and DAC chip runs in master mode. It can be considered as another I2S domain, so that this one is asynchronous to all the other SAI interfaces involved in the system (just to take it into consideration when crossing this clock domain boundary in order to avoid audio distortions).
The right-hand-side, the SAI1, is used to connect the DIGI-FP interface board, SAI2 as the right-hand-side of the Audio Processing Pipeline is intended to be used for other nodes, other I2S inputs or outputs. The STM32F7 Discovery board is connected at the SAI2 ports. On the Discovery board the SAI1 is used in a similar way, also as a slave device with internally synchronized block SAI1_B.