93696
SPRESENSEのArduino互換版で、なぜかSDをメインボードに書き込むとエラーがでてストップしてしまいます。  
SDなしの状態で動かすとうまく機能するのですが、なぜそのような状態になるのかわかりません。

ご助言を頂けないでしょうか。よろしくお願いいたします。

以下、実行結果

```

    initialization Audio Library
    Init Recorder!
    Rec!
    Attention: module[1][0] attention id[2]/code[3] (dma_controller/audio_dma_drv.cpp L913)
    up_assert: Assertion failed at file:objects/front_end/front_end_obj.cpp line: 112 task: front_end
    up_registerdump: R0: 00000Attention: module[1][0] attention id[2]/code[7] (dma_controller/audio_dma_drv.cpp L789)
    up_assert: Assertion failed at file:objects/front_end/front_end_obj.cpp line: 82 task: capture0
    up_registerdump: R0: 00000001 0d0505f4 000000e0 0d050d90 0d0505f4 0d050d70 0d06472c 0d04ea40
    up_registerdump: R8: 0d037740 00000052 00000000 0d063e70 00000000 0d064680 0d025a35 0d026194
    up_registerdump: xPSR: 61000000 BASEPRI: 000000e0 CONTROL: 00000004
    up_registerdump: EXC_RETURN: ffffffe9
    up_dumpstate: sp:     0d0646b8
    up_dumpstate: IRQ stack:
    up_dumpstate:   base: 0d04ea40
    up_dumpstate:   size: 00000800
    up_dumpstate:   used: 000000d8
    up_dumpstate: User stack:
    up_dumpstate:   base: 0d064038
    up_dumpstate:   size: 00000800
    up_dumpstate:   used: 00000364
    up_stackdump: 0d0646a0: 00000000 0d0646b8 0d050d70 0d064838 0d04ea40 0d025c03 00000052 0d063fc8
    up_stackdump: 0d0646c0: 0d0646f8 00000000 000fd700 0d06472c 00000006 00000000 00000000 00000000
    up_stackdump: 0d0646e0: 00000000 0d017779 00008000 0d00c025 0d06472c 000fd700 00006a00 00008000
    up_stackdump: 0d064700: 0d063be0 0d063bf0 0d00bfa9 0d00376b 0d064764 0d02021f 0d064700 00000000
    up_stackdump: 0d064720: 00000300 00000000 0d037000 00000300 00000000 00000300 01000000 0d08c900
    up_stackdump: 0d064740: 0d08c960 0d08cdec 0d0647f0 0d004b59 6c6c6f72 612f7265 6f696475 61000000
    up_stackdump: 0d064760: 0d0d7010 00700300 00000000 0d080000 0d063be0 0d08c960 0d063be0 0d0647f0
    up_stackdump: 0d064780: 00000006 0d004bdd 0d037048 00000315 000fe8c8 0d0043c7 00000000 0d00505b
    up_stackdump: 0d0647a0: 00000000 0d003971 00000000 00000000 00000000 00000000 00000000 00000000
    up_stackdump: 0d0647c0: 00000000 0d020057 00000000 000fd404 00000000 0d020077 000fe8c8 0d0647f0
    up_stackdump: 0d0647e0: 0d063be0 00000006 00000000 0d0035c7 72987a3a 2d0f0000 89e66001 405b714e
    up_stackdump: 0d064800: 00000000 0d063be0 00000000 00000000 00000000 0d004063 000fd400 000fe8c8
    up_stackdump: 0d064820: 00000000 0d0040b1 0d00408f 0d0177d9 0d0177d1 00000000 00000110 80000820
    up_taskdump: Idle Task: PID=0 Stack Used=460 of 1000
    up_registerdump: R0: 00000000 0d0500e8 0d055744 00000000 00000000 0d050064 0d050dc2 00000000
    up_registerdump: R8: 0d0501bc 4b0a18b7 5934c0a4 0e87c149 00000000 0d051840 0d01f203 0d023f5a
    up_registerdump: xPSR: 41000000 BASEPRI: 000000e0 CONTROL: 00000004
    up_registerdump: EXC_RETURN: ffffffe9
    up_taskdump: hpwork: PID=1 Stack Used=604 of 2016
    up_registerdump: R0: 00000002 0d0523c4 0d063ef4 0d0523c4 0d052340 00000080 0d050dd8 00000000
    up_registerdump: R8: 0d050de0 00000000 00000000 00000000 01ff0000 0d052fc0 0d020057 0d0260f0
    up_registerdump: xPSR: 01000000 BASEPRI: 00000080 CONTROL: 00000004
    up_registerdump: EXC_RETURN: ffffffe9
    up_taskdump: lpwork: PID=2 Stack Used=268 of 2016
    up_registerdump: R0: 00000002 0d053094 0d053d64 0d053094 0d053010 00000080 0d050de4 00000000
    up_registerdump: R8: 0d050dec 00000000 00000000 00000000 00000000 0d053c90 0d020057 0d0260f0
    up_registerdump: xPSR: 01000000 BASEPRI: 00000080 CONTROL: 00000004
    up_registerdump: EXC_RETURN: ffffffe9
    up_taskdump: lpwork: PID=3 Stack Used=268 of 2016
    up_registerdump: R0: 00000002 0d053d64 0d054a34 0d053d64 0d053ce0 00000080 0d050de4 00000000
    up_registerdump: R8: 0d050dec 00000000 00000000 00000000 00000000 0d054960 0d020057 0d0260f0
    up_registerdump: xPSR: 01000000 BASEPRI: 00000080 CONTROL: 00000004
    up_registerdump: EXC_RETURN: ffffffe9
    up_taskdump: lpwork: PID=4 Stack Used=268 of 2016
    up_registerdump: R0: 00000002 0d054a34 0d0500e8 0d054a34 0d0549b0 00000080 0d050de4 00000000
    up_registerdump: R8: 0d050dec 00000000 00000000 00000000 00000000 0d055630 0d020057 0d0260f0
    up_registerdump: xPSR: 01000000 BASEPRI: 00000080 CONTROL: 00000004
    up_registerdump: EXC_RETURN: ffffffe9
    up_taskdump: cxd56_pm_task: PID=6 Stack Used=400 of 1000
    up_registerdump: R0: 00000002 0d056794 0d0500e8 0d056794 0d057080 0d056f4c 0d056710 00000000
    up_registerdump: R8: 0d057084 0d050d90 00000000 00000000 00000064 0d056f28 0d01f691 0d0260f0
    up_registerdump: xPSR: 01000000 BASEPRI: 00000080 CONTROL: 00000004
    up_registerdump: EXC_RETURN: ffffffe9
    up_taskdump: gnss_receiver: PID=7 Stack Used=284 of 1000
    up_registerdump: R0: 00000002 0d05acf4 0d055744 0d05acf4 0d05ac70 000000e0 0d05b510 0d05abc8
    up_registerdump: R8: 00000000 00000000 00000000 00000000 00000000 0d05b4e0 0d020057 0d0260f0
    up_registerdump: xPSR: 01000000 BASEPRI: 00000080 CONTROL: 00000004
    up_registerdump: EXC_RETURN: ffffffe9
    up_taskdump: init: PID=8 Stack Used=636 of 8176
    up_registerdump: R0: 00000000 00000000 00028000 00000000 0d03dd5c 0d03dd5c 0d000000 0d03dd50
    up_registerdump: R8: 00000000 00000000 00000000 00000000 00000058 0d05dc70 0d000fc5 0d00119c
    up_registerdump: xPSR: 81000000 BASEPRI: 000000e0 CONTROL: 00000004
    up_registerdump: EXC_RETURN: ffffffe9
    up_taskdump: audio_manager: PID=9 Stack Used=700 of 2048
    up_registerdump: R0: 00000002 0d055764 0d05b874 0d055764 0d0556e0 000000e0 ffffffff 00000127
    up_registerdump: R8: 0d05605c 000fd044 00418937 00000000 00000028 0d056008 0d020057 0d0260f0
    up_registerdump: xPSR: 01000000 BASEPRI: 00000080 CONTROL: 00000004
    up_registerdump: EXC_RETURN: ffffffe9
    up_taskdump: media_player0: PID=10 Stack Used=332 of 3072
    up_registerdump: R0: 00000002 0d0561a4 0d05b874 0d0561a4 0d056120 000000e0 00000000 0d05e960
    up_registerdump: R8: 00000000 000fd144 00000000 00000000 00000000 0d05e8e0 0d020057 0d0260f0
    up_registerdump: xPSR: 01000000 BASEPRI: 00000080 CONTROL: 00000004
    up_registerdump: EXC_RETURN: ffffffe9
    up_taskdump: media_player1: PID=11 Stack Used=332 of 3072
    up_registerdump: R0: 00000002 0d05ec94 0d05b874 0d05ec94 0d05ec10 000000e0 00000000 0d05f9c0
    up_registerdump: R8: 00000000 000fd204 00000000 00000000 00000000 0d05f940 0d020057 0d0260f0
    up_registerdump: xPSR: 01000000 BASEPRI: 00000080 CONTROL: 00000004
    up_registerdump: EXC_RETURN: ffffffe9
    up_taskdump: out_mixer: PID=12 Stack Used=324 of 3072
    up_registerdump: R0: 00000002 0d05fcf4 0d05b874 0d05fcf4 0d05fc70 000000e0 00000000 0d060a20
    up_registerdump: R8: 00000000 000fd244 00000000 00000000 00000000 0d0609a8 0d020057 0d0260f0
    up_registerdump: xPSR: 01000000 BASEPRI: 00000080 CONTROL: 00000004
    up_registerdump: EXC_RETURN: ffffffe9
    up_taskdump: renderer0: PID=13 Stack Used=324 of 2048
    up_registerdump: R0: 00000002 0d061264 0d05b874 0d061264 0d0611e0 000000e0 ffffffff 00000127
    up_registerdump: R8: 0d061b6c 000fd284 00418937 00000000 00000000 0d061b18 0d020057 0d0260f0
    up_registerdump: xPSR: 01000000 BASEPRI: 00000080 CONTROL: 00000004
    up_registerdump: EXC_RETURN: ffffffe9
    up_taskdump: renderer1: PID=14 Stack Used=324 of 2048
    up_registerdump: R0: 00000002 0d061c14 0d05b874 0d061c14 0d061b90 000000e0 ffffffff 00000127
    up_registerdump: R8: 0d06251c 000fd304 00418937 00000000 00000000 0d0624c8 0d020057 0d0260f0
    up_registerdump: xPSR: 01000000 BASEPRI: 00000080 CONTROL: 00000004
    up_registerdump: EXC_RETURN: ffffffe9
    up_taskdump: front_end: PID=15 Stack Used=844 of 2048
    up_registerdump: R0: 00000030 041ac000 041ac018 f8000000 0d046188 00000030 00000050 00000008
    up_registerdump: R8: 00000001 0d062d68 00000003 000000f3 00000000 0d062c90 0d016ac9 0d0149a2
    up_registerdump: xPSR: 81000000 BASEPRI: 000000e0 CONTROL: 00000004
    up_registerdump: EXC_RETURN: ffffffe9
    up_taskdump: media_recorder: PID=21 Stack Used=328 of 2048
    up_registerdump: R0: 00000002 0d062f94 0d055764 0d062f94 0d062f10 000000e0 ffffffff 00000127
    up_registerdump: R8: 0d0638c4 000fd384 00418937 00000000 00000058 0d063870 0d020057 0d0260f0
    up_registerdump: xPSR: 01000000 BASEPRI: 00000080 CONTROL: 00000004
    up_registerdump: EXC_RETURN: ffffffe9
    up_taskdump: capture0: PID=22 Stack Used=868 of 2048
    up_registerdump: R0: 0000006e 041ac000 041ac018 0000013e 0d046188 0000006e 00000000 00000002
    up_registerdump: R8: 0d037048 00000315 0000006e 0d064718 00000000 0d064648 0d016ac9 0d0149a4
    up_registerdump: xPSR: 81000000 BASEPRI: 000000e0 CONTROL: 00000004
    up_registerdump: EXC_RETURN: ffffffe9
    
```
CC BY-SA 4.0
2023-02-03T07:15:30.880
93695
2023-02-03T08:15:52.787
49229
question
c++ spresense arduino
SPRESENSE Arduino版で pcm_captureが機能しない
起動時にバックグラウンドでSDカードのマウント処理が走っているからではないでしょうか。

setup()の先頭にSD.begin()を入れると解決しそうな気がします。

```

    #include <SDHCI.h>
    SDClass SD; 
    
    void setup() {
      SD.begin();
    
      theAudio = AudioClass::getInstance();
    
    
```

SD.begin()の代わりに sleep() とかでも良さそう。

```

    void setup() {
      sleep(2);
    
      theAudio = AudioClass::getInstance();
    
    
```
CC BY-SA 4.0
2023-02-03T08:15:52.787
93696
2023-02-03T08:15:52.787
31378
93695
answer