Record to a pulseaudio stream, and manage switching between streams - alsa

I am trying to set up audio card configurations along with pulseaudio, but I am not sure how alsa configuration is exactly done.
Until this point, I was able to use a single card, and select default source and sink as follows, that worked until I needed to mix another stream to my output.
pacmd set-default-source alsa_input.platform-sound.analog-mono
pacmd set-default-sink alsa_output.platform-sound.analog-mono
Now, I am going to use one more sound card, so aplay -l gives:
**** List of PLAYBACK Hardware Devices ****
card 0: cs42888audio [cs42888-audio], device 0: HiFi cs42888-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: wm8960audio [wm8960-audio], device 0: HiFi wm8960-hifi-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: wm8960audio [wm8960-audio], device 1: HiFi-ASRC-FE (*) []
Subdevices: 1/1
Subdevice #0: subdevice #0
card 2: amixaudiosai [amix-audio-sai], device 0: HiFi-AMIX-FE (*) []
Subdevices: 1/1
Subdevice #0: subdevice #0
card 2: amixaudiosai [amix-audio-sai], device 1: HiFi-AMIX-FE (*) []
Subdevices: 1/1
Subdevice #0: subdevice #0
arecord -l gives:
**** List of CAPTURE Hardware Devices ****
card 0: cs42888audio [cs42888-audio], device 0: HiFi cs42888-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: wm8960audio [wm8960-audio], device 0: HiFi wm8960-hifi-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: wm8960audio [wm8960-audio], device 1: HiFi-ASRC-FE (*) []
Subdevices: 1/1
Subdevice #0: subdevice #0
card 2: amixaudiosai [amix-audio-sai], device 0: HiFi-AMIX-FE (*) []
Subdevices: 1/1
Subdevice #0: subdevice #0
pactl list short sinks
0 alsa_output.platform-sound-amix-sai.analog-mono module-alsa-card.c s16le 1ch 48000Hz SUSPENDED
2 alsa_output.platform-sound.analog-mono module-alsa-card.c s16le 1ch 48000Hz SUSPENDED
4 alsa_output.platform-sound-cs42888.analog-surround-51 module-alsa-card.c s16le 6ch 48000Hz SUSPENDED
5 my_stream module-null-sink.c s16le 2ch 48000Hz SUSPENDED
pactl list short sources
0 alsa_output.platform-sound-amix-sai.analog-mono.monitor module-alsa-card.c s16le 1ch 48000Hz SUSPENDED
1 alsa_input.platform-sound-amix-sai.analog-mono module-alsa-card.c s16le 1ch 48000Hz SUSPENDED
3 alsa_input.platform-sound-cs42888.analog-mono module-alsa-card.c s16le 1ch 48000Hz SUSPENDED
4 alsa_output.platform-sound.analog-mono.monitor module-alsa-card.c s16le 1ch 48000Hz SUSPENDED
5 alsa_input.platform-sound.analog-mono module-alsa-card.c s16le 1ch 48000Hz SUSPENDED
7 alsa_output.platform-sound-cs42888.analog-surround-51.monitor module-alsa-card.c s16le 6ch 48000Hz SUSPENDED
8 my_stream.monitor module-null-sink.c s16le 2ch 48000Hz SUSPENDED
I would like to use CS42888 device and set up a configuration such as the following:
alsa_input.platform-sound-cs42888.analog-mono (Radio)
(Rate 48000, S16_LE)
|
> alsa_input.platform-sound.analog-mono (Microphone)
| |
| > alsa_input.a2dp_source (Bluetooth Audio, if available)
| | |
| | |
| | | System sounds
| | | |
| | | >
| | | |
| | > |
| | | |
-----------switching stream--------
|
|
>
|
|
alsa_output.platform-sound-cs42888.analog-mono
(Rate 48000, S16_LE)
(profile: output:analog-mono+input:analog-mono)
In other words, I would like to get Radio input, and be able to stream it on top of system sounds, whenever necessary. Also, I would like to achieve this in pulseaudio, since bluetooth audio and other stuff are managed using pulseaudio (module-bluez5-device).
I can get record and play radio input as follows successfully:
arecord -Dplug:hw:cs42888audio -f S16_LE -r 48000 test.wav
aplay -Dplug:hw:cs42888audio -f S16_LE test.wav
How do I set up such a configuration using pulseaudio? I would like to record to a stream and then manage switching between streams. Thanks in advance.

