cancel
Showing results for 
Search instead for 
Did you mean: 

Failed to execute multiple wave files

Aishwaryaum
Associate II

Hi Community ,

We are working on AVAS project Autodevkit AEK-AUD-C1D9031 and trying to execute two wave files for two different channels.

But only one wave file is getting executed which is getStartWavFile(0) when tried to give non zero parameter ,wave sound is not coming e.g. getStartWavFile(1).

Below is the snippet base code and modified code to access both wave files:

1.Two wave files added inside source -->audio files 

2. Two wave files location has been added inside sounddb.s 

 

Aishwaryaum_0-1713269566074.png

 

10 REPLIES 10

Check beginning and end off data the code uses.

Check data is valid

Perhaps make two instances of the data known to work.

Check it gets to your code and not blocked by the run once code.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Max VIZZINI
ST Employee

Hi,

You only have to channel in the solution (stereo) left and right.

The sample are sent in couple left,right therefore you do not need to load 2 files but to change the data file and encode the two channels: first sample goes left, second goes right, third goes left, forth goes right, etc.

Considering the limited internal flash space, you cannot load more than 1-2 sec wav file in total encoded on 32 bits.

Last thing to check is the volume you are using.

Best Regards,

AutoDevKit Team

 

 

Hi Max VIZZINI,

Thank you for your prompt and informative response to my previous inquiries posted in the community. Now, the source code is working fine for two channels with two different wave files.

Now I am facing one more issue, I took FreeRtos example(as shown in the snippet) as the base source code and integrated AEK-AUD-D903V1 RLA component. After integration, "AEK_903D_Init(AEK_AUD_D903V1_DEV0)" API is not getting initialized. The execution is getting stucked inside this API.

Can you please help me to come out of this issue, so that I can integrate FreeRtos and amplifiers together.

Aishwaryaum_0-1713764287612.png

 

Hi,

As I have already stated, the code has NOT be written from freeRTOS therefore it requires modification.

In particular all osalThreadDelay() are not working under freeRTOS. They have to be substituted with:

 

vTaskDelay () specifies a wake time relative to the time at which the function is called

OR

vTaskDelayUntil () specifies the absolute (exact) time at which it wishes to unblock

 

Example code:

TickType_t xLastWakeTime = xTaskGetTickCount();

vTaskDelayUntil( &xLastWakeTime, 200 );

where 200 are in milliseconds.

 

Best Regards,

AutoDevKit Team

Hi Max VIZZINI,

Thank you for your prompt and informative response to my previous inquiries posted in the community. 

I have modified the code as you insisted but the execution is getting stuck inside vTaskDelay and vTaskDelayUntil.

Attached snippet shows the line where the execution is actually getting stuck.

Can you please help me to come out of this issue.

Aishwaryaum_0-1713786690091.png

 

Hi,

The code you show is part of the freeRTOS driver. 

The memory error location is the Flash.

Probably when you loaded the new sound files (wavefiles) you changed the memory structure and location therefore now the code is not working anymore.

Once again, moving the code from the existing version to freeRTOS is not an easy task we can support by community posts.

Thank you in advance for your understanding.

Best Regards,

AutoDevKit Team

Hi Max VIZZINI,

A very Good morning, Thank you for your support and guidance.

Basically, I have not added any base new sound files to the existing source code.

I have modified the source code as you mentioned but I am again facing the following issue, can you please help me to come out of these.

1. If I use vTaskDelay() or vTaskDelayUntil (), Execution is getting stuck at "List_t * const pxList = pxItemToRemove->pxContainer;" line in uxListRemove() API(As shown in the snippet).

Aishwaryaum_0-1713846104032.png

2. If I comment vTaskDelay() or vTaskDelayUntil (), then execution is getting stuck at "ret |= AEK_903D_SetDefaultRegisters(dev);" line in AEK_903D_Init() API(As shown in the snippet).

Aishwaryaum_1-1713846755875.png

 

Hi,

You are calling a vTaskDelay() primitive without creating a task and without starting the scheduler?

If so, no surprise the task handler does not find any active task...

You CANNOT just add freeRTOS components and some primitives and hope everything works: you need to CHANGE the ENTIRE code to run under an operating system.

For you here following an example of two task blinking 2 LEDs and sending messages on a common serial peripheral:

 

----

#include "components.h"

#include "FreeRTOS.h"
#include "task.h"

uint8_t message_task1[]= "Task1...\r\n";
uint8_t message_task2[]= "Task2...\r\n";

/* Demo tasks */
portTASK_FUNCTION( vTaskOne, pvParameters )
{
( void ) pvParameters;
TickType_t xLastWakeTime = xTaskGetTickCount();
for ( ;; ) {
vTaskSuspendAll();
sd_lld_write(&SD2,message_task1,(uint16_t)(sizeof(message_task1)/sizeof(message_task1[0])));
xTaskResumeAll();
pal_lld_togglepad(PORT_E, LED_4);
vTaskDelayUntil( &xLastWakeTime, 200 );
}
}

/* Demo tasks */
portTASK_FUNCTION( vTaskTwo, pvParameters )
{
( void ) pvParameters;
TickType_t xLastWakeTime = xTaskGetTickCount();
for ( ;; ) {
vTaskSuspendAll();
sd_lld_write(&SD2,message_task2,(uint16_t)(sizeof(message_task2)/sizeof(message_task2[0])));
xTaskResumeAll();
vTaskDelayUntil( &xLastWakeTime, 200 );
pal_lld_togglepad(PORT_D, LED_5);
}
}

/*
* Application entry point.
*/
int main(void) {

/* Initialization of all the imported components in the order specified in
the application wizard. The function is generated automatically.*/
componentsInit();

/* Enable Interrupts */
irqIsrEnable();

/*
* Activates the serial driver 1 using the driver default configuration.
*/
sd_lld_start(&SD2, NULL);

/* Creating first task to blink LED0 */
xTaskCreate( vTaskOne,
(const char * const)"task #1",
configMINIMAL_STACK_SIZE,
NULL,
tskIDLE_PRIORITY + 1,
NULL );

/* Creating second task to blink LED1 */
xTaskCreate( vTaskTwo,
(const char * const)"task #2",
configMINIMAL_STACK_SIZE,
NULL,
tskIDLE_PRIORITY + 1,
NULL );

/* Start the FreeRTOS scheduler */
vTaskStartScheduler();

return 0;

}

---------------

Before attempting porting the code, please study freeRTOS tutorial https://www.freertos.org/a00106.html

We support all APIs till version 10.0.

Please understand that from now on I will ignore this thread.

Best Regards,

AutoDevKit Team

 

Hi Max VIZZINI,

A very good afternoon, Thank you for your informative response and guidance.

Actually I have created two tasks with different priorities(as shown in the snippet) along with the task scheduler.

But still execution is stuck inside delay function.

Aishwaryaum_0-1714384690334.png

Can you help me to come out of this issue

Thanks for understanding

 

Best regards,

Aishwarya