| BlueNRG-1 Peripherals drivers Examples

- Main Page
- Modules
- Classes
- Files

- File List
- File Members

Macros | Functions | Variables
ADC_PDM_main.c File Reference

This code example demonstrates the ADC PDM stream capability. More...

`#include "BlueNRG1.h"`
`#include "BlueNRG1_conf.h"`
`#include "SDK_EVAL_Config.h"`
`#include <stdio.h>`

Go to the source code of this file.

## Macros

#define | FS 8000
#define | UART_BAUDRATE (512000)
#define | PCM_BUFFER_SIZE 16

## Functions

void | ADC_Configuration (void)
| ADC_Configuration. More...
void | GPIO_Configuration (void)
| GPIO_Configuration. More...
void | DMA_Configuration (void)
| DMA_Configuration. More...
int | main (void)
| Main program. More...
void | TC_IT_Callback (void)
| DMA Transfer Complete Callback. More...
void | HT_IT_Callback (void)
| DMA Half Transfer Callback. More...

## Variables

ADC_InitType | xADC_InitType
int16_t | PCM_Buffer [PCM_BUFFER_SIZE]

## Detailed Description

This code example demonstrates the ADC PDM stream capability.

# ATOLLIC project

To use the project with ATOLLIC TrueSTUDIO for ARM, please follow the instructions below:

1. Open the ATOLLIC TrueSTUDIO for ARM and select File->Import... Project menu.
2. Select Existing Projects into Workspace.
3. Select the ATOLLIC project
4. Select desired configuration to build from Project->Manage Configurations
5. Select Project->Rebuild Project. This will recompile and link the entire application
6. To download the binary image, please connect STLink to JTAG connector in your board (if available).
7. Select Project->Download to download the related binary image.
8. Alternatively, open the BlueNRG1 GUI, put the board in bootloader mode and download the built binary image.

# KEIL project

To use the project with KEIL uVision 5 for ARM, please follow the instructions below:

1. Open the KEIL uVision 5 for ARM and select Project->Open Project menu.
2. Open the KEIL project `...\Project\BlueNRG1_Periph_Examples\ADC\PDM\MDK-ARM\PDM.uvprojx`
3. Select desired configuration to build
4. Select Project->Rebuild all target files. This will recompile and link the entire application
5. To download the binary image, please connect STLink to JTAG connector in your board (if available).
6. Select Project->Download to download the related binary image.
7. Alternatively, open the BlueNRG1 GUI, put the board in bootloader mode and download the built binary image.

# IAR project

To use the project with IAR Embedded Workbench for ARM, please follow the instructions below:

1. Open the Embedded Workbench for ARM and select File->Open->Workspace menu.
2. Open the IAR project `...\Project\BlueNRG1_Periph_Examples\ADC\PDM\EWARM\PDM.eww`
3. Select desired configuration to build
4. Select Project->Rebuild All. This will recompile and link the entire application
5. To download the binary image, please connect STLink to JTAG connector in your board (if available).
6. Select Project->Download and Debug to download the related binary image.
7. Alternatively, open the BlueNRG1 GUI, put the board in bootloader mode and download the built binary image.

## Project configurations

- `Release` - Release configuration

# Boards supported

- `STEVAL-IDB007V1`

# Power configuration settings

STEVAL-IDB007V1
Jumper name |  | Description
JP1 | JP2 |
ON 1-2 | ON 2-3 | USB supply power
ON 2-3 | ON 1-2 | The supply voltage must be provided through battery pins.
ON 1-2 |  | USB supply power to STM32L1, JP2 pin 2 external power to BlueNRG1

# Jumper settings

STEVAL-IDB007V1
Jumper name | Description
JP1 | 1-2: to provide power from USB (JP2:2-3). 2-3: to provide power from battery holder (JP2:1-2)
JP2 | 1-2: to provide power from battery holder (JP1:2-3). 2-3: to provide power from USB (JP1:1-2). Pin2 to VDD to provide external power supply to BlueNRG-1 (JP1: 1-2)
JP3 | pin 1 and 2 UART RX and TX of MCU. pin 3 GND.
JP4 | Fitted: to provide VBLUE to BlueNRG1. It can be used also for current measurement.
JP5 | Fitted : TEST pin to VBLUE. Not fitted: TEST pin to GND

# Pin settings

PIN name | STEVAL-IDB007V1
ADC1 | Not Used
ADC2 | Not Used
IO0 | Not Used
IO1 | ADC PDM data
IO11 | Not Used
IO12 | Not Used
IO13 | Not Used
IO14 | Not Used
IO2 | ADC PDM CLK
IO3 | Not Used
IO4 | Not Used
IO5 | Not Used
IO6 | Not Used
IO7 | Not Used
IO8 | Not Used
TEST1 | Not Used

# Serial I/O

The application will listen for keys typed and it will send back in the serial port. In other words everything typed in serial port will be send back.

Parameter name | Value | Unit
Baudrate | 512000 | bit/sec
Data bits | 8 | bit
Parity | None | bit
Stop bits | 1 | bit

# LEDs description

LED name | STEVAL-IDB007V1
DL1 | Not Used
DL2 | Not Used
DL3 | Not Used
DL4 | Power

# Buttons description

BUTTON name | STEVAL-IDB007V1
PUSH1 | Not Used
PUSH2 | Not Used
RESET | Reset BlueNRG1

# Usage

This ADC PDM example shows a PDM stream processor from a MEMS microphone (MP34DT01-M i.e.) to UART.

- How to Setup HW connections:

MEMS microphone (MP34DT01-M) pins | STEVAL-IDB007V1 connector/(pin)
PIN 1 /(VDD) | CN 2.2/(VBLUE)
PIN 2 /(LR) | CN 2.6/(GND)
PIN 3 /(CLK) | CN 1.4/(IO2)
PIN 4 /(DOUT) | CN 1.3/(IO1)
PIN 5 /(GND) | CN 2.7/(GND)

The application supports also the MEMS microphone MP34DT01-M on board of X-NUCLEO-CCA02MM1.

X-NUCLEO-CCA02MM1 connector/(pins) | STEVAL-IDB007V1 connector/(pin)
CN 7.12 /(3V3) | CN 2.2/(VBLUE)
CN 7.20 /(GND) | CN 2.6/(GND)
CN 10.29 /(CLK) | CN 1.4/(IO2)
CN 10.26 /(DOUT) | CN 1.3/(IO1)

NOTES: LR is already connected on X-NUCLEO-CCA02MM1.

- Connect the BlueNRG-1 STEVAL-IDB007V1 to a PC USB port and open PuTTY serial terminal [512000, 8-N-1-N].
- Configure the PuTTY serial terminal to store the captured data on a log file.
- On the PC, open the Audacity tool and import the streamed data:
  1. File/Import/Raw Data.
  2. Open the log data.
  3. Configure as follows:
     - Encoding: Signed 16-bit PCM.
     - Byte order: Little-endian.
     - Channels: 1 Channel (Mono).
     - Sample rate: 8000 (default, 16 kbps is supported by changing the firmware symbol FS in ADC_PDM_main.c)
  4. Press the button Import.
- Play the audio.

NOTES: Due to the fact that the output data format is 2-bytes (B1B2), it is possible that the serial terminal gets as first byte, half data (B2). This first byte must be removed from the log file.

Definition in file ADC_PDM_main.c.