Overview
The application demonstrates how various audio data paths can be implemented through a number of demos supplied as examples:
- DEMO_PDM_MIC: PDM-SRC1-PCM audio data path for voice/audio streaming.
- DEMO_PDM_RECORD_PLAYBACK: PDM-SRC1-MEMORY-> MEMORY-SRC1-PCM audio data paths for voice recording for duration configured according to build configuration and audio playback.
- DEMO_PCM_MIC: PCM-SRC1-PCM audio data path for voice/audio streaming.
- DEMO_PCM_RECORD_PLAYBACK: PCM-SRC1-MEMORY-> MEMORY-SRC1-PCM audio data paths for voice recording for duration configured according to build configuration and audio playback.
- DEMO_MEM_TO_MEM: MEMORY-SRC1-MEMORY audio data path that changes the sample rate of a tone in the memory.
- DEMO_PDM_MIC_PARALLEL_SRCS: Two parallel audio data paths (for devices that implement two SRCs):
- PATH_1: PDM-SRC1-MEMORY for voice recording for duration configured according to build configuration.
- PATH_2: MEMORY-SRC2-PCM for playback of a tone of 1000 Hz saved in RAM.
- DEMO_SDADC_MIC: SDADC-SRC1-PCM audio data path for voice/audio streaming (for devices that implement an SDADC).
- DEMO_SDADC_RECORD_PLAYBACK: SDADC-SRC1-MEMORY-> MEMORY-SRC1-PCM audio data path for voice recording for duration configured according to build configuration and audio playback (for devices that implement an SDADC).
General Notes:
- Pulse Density Modulation (PDM)
- Pulse Code Modulation (PCM)
- Sample Rate Converters (SRC)
- A DA7218 MikroBUS module is attached in MikroBUS Socket #1 of DA1459X/DA1469X Pro-MB. This module allows to hook a headset and have PCM demos using the MIC and speaker/phones.
- The DA7218 Codec PLL is enabled in Sample Rate Matching (SRM) mode, i.e. the PLL output clock is synchronized to the incoming WCLK signal and the MCLK is not applicable, as described in the DA7218 datasheet (https://www.renesas.com/us/en/products/analog-products/audio-video/audio-codecs/da7218-ultra-low-power-stereo-codec-single-ended-headphone-driver).
- Demos are implemented with the specific configuration (sample rate, bit depth etc.). Further configurability is not supported.
- Demos that include the PCM interface can be ran using either DIVN or DIV1 (all supported clocks) system clock by setting:
- Set the macro
SR1_SR2_16_8_OR_48_32 to select the sample rates of PCM and MEMORY. To be more specific, if the macro is set, the sample rate of PCM is 16 Khz and the sample rate of MEMORY is 8 Khz. If the macro is cleared, the sample rate of PCM is 48 Khz and the sample rate of MEMORY is 32 Khz.
Installation procedure
The project is located in the projects/dk_apps/demos/audio_demo folder.
To install the project follow the General Installation and Debugging Procedure.
File structure
The following file structure will be created:
- projects/dk_apps/demos/audio_demo/
- config
- custom_config_eflash.h (only for DA1459X)
- custom_config_qspi.h
- custom_config_ram.h
- includes
- audio_task.h
- DA7218_driver.h
- DA7218_regs.h
- demo_helpers.h
- periph_setup.h
- sdk
- src
- audio_task.c
- config_audio_demo.c
- DA7218_driver.c
- demo_helpers.c
- main.c
Existing build configurations
This application contains the following build configurations:
D2634-00-Debug_RAM
D2634-00-Debug_eFLASH
DA1459X-00-Debug_RAM
DA1459X-00-Debug_eFLASH
DA1469X-00-Debug_QSPI
DA1469X-00-Debug_RAM
Demos
Using the audio_demo, it is possible to demonstrate how the Audio framework works. The features depend on the selected demos which are described below. Only one audio demo should be selected each time.
To enable a demo go to the includes/audio_task.h file, the respective macro must be set to (1). For example, if the demo DEMO_PDM_MIC should be enabled then the corresponding macro should be set, as follows:
#define DEMO_PCM_MIC (0)
#define DEMO_PCM_RECORD_PLAYBACK (0)
#define DEMO_PDM_MIC (1)
#define DEMO_PDM_MIC_PARALLEL_SRCS (0)
#define DEMO_SDADC_MIC (0)
#define DEMO_SDADC_RECORD_PLAYBACK (0)
#define DEMO_PDM_RECORD_PLAYBACK (0)
#define DEMO_MEM_TO_MEM (0)
In general, demos use:
DA7218_driver.c : functions for Codec DA7218 (apart from DEMO_MEM_TO_MEM)
audio_task.c : Demos implementation
demo_helpers.c : functions for construction of tones (used only from DEMO_MEM_TO_MEM and DEMO_PDM_MIC_PARALLEL_SRCS)
config_audio_demo.c : project configuration checks
Hardware setup - Audio Interfaces - Wiring
Hardware Setup:
- A Renesas DA1459x Pro-DB can be connected on either a DA1469x or a DA1459x Pro-MB. Nevertheless, it should be noted that some 590 and 690 DB signals are mapped on different 590/690 Pro-MB pins. For example, while the same signal P0_0 from 590 and 690 DB is mapped on the same pin J3.3 on both Pro-MBs, the signal P0_10 from 590 DB is mapped on pin J3.6, while the same signal P0_10 from 690 DB is mapped on pin J3.15 on Pro-MB.
- A Renesas Codec DA7218 MikroBUS module is connected on MikroBUS socket #1 (J15 and J16) of the Pro-MB. Headphones or a speaker is hooked in the Codec module jack. Note that most of the signals from MikroBUS socket #1 (e.g. P0_30/I2C_SCL, P0_31/I2C_SDA, P0_20/BCLK, etc.), which are hardwired to J3 and J4 corresponding pins, are not implemented on a DA1459x device, according to the datasheet. Therefore, for example, the actual signal used for I2C_SCL should be wired to P0_30, etc., as depicted on the corresponding wiring table below.
- The digital (PDM) microphone, e.g. from DA14680 Sensor board, is wired on the corresponding Pro-MB pins (see Wiring Table). The PDM interface consists of two (2) signals: CLK and DATA (in/out). Note that the PDM MIC power supply should be 1V8.
- The PCM interface consists of four (4) signals: CLK, FSC, DO and DI. A headset can be connected to the jack of the DA7218 module, in case a MIC and/or phones are required.
- An analog microphone, which is sampled using the DA1459x SDADC, can be connected to the differential inputs, P1_0 and P1_1, of the PGA (see DA1459x datasheet).
- As a button, the signal P0_10 can be used that should be momentarily be grounded when needed.
PDM signals:
- PDM_CLK (output)
- PDM_DATA (input or output). In case of a microphone, this signal is set as input at the DA1459x.
| Signals | DA1459x/DA1469x Pro-MB Pins | PDM MIC (DA14680 Sensor Board) |
| PDM_CLK | J3.7 (P0_2) | J2.16 (P1_7_PDM_CLK) |
| PDM_DATA | J3.9 (P0_3) | J2.10 (P1_4_PDM_DATA) |
| VDD 1V8 | J4.28 (VDDIO/V30) | J1.24 (V33) |
| GND | ANY GND | ANY GND |
PCM signals:
- PCM_CLK (output)
- PCM_FSC (output)
- PCM_DO (output). This signal is set if an output device is used, e.g. speaker, headphones, etc.
- PCM_DI (input). This signal is set if an input device is used, e.g. microphone, headset, etc.
| Signals | DA1459x/DA1469x Pro-MB Pins | DA1459x/DA1469x Pro-MB Pins - DA7218 MikroBUS #1 |
| PCM_CLK | J3.4 (P0_5) | J3.27 (NC/P0_20) - BCLK |
| PCM_FSC | J3.11 (P0_4) | J3.29 (NC/P0_21) - WCLK |
| PCM_DO | J3.5 (P0_1) | J3.35 (NC/P0_24) - DATA_IN |
| PCM_DI | J3.3 (P0_0) | J3.28 (NC/P0_26) - DATA_OUT |
MikroBUS I2C signals (module control interface):
- I2C_SCL (output)
- I2C_SDA (input/output)
| Signals | DA1459x/DA1469x Pro-MB Pins | DA1459x/DA1469x Pro-MB Pins - DA7218 MikroBUS #1 |
| I2C_SCL | J3.19 (P0_12) | J3.36 (NC/P0_30) - I2C_SCL |
| I2C_SDA | J3.23 (P0_14) | J3.38 (NC/P0_31) - I2C_SDA |
SDADC signals:
- PGA_INP (input). Connect to analog MIC positive pin.
- PGA_INM (input). Connect to analog MIC negative pin.
| Signals | DA1459x Pro-MB Pins | Analog MIC |
| PGA_INP | J4.3 (P1_0) | MICp |
| PGA_INM | J4.5 (P1_1) | MICn |
| VDD 1V8 | J4.28 (V30/VDDIO) | MIC_BIAS |
| GND | ANY GND | ANY GND |
Button:
| Signals | DA1459x/DA1469x Pro-MB Pins |
| Button | J3.6 (P0_10/P0_6) |
DEMO_PDM_MIC
- Demonstrated path: PDM-SRC1-PCM
- Source file:
audio_task.c
- Description: The demo allows the user to listen to a voice signal from a PDM Mic input (such as SPK0838HT4H-B, SPH1668LM4H-1, SPM1423HM4H-B digital microphones), using headphones or a speaker which is hooked in the Codec DA7218 module jack.
- Hardware Setup:
- DA1459x Pro-DB connected on a Renesas DA1469x or DA1459x Pro-MB
- Renesas DA7218 MikroBUS module connected on MikroBUS socket #1 (J15 and J16) of the Pro-MB. Headphones or a speaker is hooked in the Codec module jack.
- Digital microphone, e.g. from DA14680 Sensor board, wired on the corresponding Pro-MB pins (see Wiring Table)
- Wiring: according to the above wiring tables.
- Run steps: To enable the demo, go to the
includes/audio_task.h file and set the macro:
DEMO_PDM_RECORD_PLAYBACK
- Demonstrated path: PDM-SRC1-MEMORY -> MEMORY-SRC1-PCM
- Source file:
audio_task.c
- Description: The demo allows the user to listen to a voice signal from a PDM Mic input (such as SPK0838HT4H-B, SPH1668LM4H-1, SPM1423HM4H-B digital microphones), using headphones or a speaker which is hooked in the Codec DA7218 module jack. The voice signal is stored in memory first. More specifically:
- The PDM-SRC1-Memory audio data path allows the user to record the PDM input to XiP flash (Log partition) by grounding P0_10 momentarily (button pin). The recording duration is differentiated according to build configuration with the default sample rate and bit depth.
- The Memory-SRC1-PCM audio data path allows the user to listen to recorded audio, using a headset hooked in a DA7218 module jack.
- Hardware Setup: same as
DEMO_PDM_MIC
- DA1459x Pro-DB connected on a Renesas DA1469x or DA1459x Pro-MB
- Renesas DA7218 MikroBUS module connected on MikroBUS socket #1 (J15 and J16) of the Pro-MB. Headphones or a speaker is hooked in the Codec module jack.
- Digital microphone, e.g. from DA14680 Sensor board, wired on the corresponding Pro-MB pins (see Wiring Table)
- Wiring: same as
DEMO_PDM_MIC wiring, "BUTTON" is added, according to the above wiring tables.
- Run steps: To enable the demo, go to the
includes/audio_task.h file and set the macro:
#define DEMO_PDM_RECORD_PLAYBACK (1)
Notes:
- The file
partition_table.h might need to be edited based on the recording needs of the demos. The FIRMWARE and LOG partitions should be carefully calculated and set.
- In case the file
partition_table.h is edited, the script program_qspi_nvparam should be run to apply the new settings, selected from the "Run->External Tools" popup menu.
audio_task.h:BUFSIZE_FACTOR relates to heap size and determines the recording duration.
- Cannot run RAM build configuration (error: RAM overflowed)
DEMO_PCM_MIC
- Demonstrated path: PCM-SRC1-PCM
- Source file:
audio_task.c
- Description: The demo allows the user to listen to a voice signal from a PCM Mic input, using headphones or a speaker which is hooked in the Codec DA7218 module jack.
- Hardware Setup:
- DA1459x Pro-DB connected on a Renesas DA1469x or DA1459x Pro-MB
- Renesas DA7218 MikroBUS module connected on MikroBUS socket #1 (J15 and J16) of the Pro-MB. A headset is hooked in the Codec module jack, so that the MIC and the headphones are used.
- Wiring: according to the above wiring tables.
- Run steps: To enable the demo, go to the
includes/audio_task.h file and set the macro:
DEMO_PCM_RECORD_PLAYBACK
- Demonstrated path: PCM-SRC1-MEMORY -> MEMORY-SRC1-PCM
- Source file:
audio_task.c
- Description: The demo allows the user to listen to a voice signal from a PCM Mic input, using headphones or a speaker which is hooked in the Codec DA7218 module jack. The voice signal is stored in memory first. More specifically:
- The PCM-SRC1-Memory audio data path allows the user to record PCM input to XiP flash (Log partition) by grounding P0_10 momentarily (button pin). The recording duration is differentiated according to build configuration with the default sample rate and bit depth.
- The Memory-SRC1-PCM audio data path allows the user to listen to recorded audio, using a headset hooked in a DA7218 module jack.
- Hardware Setup: same as
DEMO_PCM_MIC
- DA1459x Pro-DB connected on a Renesas DA1469x or DA1459x Pro-MB
- Renesas DA7218 MikroBUS module connected on MikroBUS socket #1 (J15 and J16) of the Pro-MB. A headset is hooked in the Codec module jack, so that the MIC and the headphones are used.
- Wiring: same as
DEMO_PCM_MIC, "BUTTON" is added, according to the above wiring tables.
- Run steps: To enable the demo, go to the
includes/audio_task.h file and set the macro:
#define DEMO_PCM_RECORD_PLAYBACK (1)
Notes:
- The file
partition_table.h might need to be edited based on the recording needs of the demos. The FIRMWARE and LOG partitions should be carefully calculated and set.
- In case the file
partition_table.h is edited, the script program_qspi_nvparam should be run to apply the new settings, selected from the "Run->External Tools" popup menu.
audio_task.h:BUFSIZE_FACTOR relates to heap size and determines the recording duration.
- Cannot run RAM build configuration (error: RAM overflowed)
DEMO_MEM_TO_MEM
- Demonstrated path: MEMORY-SRC1-MEMORY
- Source file:
audio_task.c
- Description: The demo converts the sample rate of 16 KHz of a tone of 1 KHz in memory to 8 KHz sample rate. Using memory browser, the tone (not the samples) in the input memory buffer must be the same with the one in the output memory buffer.
- Hardware Setup:
- DA1459x Pro-DB connected on a Renesas DA1469x or DA1459x Pro-MB
- Wiring: NONE
- Run steps: To enable the demo, go to the
includes/audio_task.h file and set the macro:
#define DEMO_MEM_TO_MEM (1)
Note:
audio_task.h:BUFSIZE_FACTOR relates to heap size and determines the recording duration.
DEMO_PDM_MIC_PARALLEL_SRCS
- Demonstrated paths: PATH_1: PDM-SRC1-MEMORY PATH_2: MEMORY-SRC2-PCM
- Source file:
audio_task.c
- Description: The demo allows the user to listen the 1 KHz tone, using a headset hooked in a DA7218 module jack and using debugger to retrieve the data recorded from PDM Mic input. More specifically:
- The PDM-SRC1-MEMORY audio data path allows the user to record PDM input to RAM for a duration differentiated according to build configuration with the default sample rate and bit depth. Recorded data can be retrieved using debugger's memory browser.
- The Memory-SRC2-PCM audio data path allows the user to listen to recorded tone, using headphones or a speaker hooked in a DA7218 module jack.
- Hardware Setup:
- DA1459x Pro-DB connected on a Renesas DA1469x or DA1459x Pro-MB
- Renesas DA7218 MikroBUS module connected on MikroBUS socket #1 (J15 and J16) of the Pro-MB. Headphones or a speaker is hooked in the Codec module jack.
- Digital microphone, e.g. from DA14680 Sensor board, wired on the corresponding Pro-MB pins (see Wiring Table)
- Wiring: same as
DEMO_PDM_MIC wiring, "BUTTON" is added, according to the above wiring tables.
- Run steps: To enable the demo, go to the
includes/audio_task.h file and set the macro:
#define DEMO_PDM_MIC_PARALLEL_SRCS (1)
Notes:
- The file
partition_table.h might need to be edited based on the recording needs of the demos. The FIRMWARE and LOG partitions should be carefully calculated and set.
- In case the file
partition_table.h is edited, the script program_qspi_nvparam should be run to apply the new settings, selected from the "Run->External Tools" popup menu.
audio_task.h:BUFSIZE_FACTOR relates to heap size and determines the recording duration.
- Cannot run RAM build configuration (error: RAM overflowed)
DEMO_SDADC_MIC
- Demonstrated path: SDADC-SRC1-PCM
- Source file:
audio_task.c
- Description: The demo allows the user to listen to a voice signal from an Analog Mic input (such as CMM-3729AB-38108-TR mems analog microphone), using headphones or a speaker which is hooked in the Codec DA7218 module jack. The analog signal from the MIC is sampled using the DA1459x SDADC.
- Hardware Setup:
- DA1459x Pro-DB connected on a Renesas DA1469x or DA1459x Pro-MB
- Renesas DA7218 MikroBUS module connected on MikroBUS socket #1 (J15 and J16) of the Pro-MB. Headphones or a speaker is hooked in the Codec module jack.
- Analog microphone differential signals, e.g. from DA14680 Sensor board or similar, wired on the corresponding Pro-MB pins (see Wiring Table)
- Wiring: according to the above wiring tables.
- Run steps: To enable the demo, go to the
includes/audio_task.h file and set the macro:
#define DEMO_SDADC_MIC (1)
DEMO_SDADC_RECORD_PLAYBACK
- Demonstrated path: SDADC-SRC1-MEMORY-> MEMORY-SRC1-PCM
- Source file:
audio_task.c
- Description: The demo allows the user to listen to a voice signal from an Analog Mic input (such as CMM-3729AB-38108-TR mems analog microphone), using headphones or a speaker which is hooked in the Codec DA7218 module jack. The analog signal from the MIC is sampled using the DA1459x SDADC, which is stored in memory first. More specifically:
- The SDADC-SRC1-Memory audio data path allows the user to record analog MIC input to RAM by grounding P0_10 momentarily (button pin). The recording duration is differentiated according to build configuration with the default sample rate and bit depth.
- The Memory-SRC1-PCM audio data path allows the user to listen to recorded audio, using a headset hooked in a DA7218 module jack.
- Hardware Setup:
- DA1459x Pro-DB connected on a Renesas DA1469x or DA1459x Pro-MB
- Renesas DA7218 MikroBUS module connected on MikroBUS socket #1 (J15 and J16) of the Pro-MB. Headphones or a speaker is hooked in the Codec module jack.
- Analog microphone differential signals, e.g. from DA14680 Sensor board or similar, wired on the corresponding Pro-MB pins (see Wiring Table)
- Wiring: same as
DEMO_SDADC_MIC wiring, "BUTTON" is added, according to the above wiring tables.
- Run steps: To enable the demo, go to the
includes/audio_task.h file and set the macro:
#define DEMO_SDADC_RECORD_PLAYBACK (1)
Notes:
- The file
partition_table.h might need to be edited based on the recording needs of the demos. The FIRMWARE and LOG partitions should be carefully calculated and set.
- In case the file
partition_table.h is edited, the script program_qspi_nvparam should be run to apply the new settings, selected from the "Run->External Tools" popup menu.
audio_task.h:BUFSIZE_FACTOR relates to heap size and determines the recording duration.
- Cannot run RAM build configuration (error: RAM overflowed)