Hallo,
eine kurze Frage. Beschäftige mich seit kurzem zum ersten mal mit den
hal-libs für das stm32f7-Board.
Ich möchte gerne einfach mal den Audiocodec zum laufen bekommen. Das
Modul stm32746g_discovery_audio.c bietet dafür ja ausreichend Code.
Unter anderem die Funktion
uint8_t BSP_AUDIO_IN_OUT_Init(uint16_t InputDevice, uint16_t
OutputDevice, uint8_t Volume, uint32_t AudioFreq)
Nun meine Frage, hat jemand schonmal diese Funktion verwendet? So wie es
aussieht brauch ich diese ja nur aufzurufen und schon sollte aus dem
Klinke etwas herausbekommen. Ich höre allerdings nur Rauschen,
proportional zu der Volume-Einstellung... allerdings kein Ton. Habe ich
einen Denkfehler?
Zu dem einfachen Code:
Thomas K. schrieb:> Hallo,>> So wie es> aussieht brauch ich diese ja nur aufzurufen und schon sollte aus dem> Klinke etwas herausbekommen. Ich höre allerdings nur Rauschen,> proportional zu der Volume-Einstellung... allerdings kein Ton. Habe ich> einen Denkfehler?
So wie es aussieht, bist Du mit dieser Auffassung auf dem Holzweg.
Hättest Du recherchiert, wüsstest Du:
41 1. How To use this driver:
42 --------------------------
43 - This driver supports STM32F4xx devices on STM32F4-Discovery
Kit:
44 a) to play an audio file (all functions names start by
BSP_AUDIO_OUT_xxx)
45 b) to record an audio file through MP45DT02, ST MEMS (all
functions names start by AUDIO_IN_xxx)
46
47 a) PLAY A FILE:
48 ==============
49 + Call the function BSP_AUDIO_OUT_Init(
50 OutputDevice: physical output
mode (OUTPUT_DEVICE_SPEAKER,
51
OUTPUT_DEVICE_HEADPHONE, OUTPUT_DEVICE_AUTO or
52 OUTPUT_DEVICE_BOTH)
53 Volume: initial volume to be set
(0 is min (mute), 100 is max (100%)
54 AudioFreq: Audio frequency in Hz
(8000, 16000, 22500, 32000 ...)
55 this parameter is relative to
the audio file/stream type.
56 )
57 This function configures all the hardware required for the
audio application (codec, I2C, I2S,
58 GPIOs, DMA and interrupt if needed). This function returns 0
if configuration is OK.
59 If the returned value is different from 0 or the function is
stuck then the communication with
60 the codec (try to un-plug the power or reset device in this
case).
61 - OUTPUT_DEVICE_SPEAKER: only speaker will be set as output
for the audio stream.
62 - OUTPUT_DEVICE_HEADPHONE: only headphones will be set as
output for the audio stream.
63 - OUTPUT_DEVICE_AUTO: Selection of output device is made
through external switch (implemented
64 into the audio jack on the discovery board). When the
Headphone is connected it is used
65 as output. When the headphone is disconnected from the
audio jack, the output is
66 automatically switched to Speaker.
67 - OUTPUT_DEVICE_BOTH: both Speaker and Headphone are used as
outputs for the audio stream
68 at the same time.
69 + Call the function BSP_AUDIO_OUT_Play(
70 pBuffer: pointer to the audio data
file address
71 Size: size of the buffer to be
sent in Bytes
72 )
73 to start playing (for the first time) from the audio
file/stream.
74 + Call the function BSP_AUDIO_OUT_Pause() to pause playing
75 + Call the function BSP_AUDIO_OUT_Resume() to resume playing.
76 Note. After calling BSP_AUDIO_OUT_Pause() function for pause,
only BSP_AUDIO_OUT_Resume() should be called
77 for resume (it is not allowed to call BSP_AUDIO_OUT_Play()
in this case).
78 Note. This function should be called only when the audio file
is played or paused (not stopped).
79 + For each mode, you may need to implement the relative callback
functions into your code.
80 The Callback functions are named BSP_AUDIO_OUT_XXXCallBack()
and only their prototypes are declared in
81 the stm32f4_discovery_audio.h file. (refer to the example for
more details on the callbacks implementations)
82 + To Stop playing, to modify the volume level, the frequency or
to mute, use the functions
83 BSP_AUDIO_OUT_Stop(), BSP_AUDIO_OUT_SetVolume(),
AUDIO_OUT_SetFrequency() BSP_AUDIO_OUT_SetOutputMode and
BSP_AUDIO_OUT_SetMute().
84 + The driver API and the callback functions are at the end of the
stm32f4_discovery_audio.h file.
Hallo und danke für die schnellen Antworten,
ich habe meine Frage etwas falsch formuliert. Ich wollte mit der
besagten Funktion die Audiodaten des Onboard-Miko ausgeben. Allerdings
gibt es wenig Dokumentation über diese Funktion im Netz aber ich hatte
noch nicht die Zeit mir den Code anzuschauen. Heute werde ich mir die
Sache mal genauer anschauen.
Kann mir jemand sagen, wie ich prüfen kann, ob der STM Audiodaten
empfangen hat? Abspielen eines im RAM liegenden Buffer funktioniert,
sogar für kleine Felder (kleiner 70 byte), was bei dem stm32f4 nicht
möglich war. Beim einlesen der Daten und abspeichern in einem Feld habe
ich jedoch keinen Erfolg. Wenn ich mit dem Debugger prüfe, welche Daten
im Buffer liegen, bekomme ich nur Nullen.
Thomas K. schrieb:> Kann mir jemand sagen, wie ich prüfen kann, ob der STM Audiodaten> empfangen hat?
Ich hätte mir eine kleine Konsole im STM programmiert, und dort die
nötigen Befehle zum (high-level-)Debugging untergebracht...