diff --git a/boards/adafruit-clue/include/periph_conf.h b/boards/adafruit-clue/include/periph_conf.h index a0e486ee6c655..ba5049d1934b3 100644 --- a/boards/adafruit-clue/include/periph_conf.h +++ b/boards/adafruit-clue/include/periph_conf.h @@ -116,7 +116,7 @@ static const spi_conf_t spi_config[] = { /** @} */ /** - * @name PDM configuration + * @brief PDM configuration * @{ */ static const pdm_conf_t pdm_config = { diff --git a/boards/feather-nrf52840-sense/include/periph_conf.h b/boards/feather-nrf52840-sense/include/periph_conf.h index 3367507ef758b..562db9306f1eb 100644 --- a/boards/feather-nrf52840-sense/include/periph_conf.h +++ b/boards/feather-nrf52840-sense/include/periph_conf.h @@ -86,7 +86,7 @@ static const i2c_conf_t i2c_config[] = { /** @} */ /** - * @name PDM configuration + * @brief PDM configuration * @{ */ static const pdm_conf_t pdm_config = { diff --git a/cpu/nrf52/include/periph_cpu.h b/cpu/nrf52/include/periph_cpu.h index 36d5f7d452d4b..2e1511847e25e 100644 --- a/cpu/nrf52/include/periph_cpu.h +++ b/cpu/nrf52/include/periph_cpu.h @@ -116,7 +116,6 @@ void spi_twi_irq_register_i2c(NRF_TWIM_Type *bus, spi_twi_irq_cb_t cb, void *arg); /** - * @brief Acquire the shared I2C/SPI peripheral in I2C mode * * @param bus bus to acquire exclusive access on @@ -147,7 +146,7 @@ void nrf5x_spi_acquire(NRF_SPIM_Type *bus, spi_twi_irq_cb_t cb, void *arg); * @param bus bus to release exclusive access on */ void nrf5x_spi_release(NRF_SPIM_Type *bus); - + /** * @brief Structure for PDM configuration data */ @@ -155,7 +154,6 @@ typedef struct { uint8_t din_pin; /**< DIN pin */ uint8_t clk_pin; /**< CLK pin */ } pdm_conf_t; - #ifdef __cplusplus } #endif diff --git a/cpu/nrf52/periph/pdm.c b/cpu/nrf52/periph/pdm.c index 3342fee1fa6d0..1630b27f74131 100644 --- a/cpu/nrf52/periph/pdm.c +++ b/cpu/nrf52/periph/pdm.c @@ -26,7 +26,7 @@ #include "periph/gpio.h" #include "periph/pdm.h" -#define ENABLE_DEBUG (0) +#define ENABLE_DEBUG 0 #include "debug.h" /* The samples buffer is a double buffer */ diff --git a/dist/tools/pdm_check/README.md b/dist/tools/pdm_check/README.md new file mode 100644 index 0000000000000..ff1a60db389ab --- /dev/null +++ b/dist/tools/pdm_check/README.md @@ -0,0 +1,13 @@ +# PDM Testing Report + +## About +This report outlines the testing process and results for a PDM implementation on a Feather nRF52840 Sense board to validate its functionality and performance. + +## Requirements +To run the python script, you need to install some packages listed in `requirements.txt`. + +## Usage +This repord provides insights into the testing and the corresponding results obtained: +-Testing the PDM and visualizing the results in a chart. +-Saving the output data as a wave format for Audacity. +-Comparing the output signals from Python script and that from the Audacity. diff --git a/dist/tools/pdm_check/requirements.txt b/dist/tools/pdm_check/requirements.txt new file mode 100644 index 0000000000000..4ff3b47a91788 --- /dev/null +++ b/dist/tools/pdm_check/requirements.txt @@ -0,0 +1,3 @@ +matplotlib==3.8.3 +numpy==1.26.4 +pyserial==3.5 diff --git a/tests/periph_pdm/testing_pdm_conversion.py b/dist/tools/pdm_check/testing_pdm_conversion.py similarity index 85% rename from tests/periph_pdm/testing_pdm_conversion.py rename to dist/tools/pdm_check/testing_pdm_conversion.py index bf60805477b36..0aa973db8a087 100644 --- a/tests/periph_pdm/testing_pdm_conversion.py +++ b/dist/tools/pdm_check/testing_pdm_conversion.py @@ -1,20 +1,15 @@ import matplotlib.pyplot as plt import matplotlib.patches as mpatches -import re import numpy as np -import os -import csv from itertools import groupby from operator import itemgetter import serial -import struct import wave -import time str1 = "Start of the new buffer".encode('ascii') -str2= "End of the new buffer".encode('ascii') +str2 = "End of the new buffer".encode('ascii') -start_index_buf = 0 +start_index_buf = 0 stop_index_buf = 0 start_found = False buffer_number = 0 @@ -27,7 +22,6 @@ ser.writelines(["start\n".encode('ascii')]) while start: line = ser.readline() - #print(line) value = line.strip() data[key] = value if line.find(str1) != -1: @@ -41,7 +35,7 @@ break key +=1 -print(start_index_buf) +print(start_index_buf) print(stop_index_buf) print(buffer_number) ser.close() @@ -61,23 +55,23 @@ samplerate = 16000 length = 1 -# The left channel for 1 second. +# The left channel for 1 second t = np.linspace(0, length, samplerate) left_channel = 0.5 * np.sin(2 * np.pi * 440.0 * t) -# Noise on the right channel. +# Noise on the right channel #right_channel = np.random.random(size=samplerate) left_channel = data_to_plot/np.max(np.abs(data_to_plot)) audio = np.array([left_channel]).T -# Convert to (little-endian) 16 bit integers. +# Convert to (little-endian) 16 bit integers audio = (audio * (2 ** 15 - 1)).astype("