Post Go back to editing

The 8 A2B channels are not available in Baremetal Framework for SC589

Category: Software
Product Number: ADSZ-SC589-MINI
Software Version: Cross Core Embedded Studio 2.9.3

Hi everyone,

I hope someone is able to help me since I've run out of ideas.

I'm trying to acquire 8 audio channels from A2B bus using ADSZ-SC589-MINI. I'm using the Baremetal Framework v.2.1.2 as it is (with just the basic additions to have a custom A2B configuration as explained in https://wiki.analog.com/resources/tools-software/sharc-audio-module/baremetal/custom-a2b-topology. Then, I added a number of files in order to save audio samples in the SD card. I do not rely on any filesystem and I write the audio samples directly in binary form in the SD card. I have then a Python script running on the PC to extract binary data from the SD card and convert them back to float. 

I'm sure about the writing process and I know that the SD card thing works fine. In order to save audio samples I save directly the content of the matrix a2b_audiochannels_in (defined in core1/src/audio_frameworks/audio_framework_8ch_sam_and_audioproj_fin_core1.c) that is accessed through the pointers audiochannel_a2b_0_left_inaudiochannel_a2b_0_right_in, ...., audiochannel_a2b_3_left_inaudiochannel_a2b_3_right_in. Therefore, I wrote a little portion of code inside the function processaudio_background_loop{ } of file core1/src/callback_audio_processing.cpp that I report here

void processaudio_background_loop(void) {
float buffer_sd[8 * 32];
float* ptr_buf;
uint32_t result = 0;

if (sd_block_number == 0){ // first two blocks to test
for (int i = 0; i < AUDIO_BLOCK_SIZE; i++) {
buffer_sd[0 + 8*i] = 100.0f;
buffer_sd[1 + 8*i] = 101.0f;
buffer_sd[2 + 8*i] = 102.0f;
buffer_sd[3 + 8*i] = 103.5f;
buffer_sd[4 + 8*i] = 104.0f;
buffer_sd[5 + 8*i] = 105.0f;
buffer_sd[6 + 8*i] = 106.0f;
buffer_sd[7 + 8*i] = 107.0f;
}
ptr_buf = buffer_sd; // 1024 bytes
result = writeonSD(ptr_buf, sd_block_number, 8*32*sizeof(float)); // a float is 4 bytes
log_event(EVENT_INFO, "Written the block test (first two in SD card)");
sd_block_number += 2;
}
if (new_block_audio == 1 && sd_block_number < limit_block){
for (int i = 0; i < AUDIO_BLOCK_SIZE; i++) {
buffer_sd[0 + 8*i] = audiochannel_a2b_0_left_in[i];
buffer_sd[1 + 8*i] = audiochannel_a2b_0_right_in[i];
buffer_sd[2 + 8*i] = audiochannel_a2b_1_left_in[i];
buffer_sd[3 + 8*i] = audiochannel_a2b_1_right_in[i];
buffer_sd[4 + 8*i] = audiochannel_a2b_2_left_in[i];
buffer_sd[5 + 8*i] = audiochannel_a2b_2_right_in[i];
buffer_sd[6 + 8*i] = audiochannel_a2b_3_left_in[i];
buffer_sd[7 + 8*i] = audiochannel_a2b_3_right_in[i];
}
ptr_buf = buffer_sd;
result = writeonSD(ptr_buf, sd_block_number, 8*32*sizeof(float));
sd_block_number += 2;
new_block_audio = 0;
}
// if (new_block_audio == 1 && sd_block_number < limit_block){
// for (int i = 0; i < AUDIO_BLOCK_SIZE; i++) {
// buffer_sd[0 + 4*i] = audiochannel_a2b_0_left_in[i];
// buffer_sd[1 + 4*i] = audiochannel_a2b_0_right_in[i];
// buffer_sd[2 + 4*i] = audiochannel_a2b_1_left_in[i];
// buffer_sd[3 + 4*i] = audiochannel_a2b_1_right_in[i];
// }
// ptr_buf = buffer_sd;
// result = writeonSD(ptr_buf, sd_block_number, 4*32*sizeof(float));
// sd_block_number += 1;
// new_block_audio = 0;
// }
else if (sd_block_number >= limit_block){
for (int i = 0; i < AUDIO_BLOCK_SIZE; i++) {
buffer_sd[0 + 8*i] = 100.0f;
buffer_sd[1 + 8*i] = 100.0f;
buffer_sd[2 + 8*i] = 100.0f;
buffer_sd[3 + 8*i] = 100.0f;
buffer_sd[4 + 8*i] = 100.0f;
buffer_sd[5 + 8*i] = 100.0f;
buffer_sd[6 + 8*i] = 100.0f;
buffer_sd[7 + 8*i] = 100.0f;
}
ptr_buf = buffer_sd;
result = writeonSD(ptr_buf, sd_block_number, 8*32*sizeof(float));
sd_block_number += 2;
new_block_audio = 0;
log_event(EVENT_INFO, "Termina acquisizione");
while (1) {}
}
// check for correct write procedure
if (result != 0){
printf("fault on SD card write block %d\n", sd_block_number);
}
}

As you can see the saving procedure is done only when the variable new_block_audio == 1. This variable is set inside the function processaudio_callback{ } in the file core1/src/callback_audio_processing.cpp. Therefore, whenever a new audio block is available, the variable new_audio_block is set and the writing procedure is performed.

Now, my PROBLEM is this one:

it seems that the buffer a2b_audiochannels_in contains only ed every samples of the first microphone. The sample of the other 7 microphones (channels) are nowhere available. I don't quite understan why inside a2b_audiochannels_in there are samples from only one microphone and not from all.

I hope I was crear enough. I'm willing to even share the full CCES project if needed.

Elia Vignoli