How to store and play audio data in MPC5645S ?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to store and play audio data in MPC5645S ?

2,505 Views
abhiram_d
Contributor I

Please provide any example code to understand the same.

Tags (2)
0 Kudos
Reply
11 Replies

2,248 Views
abhiram_d
Contributor I

Hello Lukas

Attaching the code for SGM which produces tick sound in WAV mode. However we are not able to produce a different sound by replacing existing tick[] buffer with the desired wav data. We also tried with raw data, still unsuccessful. Can you please check whether it requires additional configuration changes for adding a custom wav data for playback ?

Microsoft OneDrive - Access files anywhere. Create docs with free Office Online. 

0 Kudos
Reply

2,248 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi Abhiram,

see please attached example.

Regards,

Lukas

“Any support, information, and technology (“Materials”) provided by NXP are provided AS IS, without any warranty express or implied, and
NXP disclaims all direct and indirect liability and damages in connection with the Material to the maximum extent permitted by the applicable
law. NXP accepts no liability for any assistance with applications or product design.  Materials may only be used in connection with NXP
products. Any feedback provided to NXP regarding the Materials may be used by NXP without restriction.”

0 Kudos
Reply

2,247 Views
abhiram_d
Contributor I

Hi Lukas.

We were able to playback polyphonic sound using DDS mode in the SGM Driver code which you provided. But we are unable to playback WAV files using WAV mode. There is no example for WAV mode. Can you please provide us the same?

0 Kudos
Reply

2,247 Views
abhiram_d
Contributor I

Hi Lukas,

Thanks for providing the code. Can you also provide any tutorial or docs to understand how we can store audio data and play it ? If we need to play specific types of formats we need conversion to PCM format right ? Please provide inputs on this.

0 Kudos
Reply

2,247 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi Abhiram,

unfortunately it looks like we do not have more materials, so I can only recommend to study the example. Yes, the best way is to convert your audio files to pcm and then convert it to hex (this is what you can see in the example). If I can remember, Audacity or similar tools could do that.

Regards,

Lukas

0 Kudos
Reply

2,247 Views
sreedevi_mohan
Contributor III

Hi Lukas,

 

1. What will be the size of hex file that is getting after the conversion?. Can you please provide an example case?

2.  Can we store this in internal flash? 

0 Kudos
Reply

2,247 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

1. The size of data will be the same. Conversion is done only to have a format which can be added to the project.

2. Yes.

Regards,

Lukas

0 Kudos
Reply

2,247 Views
abhiram_d
Contributor I

Hi Lukas
For storing in internal flash, do we need to create a separate partition if we want to store audio data apart from firmware ?

Also How can I download the SDK for MPC5645S and try example applications ?

0 Kudos
Reply

2,247 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Yes, it's necessary to create separate section. You can take a look at:

HOWTO: Program data flash (DFLASH) in S32 Design Studio for Power 

Don't care about the data flash, just see how to create custom section and how to place a constant to this section.

Just in case, here is how it works in CodeWarrior:

https://community.nxp.com/thread/364332#comment-547595 

There's no SDK for MPC56xx devices. SDK is available for MPC57xx and S32 devices.

For MPC56xx, we provide this cookbook:

https://www.nxp.com/docs/en/application-note/AN2865.pdf 

MPC5500 and MPC5600 Simple Cookbook Code 

And a lot of examples can be found here:

https://community.nxp.com/docs/DOC-329623 

There are no examples written directly for MPC5645S but a lot of code can be reused because a lot of modules are the same.

Regards,

Lukas

0 Kudos
Reply

2,248 Views
abhiram_d
Contributor I

If no SDK is available, will the developer have to develop the drivers for using different features and modules like CAN, LINFlex, SGM etc ?

Also, if we need to store multiple audio wav files of 3 Mb, how can we achieve this ? If we use QSPI flash or SDRAM, can we flash this wav file data to the same ? If so, is this similar to how we flash the firmware ? Do you have any examples or guides for this scenario ?

0 Kudos
Reply

2,248 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

1. Unfortunately, yes.

2. There are flash algorithms for programing of external QSPI flash memories. This is supported by both CodeWarrior and S32 Design Studio. The algorithms are provided by Pemicro.

For my surprise, I found out that S32DS does not support MPC5645S (only this one seems to be missing, other MPC56xx are supported). MPC5606S is supported by S32DS. So, it will be necessary to use CodeWarrior for MPC5645S.

In both IDEs, you can select alternative flash algorithms (*.pcp files). Search for "spansion" keyword in installation folder. Names of files contain supported memories.

Regards,

Lukas

0 Kudos
Reply