Hello,
I am trying to build a Zephyr application for the Thingy91 which uses the I2S module to receive audio data from an external microphone and sends this data via BLE to a connected device.
For the initialization of the I2S module I used the code listed below:
ISR_DIRECT_DECLARE(i2s_isr_handler) { nrfx_i2s_irq_handler(); ISR_DIRECT_PM(); return 1; } static bool init_nrfx_i2s(void) { IRQ_DIRECT_CONNECT(I2S_IRQn, 0, i2s_isr_handler, 0); nrfx_i2s_config_t i2s_config = { .sck_pin = I2S_BCLK_PIN, .lrck_pin = I2S_LRCLK_PIN, .mck_pin = NRFX_I2S_PIN_NOT_USED, .sdout_pin = NRFX_I2S_PIN_NOT_USED, .sdin_pin = I2S_SDIN_PIN, .irq_priority = NRFX_I2S_CONFIG_IRQ_PRIORITY, .mode = NRF_I2S_MODE_MASTER, .format = NRF_I2S_FORMAT_I2S, .alignment = NRF_I2S_ALIGN_RIGHT, .sample_width = NRF_I2S_SWIDTH_16BIT, .channels = NRF_I2S_CHANNELS_RIGHT, .mck_setup = NRF_I2S_MCK_32MDIV16, .ratio = NRF_I2S_RATIO_128X }; return nrfx_i2s_init(&i2s_config, i2s_event_handler) == NRFX_SUCCESS; }
However, when the function nrfx_i2s_init is called, Zephyr crashes with the following bus fault:
***** Booting Zephyr OS build v2.0.99-ncs1 ***** [00:00:00.085,144] <inf> main: I2S/BLE sample started. [00:00:00.212,677] <inf> flac: FLAC module initialized. [00:00:00.339,416] <err> os: ***** BUS FAULT ***** [00:00:00.445,831] <err> os: Precise data bus error [00:00:00.572,662] <err> os: BFAR Address: 0x40028504 [00:00:00.699,676] <err> os: r0/a1: 0x10000000 r1/a2: 0x00000000 r2/a3: 0x4 [00:00:00.869,812] <err> os: r3/a4: 0x40028000 r12/ip: 0x00000001 r14/lr: 0x0 [00:00:01.039,947] <err> os: xpsr: 0x21000000 [00:00:01.146,057] <err> os: Faulting instruction address (r15/pc): 0x000166ec [00:00:01.295,227] <err> os: >>> ZEPHYR FATAL ERROR 0: CPU exception [00:00:01.443,511] <err> os: Current thread: 0x200208e4 (unknown) [00:00:01.591,552] <err> os: Halting system
Debugging the function reveals that the application crashes as soon as it is trying to set the I2S mode.
I am using the SDK version 1.1.0 and Zephyr 2.0.99.
Could there be an issue with the device tree configuration? I have not seen an I2S module declaration anywhere.
Kind regards
Nils