Speaker in micropython app



  • Hi All

    I' trying to use speaker in micropython app based on latest 1.13.4 image.
    When I call speaker.playTone or speaker.playWAV device reboot is triggered with following stacktrace:
    E (43260) I2S: Error malloc dma buffer
    /home/m5/M5-Workspace/esp-idf-for-m5/components/freertos/queue.c:1802 (vQueueDelete)- assert failed!
    abort() was called at PC 0x400985ef on core 1

    ELF file SHA256: 0000000000000000

    Backtrace: 0x4009270f:0x3ffda9c0 0x40092b01:0x3ffda9e0 0x400985ef:0x3ffdaa00 0x4017be4f:0x3ffdaa20 0x4017bf57:0x3ffdaa40 0x4017cb92:0x3ffdaa80 0x4017daf3:0x3ffdaae0 0x400fea8d:0x3ffdab20 0x400febb3:0x3ffdabb0 0x400e9805:0x3ffdabe0 0x400e01e9:0x3ffdac00 0x400ee8c5:0x3ffdac20 0x400e464e:0x3ffdacc0 0x400e01e9:0x3ffdacf0 0x400e033a:0x3ffdad10 0x400ee983:0x3ffdad30 0x400e464e:0x3ffdadd0 0x400e01e9:0x3ffdae00 0x400e0212:0x3ffdae20 0x40177c8c:0x3ffdae40 0x40177f2d:0x3ffdaed0 0x40177f97:0x3ffdaef0 0x400f80a7:0x3ffdaf10 0x40098685:0x3ffdaf50

    Rebooting...
    ets Jul 29 2019 12:21:46

    rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
    configsip: 0, SPIWP:0xee
    clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
    mode:DIO, clock div:1
    load:0x3fff0018,len:4
    load:0x3fff001c,len:5228
    load:0x40078000,len:13424
    load:0x40080400,len:3568
    entry 0x4008063c

    When I created simple test app which only calls speaker it works fine, but when I add speaker call to some thread or method called after button is pressed it crashes i.e.:

    btnA.wasPressed(onBtnPressed)

    def onBtnPressed():
    speaker.playTone(523, 2, volume=2)

    Thanks in advance