Related

Why is there memory leaks with SDL2 (2.0.14) dll?

I am using SDL2 version 2.0.14. This is the current stable version.
I noticed that any program I write with SDL2 has memory leaks. For example
#define SDL_MAIN_HANDLED
#include <SDL2/SDL.h>
int main() {
SDL_Init(SDL_INIT_VIDEO);
SDL_Window* window = SDL_CreateWindow("title",
SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
640, 480, SDL_WINDOW_OPENGL);
SDL_DestroyWindow(window);
SDL_Quit();
return 0;
}
This is the main.c file. I build it with gcc main.c -o main.exe -lSDL2 -lSDL2main
If I run drmemory main.exe this is what I get -
ERRORS FOUND:
1 unique, 2 total unaddressable access(es)
6 unique, 6 total uninitialized access(es)
0 unique, 0 total invalid heap argument(s)
0 unique, 0 total GDI usage error(s)
0 unique, 0 total handle leak(s)
0 unique, 0 total warning(s)
1 unique, 1 total, 88 byte(s) of leak(s)
1 unique, 1 total, 26 byte(s) of possible leak(s)
I don't see why this program has leaks at all. I tried to find out what is wrong and came across this question
Although this is already answered, I don't see how this solves my issue. I want to know why am I having these leaks and how to fix them. Also do I need to worry about those unaddressable and uninitialized accesses diagnosed by Dr. Memory.
I suspect it has to do something with the SDL2.dll I downloaded from SDL2. I am using the win32-x64 dll.
EDIT
Here is the full 'error' details
Dr. Memory version 2.3.0 build 1 built on Feb 6 2020 06:07:09
Windows version: WinVer=63;Rel=;Build=9600;Edition=Professional
Dr. Memory results for pid 4868: "main.exe"
Application cmdline: "main.exe"
Recorded 118 suppression(s) from default C:\Program Files (x86)\Dr. Memory\bin64\suppress-default.txt
Error #1: UNADDRESSABLE ACCESS beyond top of stack: reading 0x000000000023fb70-0x000000000023fb78 8 byte(s)
# 0 .text [../../../../../src/gcc-8.1.0/libgcc/config/i386/cygwin.S:132]
# 1 _pei386_runtime_relocator
# 2 __tmainCRTStartup
# 3 .l_start
# 4 KERNEL32.dll!BaseThreadInitThunk +0x21 (0x00007ff902e81412 <KERNEL32.dll+0x1412>)
Note: #0:00:00.281 in thread 3800
Note: 0x000000000023fb70 refers to 600 byte(s) beyond the top of the stack 0x000000000023fdc8
Note: instruction: or $0x0000000000000000 (%rcx) -> (%rcx)
Error #2: UNINITIALIZED READ: reading 0x000000000023eeec-0x000000000023eef0 4 byte(s) within 0x000000000023eee8-0x000000000023eef0
# 0 system call NtGdiOpenDCW parameter value #5
# 1 GDI32.dll!GetNearestColor +0x21f (0x00007ff903152650 <GDI32.dll+0x12650>)
# 2 GDI32.dll!GetNearestColor +0x30c (0x00007ff90315273d <GDI32.dll+0x1273d>)
# 3 GDI32.dll!CreateDCW +0x12 (0x00007ff903152783 <GDI32.dll+0x12783>)
# 4 SDL2.dll!? +0x0 (0x0000000073eae403 <SDL2.dll+0x10e403>)
# 5 SDL2.dll!? +0x0 (0x0000000073eae781 <SDL2.dll+0x10e781>)
# 6 USER32.dll!mouse_event +0x1f9 (0x00007ff90532df1a <USER32.dll+0xdf1a>)
# 7 SDL2.dll!? +0x0 (0x0000000073eae91a <SDL2.dll+0x10e91a>)
# 8 SDL2.dll!? +0x0 (0x0000000073eb1d9d <SDL2.dll+0x111d9d>)
# 9 SDL2.dll!? +0x0 (0x0000000073e760ce <SDL2.dll+0xd60ce>)
#10 SDL2.dll!? +0x0 (0x0000000073da1547 <SDL2.dll+0x1547>)
#11 main
Note: #0:00:02.451 in thread 3800
Error #3: UNINITIALIZED READ: reading 0x000000000023f734-0x000000000023f738 4 byte(s) within 0x000000000023f730-0x000000000023f738
# 0 system call NtUserCreateWindowEx parameter value #14
# 1 USER32.dll!IsCharAlphaW +0x20e (0x00007ff905329d4f <USER32.dll+0x9d4f>)
# 2 USER32.dll!IsCharAlphaW +0x436 (0x00007ff905329f77 <USER32.dll+0x9f77>)
# 3 USER32.dll!CreateWindowExW +0x7d (0x00007ff90532a03e <USER32.dll+0xa03e>)
# 4 SDL2.dll!? +0x0 (0x0000000073eaffe9 <SDL2.dll+0x10ffe9>)
# 5 SDL2.dll!? +0x0 (0x0000000073eb08fc <SDL2.dll+0x1108fc>)
# 6 SDL2.dll!? +0x0 (0x0000000073e740b7 <SDL2.dll+0xd40b7>)
# 7 SDL2.dll!? +0x0 (0x0000000073e755df <SDL2.dll+0xd55df>)
# 8 main
Note: #0:00:02.839 in thread 3800
Error #4: UNINITIALIZED READ: reading 0x000000000023f7d4-0x000000000023f7d8 4 byte(s) within 0x000000000023f7d0-0x000000000023f7d8
# 0 system call NtUserCreateWindowEx parameter value #14
# 1 USER32.dll!IsCharAlphaW +0x20e (0x00007ff905329d4f <USER32.dll+0x9d4f>)
# 2 USER32.dll!IsCharAlphaW +0x436 (0x00007ff905329f77 <USER32.dll+0x9f77>)
# 3 USER32.dll!CreateWindowExW +0x7d (0x00007ff90532a03e <USER32.dll+0xa03e>)
# 4 SDL2.dll!? +0x0 (0x0000000073eb2b9c <SDL2.dll+0x112b9c>)
# 5 SDL2.dll!? +0x0 (0x0000000073e7584d <SDL2.dll+0xd584d>)
# 6 main
Note: #0:00:03.636 in thread 3800
Error #5: UNINITIALIZED READ: reading 0x000000000023f494-0x000000000023f498 4 byte(s) within 0x000000000023f490-0x000000000023f498
# 0 system call NtUserCreateWindowEx parameter value #14
# 1 USER32.dll!IsCharAlphaW +0x20e (0x00007ff905329d4f <USER32.dll+0x9d4f>)
# 2 USER32.dll!IsCharAlphaW +0x436 (0x00007ff905329f77 <USER32.dll+0x9f77>)
# 3 USER32.dll!CreateWindowExW +0x7d (0x00007ff90532a03e <USER32.dll+0xa03e>)
# 4 SDL2.dll!? +0x0 (0x0000000073eaf7fa <SDL2.dll+0x10f7fa>)
# 5 SDL2.dll!? +0x0 (0x0000000073eafaed <SDL2.dll+0x10faed>)
# 6 SDL2.dll!? +0x0 (0x0000000073eb099d <SDL2.dll+0x11099d>)
# 7 SDL2.dll!? +0x0 (0x0000000073eb2c5b <SDL2.dll+0x112c5b>)
# 8 SDL2.dll!? +0x0 (0x0000000073e7584d <SDL2.dll+0xd584d>)
# 9 main
Note: #0:00:03.890 in thread 3800
Error #6: UNINITIALIZED READ: reading 0x000000000023f494-0x000000000023f498 4 byte(s) within 0x000000000023f490-0x000000000023f498
# 0 system call NtUserCreateWindowEx parameter value #14
# 1 USER32.dll!IsCharAlphaW +0x20e (0x00007ff905329d4f <USER32.dll+0x9d4f>)
# 2 USER32.dll!IsCharAlphaW +0x436 (0x00007ff905329f77 <USER32.dll+0x9f77>)
# 3 USER32.dll!CreateWindowExW +0x7d (0x00007ff90532a03e <USER32.dll+0xa03e>)
# 4 SDL2.dll!? +0x0 (0x0000000073eaf7fa <SDL2.dll+0x10f7fa>)
# 5 SDL2.dll!? +0x0 (0x0000000073eafe55 <SDL2.dll+0x10fe55>)
# 6 SDL2.dll!? +0x0 (0x0000000073eb099d <SDL2.dll+0x11099d>)
# 7 SDL2.dll!? +0x0 (0x0000000073eb2c5b <SDL2.dll+0x112c5b>)
# 8 SDL2.dll!? +0x0 (0x0000000073e7584d <SDL2.dll+0xd584d>)
# 9 main
Note: #0:00:03.947 in thread 3800
Error #7: UNINITIALIZED READ: reading 0x000000000023f6b0-0x000000000023f6b8 8 byte(s) within 0x000000000023f6a8-0x000000000023f6b8
# 0 system call NtUserTrackMouseEvent TRACKMOUSEEVENT post-dwFlags
# 1 SDL2.dll!? +0x0 (0x0000000073eb3bf2 <SDL2.dll+0x113bf2>)
# 2 SDL2.dll!? +0x0 (0x0000000073dcc1b7 <SDL2.dll+0x2c1b7>)
# 3 SDL2.dll!? +0x0 (0x0000000073dca237 <SDL2.dll+0x2a237>)
# 4 SDL2.dll!? +0x0 (0x0000000073dca7a8 <SDL2.dll+0x2a7a8>)
# 5 SDL2.dll!? +0x0 (0x0000000073ea90d8 <SDL2.dll+0x1090d8>)
# 6 USER32.dll!DispatchMessageW +0x15c (0x00007ff9053224fd <USER32.dll+0x24fd>)
# 7 USER32.dll!DispatchMessageW +0xc2 (0x00007ff905322463 <USER32.dll+0x2463>)
# 8 USER32.dll!CallWindowProcW +0x9a (0x00007ff905323ccb <USER32.dll+0x3ccb>)
# 9 OPENGL32.dll!glDebugEntry +0x1146b (0x00007ff8fa3928fc <OPENGL32.dll+0x428fc>)
#10 USER32.dll!DispatchMessageW +0x15c (0x00007ff9053224fd <USER32.dll+0x24fd>)
#11 USER32.dll!DispatchMessageW +0xc2 (0x00007ff905322463 <USER32.dll+0x2463>)
#12 USER32.dll!MsgWaitForMultipleObjects +0x141 (0x00007ff905323902 <USER32.dll+0x3902>)
#13 USER32.dll!MsgWaitForMultipleObjects +0x20d (0x00007ff9053239ce <USER32.dll+0x39ce>)
#14 USER32.dll!GetWindowLongW +0x10f (0x00007ff905326980 <USER32.dll+0x6980>)
#15 SDL2.dll!? +0x0 (0x0000000073e73b3c <SDL2.dll+0xd3b3c>)
#16 SDL2.dll!? +0x0 (0x0000000073e75896 <SDL2.dll+0xd5896>)
#17 main
Note: #0:00:06.599 in thread 3800
Error #8: LEAK 88 direct bytes 0x0000000002679b00-0x0000000002679b58 + 0 indirect bytes
# 0 replace_RtlAllocateHeap [d:\drmemory_package\common\alloc_replace.c:3771]
# 1 IMM32.dll!CtfImmGetTMAEFlags +0x1b4 (0x00007ff905013b35 <IMM32.dll+0x3b35>)
# 2 IMM32.dll!ImmGetContext +0x105 (0x00007ff905012396 <IMM32.dll+0x2396>)
# 3 SDL2.dll!? +0x0 (0x0000000073eaae90 <SDL2.dll+0x10ae90>)
# 4 SDL2.dll!? +0x0 (0x0000000073eab89b <SDL2.dll+0x10b89b>)
# 5 SDL2.dll!? +0x0 (0x0000000073dc8961 <SDL2.dll+0x28961>)
# 6 SDL2.dll!? +0x0 (0x0000000073ea90a4 <SDL2.dll+0x1090a4>)
# 7 USER32.dll!DispatchMessageW +0x15c (0x00007ff9053224fd <USER32.dll+0x24fd>)
# 8 USER32.dll!DispatchMessageW +0xc2 (0x00007ff905322463 <USER32.dll+0x2463>)
# 9 USER32.dll!CallWindowProcW +0x9a (0x00007ff905323ccb <USER32.dll+0x3ccb>)
#10 OPENGL32.dll!glDebugEntry +0x1146b (0x00007ff8fa3928fc <OPENGL32.dll+0x428fc>)
#11 USER32.dll!DispatchMessageW +0x15c (0x00007ff9053224fd <USER32.dll+0x24fd>)
Error #9: POSSIBLE LEAK 26 direct bytes 0x00000000029c01c0-0x00000000029c01da + 0 indirect bytes
# 0 replace_malloc [d:\drmemory_package\common\alloc_replace.c:2577]
# 1 msvcrt.dll!malloc_crt
# 2 msvcrt.dll!_setargv
# 3 msvcrt.dll!_getmainargs
# 4 pre_cpp_init
# 5 msvcrt.dll!initterm
# 6 __tmainCRTStartup
# 7 .l_start
# 8 KERNEL32.dll!BaseThreadInitThunk +0x21 (0x00007ff902e81412 <KERNEL32.dll+0x1412>)
===========================================================================
FINAL SUMMARY:
DUPLICATE ERROR COUNTS:
Error # 1: 2
SUPPRESSIONS USED:
ERRORS FOUND:
1 unique, 2 total unaddressable access(es)
6 unique, 6 total uninitialized access(es)
0 unique, 0 total invalid heap argument(s)
0 unique, 0 total GDI usage error(s)
0 unique, 0 total handle leak(s)
0 unique, 0 total warning(s)
1 unique, 1 total, 88 byte(s) of leak(s)
1 unique, 1 total, 26 byte(s) of possible leak(s)
ERRORS IGNORED:
91 potential error(s) (suspected false positives)
(details: C:\Users\Kabir\AppData\Roaming\Dr. Memory\DrMemory-main.exe.4868.000\potential_errors.txt)
10 potential leak(s) (suspected false positives)
(details: C:\Users\Kabir\AppData\Roaming\Dr. Memory\DrMemory-main.exe.4868.000\potential_errors.txt)
112 unique, 248 total, 34288 byte(s) of still-reachable allocation(s)
(re-run with "-show_reachable" for details)
Details: C:\Users\Kabir\AppData\Roaming\Dr. Memory\DrMemory-main.exe.4868.000\results.txt

