Familiarity with interrupts in Cortex-M processors.Īll the code presented in this post in addition to instructions for the environment and toolchain setup are available on the apollolabsdev Nucleo-F401RE git repo.Note that if the code on the git repo is slightly different then it means that it was modified to enhance the code quality or accommodate any HAL/Rust updates. The UART Tx line that connects to the PC through the onboard USB bridge is via pin PA2 on the microcontroller.The second Microphone signal pin is connected to pin PA4 (Grove Connector A2).The first Microphone signal pin is connected to pin PA0 (Grove Connector A0).1 x Seeed Studio Grove Base Shield V2.0. This is a hardwired pin, meaning you cannot use any other for this setup. Unless you are using a different board other than the Nucleo-F401RE, you have to check the relevant documentation (reference manual or datasheet) to determine the number of the pin. There isn't much of an algorithm design for this application as most of the work is going to be handled by hardware through interrupts. In software, however, we will mainly be configuring the DMA and collecting and processing microphone samples once they become available. The state machine below expresses how the application works. The application will be sitting idle until a timer interrupt event happens at a rate of our choice (for example every one second). ![]() In the timer interrupt task, we will kick off an ADC sequence conversion that will go and collect ADC samples from all microphone channels. The application would then return to the idle state again and wait until a DMA event happens. ![]() The DMA event signals that the ADC data is available in memory to read. As such, in the "Transfer Complete" state the application would collect the available data, transmit it, and then return to idle.Īn alternative approach would have been to skip the timer interrupt kicking off the ADC conversion altogether and instead have the DMA interrupt collect data directly when it becomes available by the ADC.
0 Comments
Leave a Reply. |