-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
drivers/periph/pdm: initial pdm implementation #20509
base: master
Are you sure you want to change the base?
Conversation
tests/periph_pdm/larger_buff_size.py
Outdated
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you are providing a script, maybe it is better to provide it in a tests
sub-folder or maybe even somewhere in tools/dist
?
It should also have some sort of requirements.txt
so others can easily setup the and run it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you Kevin for your guidance and assistance.
I will move the python script to the dist/tools folder and include the requirements.txt and readme.md files as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have a new naming convention for our test folder.
tests/periph_pdm
-> tests/periph/pdm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should also be a README.md
in the test folder... even if it just points to the dist/tools/pdm_check
tool.
7bd13e4
to
b56629b
Compare
OK. So there were many thing that should still be looked at here. I push my work so people can see, cleanup is needed. Also @baharehf can drop my commits if needed. The test that I adapted now tests different sample rates and it appears that they values are not that correct. Probably something to do with the ratio setting. This drove us to a rabbit hole of how to handle sample rates, wouldn't it be nice to get a way to iterate through possible sample rates (for testing purposes) or set arbitrary ones. We have this type of issue with the SPI driver as well. Where we left it is (despite Nordics poor documentation) we should be able to set arbitrary sample rates and read back the real sample rate. This means extending the API. |
So many things were found and fixed... I changed the test application so we could verify sample rates. I added tests that check the values of the sample rates and some sanity check of the actual samples Added a few changes to the API to make it more testable, such as the variable sample rate and checking the real sample rate. Implemented variable sample rate. Cleaned up the python application to only use the output files and removed unneeded dependencies. Updated the documentation...
b56629b
to
a712b25
Compare
So I did some work on it. The commits will need to be cleaned up. There is (at least) one remaining point that I would like solved, there seems to be a recording artifact at the start of the recording. @MichelRottleuthner mentioned something about this, maybe we need a backoff value or something like that in the API? I have also only tested on the As well as some cleanup and documentation of the variables (maybe too much magic number usage). |
It would be nice to finish this off... |
Contribution Description
The pulse density modulation (PDM) module enables input of pulse density modulated signals from external audio frontends, for example, digital microphones. The PDM module generates the PDM clock and supports single-channel or dual-channel (left and right) data input. Data is transferred directly to RAM buffers using EasyDMA.
Testing procedure
I was working on PDM peripheral and utilized for Feather nRF52840 Sense board, conducting comprehensive some tests to validate itsperformance. after thorough examination, I successfully recorded from the PDM on the board and saw the result in the chart of python code and compared with Audacity application output.
Issues/PRs references
based on #16125