ALSA lib pcm_hw.c:1829:(_snd_pcm_hw_open) Invalid value for card

I'm currently trying to use the ALSA lib to emit sounds. However, I'm getting this following error:
Setting random seed to 345.
Adding stimulus TestBeep...
ALSA lib pcm_hw.c:1829:(_snd_pcm_hw_open) Invalid value for card
Process Process-1:
Traceback (most recent call last):
File "/usr/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap
self.run()
File "/usr/lib/python3.8/multiprocessing/process.py", line 108, in run
self._target(*self._args, **self._kwargs)
File "../soundstimulus.py", line 36, in run_playback_process
raise e
File "../soundstimulus.py", line 32, in run_playback_process
playback_system = ALSAPlaybackSystem(device_name, config, file_dir, control_pipe, log_directory)
File "../alsainterface.py", line 214, in __init__
self.adevice = alsaaudio.PCM(device=device)
alsaaudio.ALSAAudioError: No such device [hw:CARD=SoundCard,DEV=0]
I think I do have a sound card as seen in the following:
$ cat /proc/asound/card0/pcm0p/info
card: 0
device: 0
subdevice: 0
stream: PLAYBACK
id: ALC269VC Analog
name: ALC269VC Analog
subname: subdevice #0
class: 0
subclass: 0
subdevices_count: 1
subdevices_avail: 1
So what does it mean that there is an invalid value for the card? Is there a way I can edit it so that the value is valid?
I'm not sure if the following is relevant, but a lot of the stackOverflow posts suggested OPs run aplay -l.
My result is
aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC269VC Analog [ALC269VC Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 3: HDMI 0 [HDMI 0]
Subdevices: 1/1
Subdevice #0: subdevice #0

no audio recorded from alsa loopback device

I've been trying to get an alsa loopback device working (to test an application that reads audio) following the instructions here:
https://sysplay.in/blog/linux/2019/06/playing-with-alsa-loopback-devices/
The device is enabled using:
modeprobe snd-aloop
As can be seen from:
>aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC269VB Analog [ALC269VB Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 3: HDMI 0 [HDMI 0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 7: HDMI 1 [HDMI 1]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: Loopback [Loopback], device 0: Loopback PCM [Loopback PCM]
Subdevices: 8/8
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3
Subdevice #4: subdevice #4
Subdevice #5: subdevice #5
Subdevice #6: subdevice #6
Subdevice #7: subdevice #7
card 1: Loopback [Loopback], device 1: Loopback PCM [Loopback PCM]
Subdevices: 7/8
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3
Subdevice #4: subdevice #4
Subdevice #5: subdevice #5
Subdevice #6: subdevice #6
Subdevice #7: subdevice #7
I am supposed to be able to play and record audio using:
aplay -D hw:1,0 foo.wav
&
arecord -D hw:1,0 bar.wav
However the audio recorded is completely silent.
This is more visible when I use sox:
AUDIODEV=hw:1,0 play -V foo.wav
AUDIODEV=hw:1,0 rec -V -c 1 -r 8000 bar.wav
As it provides a convenient ascii-art volume indicator:
In:100% 00:10:00.00 [00:00:00.00] Out:4.80M [ =|= ] Clip:0
The loopback device actually creates pairs of devices.
One device is the read end and a separate device is the write end.
What you actually need is:
aplay -D hw:1,0 foo.wav
&
arecord -D hw:1,1 bar.wav
or using sox:
AUDIODEV=hw:1,0 play -V foo.wav
AUDIODEV=hw:1,1 rec -V -c 1 -r 8000 bar.wav
I discovered this by accident when I copied an .asoundrc configuration that worked as below. The asound configuration is not required however:
pcm.loopin {
type plug
slave.pcm "hw:1,0,0"
}
pcm.loopout {
type plug
slave.pcm "hw:1,1,0"
}
See also https://stackoverflow.com/a/58998959/1569204

Phidget API 22 : libusb deadlock

I currently have a thread of the Phidget API which deadlocks; here is a stack trace of my main thread:
1 __lll_lock_wait 0x7ffff5b3173c
2 __lll_lock_elision 0x7ffff5b343c7
3 mos_mutex_lock mos_lock-pthread.c 288 0x7fffd64b50ee
4 StartCentralThread phidget22.c 205 0x7fffd64d45dd
5 registerChannel phidget.c 1348 0x7fffd64d2432
6 Phidget_open_internal phidget.c 1416 0x7fffd64d2432
7 list_phidgets phidgets_parameter.hpp 1076 0x7fffd6139f9b
/* list_phidgets is in my own code and calls Phidget_open(...) */
and an offending internal libphidget thread :
1 poll 0x7ffff12ba97b
2 ?? 0x7ffff54cb6ec
3 libusb_handle_events_timeout_completed 0x7ffff54cc76a
4 libusb_handle_events_completed 0x7ffff54cc8b0
5 ?? 0x7ffff54cd1d9
6 libusb_control_transfer 0x7ffff54cd539
7 libusb_get_string_descriptor_ascii 0x7ffff54ca47e
8 PhidgetUSBGetString usblinux.c 253 0x7fffd64d5319
9 scanVintDevices vint.c 218 0x7fffd64e5a2e
10 PhidgetManager_poll manager.c 380 0x7fffd64bc87c
11 CentralThreadFunction phidget22.c 371 0x7fffd64d4415
12 start_thread 0x7ffff5b2808c
13 clone 0x7ffff12c4e7f
Phidget_open called from my main thread, opens a mutex also opened in CentralThreadFunction, and libusb_get_string_descriptor_ascii does not seem to return which deadlocks my whole app. What can I do ?

PC=0x00000000, corrupt stack in gdb, but FreeRTOS thread is still running fine on STM32

I'm developing a multi threaded application with FreeRTOS on a STM32.
When I try to debug it with OpenOCD and gdb, I can do so with all threads but my main loop.
>>> info threads
Id Target Id Frame
6 Thread 536892936 (cli) vTaskSuspend (xTaskToSuspend=<optimized out>) at /home/user1273684/dev/firmware/module/FreeRTOS/Source/tasks.c:1620
5 Thread 536888728 (wifi_loop) vTaskSuspend (xTaskToSuspend=<optimized out>) at /home/user1273684/dev/firmware/module/FreeRTOS/Source/tasks.c:1620
4 Thread 536884824 (Tmr Svc) xTaskResumeAll () at /home/user1273684/dev/firmware/module/FreeRTOS/Source/tasks.c:2126
3 Thread 536905240 (main_loop) 0x00000000 in ?? ()
2 Thread 536879832 (wifi_watchdog) xTaskResumeAll () at /home/user1273684/dev/firmware/module/FreeRTOS/Source/tasks.c:2126
* 1 Thread 536882960 (IDLE : : Running) prvIdleTask (pvParameters=<optimized out>) at /home/user1273684/dev/firmware/module/FreeRTOS/Source/tasks.c:3145
>>> thread 3
[Switching to thread 3 (Thread 536905240)]
#0 0x00000000 in ?? ()
>>> bt
#0 0x00000000 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
I tried increasing the stack size (vTaskList() says there is plenty of space left, configCHECK_FOR_STACK_OVERFLOW is set to 2 and vApplicationStackOverflowHook() is never triggered) but without any change.
2017-06-20 10:34:34,217 - INFO # cli R 1 922 5
2017-06-20 10:34:34,217 - INFO # IDLE R 0 235 2
2017-06-20 10:34:34,218 - INFO # wifi_watchdog B 1 231 8
2017-06-20 10:34:34,218 - INFO # main_loop B 2 2879 6
2017-06-20 10:34:34,218 - INFO # Tmr Svc S 4 320 3
2017-06-20 10:34:34,218 - INFO # wifi_loop S 3 627 4
What is going on here?

Resources