Tone Generation Using FRDM-KL25Z

Thread Starter

ShaneMcK116

Joined Apr 23, 2019
1
Greetings AAC community!

I am attempting to construct a simple hearing test using a FRDM-KL25Z and am having some issues getting started.

I would like for the audio to output to
each respective ear on
headphones using a breadboard. I am using Keil uVision version 5.0 but the coding can be either main.c or asm_main.s

The device will feature two inputs, one by the individual administering the test, a second for the person being tested and two outputs. The first input will be a button to start the test and send a frequency to the headphones to either the left or right ear one at a time. Five different frequencies (ranging from 250-8000 Hertz, the range of an average person's hearing) will be sent to each ear. After each frequency is sent, the person being tested inputs whether the noise was heard or not, lighting an LED corresponding to that frequency if it was. Once all 10 frequencies have been tested, the user can tell the range of hearing in each ear.

A breakdown of how I would like it to function:

Input 1 - Button Starts the program

Frequency 1 is sent to the left ear of the headphones

Input 2 - The tested user presses a button to confirm hearing the tone, lighting the LED corresponding to it. No input if it was not heard.

Frequency 1 is sent the right ear of the headphones after a 5 second delay (to allow Input 2 time to respond)

Input 2 - The tested user presses a button to confirm hearing the tone, lighting the LED corresponding to it. No input if it was not heard.

Frequency 2 is sent to the ear of the headphones after a 5 second delay

…..

After all 5 frequencies have been sent to each ear the user can see their range of hearing for each ear from the lit LED's.

Input 1 - The button stops the program, turning off all LED's



I would greatly appreciate any and all help I can receive for this such as practical products/coding to use. I thank anyone in advance who is willing to assist me!
 

danadak

Joined Mar 10, 2018
4,057
The Kinetis Freescale parts and IDE quite good. I worked as FAE on their
offerings years past, liked the tool very much.

I do not know if this series has wavedac capability or Analog Mux or OpAmps so
just thought I would show another possibility.

Another approach (ARM M3 core) -

upload_2019-4-24_15-53-26.png

This is done with the higher end PSOC 5LP part, I think it can also be done in lower end
PSOC 4M part (ARM M0+ core), just got lazy.

This is one chip solution, tone can be sinusoidal or tri or pulse or custom. ISRs were
used to indicate end of events. An ISR can be added for end of a single wave form cycle
if so desired when transitioning from one tone to another so no 'pops", "clicks" heard.

Note WaveDAC amplitude, "volume", can also be controlled using external pot and
on chip A/D to read it and adjust WaveDAC volume.

Code, C, should be fairly simple, < 100 lines of code I think. maybe even < 50.

As you can see in the right hand resources window still a lot of chip resources unused.
One could use onboard Digital Filter to create some "unusual" spectra for "tones". Also
static or intelligent LCD could be used vs LEDs for information and tone test results.
There are resources onchip to handle that as well.

Note I could have used state machine wizard to gen most of the code, but still learning
that capability.


Regards, Dana.
 
Last edited:

danadak

Joined Mar 10, 2018
4,057
Here is a list of components on PSOC. A component is an onchip resource.
This list is for 5LP family, the PSOC 4 family low end has a subset of these
resources.

Attached.

Regards, Dana.
 

Attachments

Top