-
Notifications
You must be signed in to change notification settings - Fork 3
Description
Hi there. For me on an NRF5340DK, I've found that but the time the program reaches the continuous for loop the transmission is failing with code -EIO (5) indicating that the transmission is not in a ready or running state. I think what's happening here is that the i2s transmission starts and drains the buffer completely before the next i2s_write_buffer can fill the tx buffer. I did try turning off printing in case this is causing a delay but this didn't change anything (no i2s seen on signal analyzer).
The only thing I've found, which admittedly is quite hacky is including an i2s_write just before the first i2s_buffer_write. I believe this function can complete slightly quicker and fills the buffer enough to allow for continuous transmission. Is there something I'm missing here?
/* Start the transmission of data */
ret = i2s_trigger(i2s_dev, I2S_DIR_TX, I2S_TRIGGER_START);
if (ret < 0) {
printk("Failed to start the transmission: %d\n", ret);
return;
}
ret = i2s_write(i2s_dev, &mem_blocks[0], BLOCK_SIZE);
if (ret < 0) {
printk("(non-buffer) write failed with: %d\n", ret);
return;
}
/* Write Data */
ret = i2s_buf_write(i2s_dev, mem_blocks, BLOCK_SIZE);
if (ret < 0) {
printk("Error: first i2s_write failed with %d\n", ret);
return;
}