audio transfer to speaker via i2s (interrupt transfer ) in LPC 55S16 MICROCONTROLLER

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

audio transfer to speaker via i2s (interrupt transfer ) in LPC 55S16 MICROCONTROLLER

12,552件の閲覧回数
Arularasan
Contributor II

Hi I am using

HARD WARE - 1) lpcxpresso55s16 EVK board ,

                         2) Headset  connected to audio  LINE_OUT of lpcxpresso55s16 EVK board

SOFWARE     - lpcxpresso55s16_i2s_interrupt_transfer(SDK Example code).

audio file transfer to speaker via i2s (interrupt transfer ) but the audio output was totally different.

so please help me to solve this problem.

0 件の賞賛
返信
13 返答(返信)

12,488件の閲覧回数
Arularasan
Contributor II

@Pavel_Hernandez 

any good audio to hex converters? I have an audio file that I need to convert to hex for a programming project. I've tried looking online, but I'm not sure which tools are reliable. Do you have any suggestions or recommendations? Thank you!"

attach link please.

0 件の賞賛
返信

12,532件の閲覧回数
Pavel_Hernandez
NXP TechSupport
NXP TechSupport

Hello, my name is Pavel, and I will be supporting your case, I review your information and I have another question. Did you do any modifications to the example? Are you sure the jumpers are in the default position? Did you check the DOC file in the example if you need a special jumper movement?

Best regards,
Pavel

0 件の賞賛
返信

12,510件の閲覧回数
Arularasan
Contributor II

thank you @Pavel_Hernandez for your reply

1)No modifications to the example .

2)Yes the jumpers are in the default position.

3)Yes I check the DOC file in the example no need a special jumper movement.

After modify the example code different in output(sound) when compared to Example code.

With modification or without modifications to the example. The output (tone) is the difference from the given input(hex code).

 

 

 

0 件の賞賛
返信

12,478件の閲覧回数
Pavel_Hernandez
NXP TechSupport
NXP TechSupport

Hello, thanks for your information, I review the example, and worked as expected. I do not know about of specific converter, but I found this video on YouTube that maybe could help you.

Voice Alert System + Convert .Wav Audio File to .Hex - YouTube

I do not suggest modifying with random numbers the actual audio hex because the changes maybe are imperceptible to the ear.

Best regards
Pavel

0 件の賞賛
返信

12,427件の閲覧回数
Arularasan
Contributor II

@Pavel_Hernandez  I have modified the example code, any corrections?

void I2S_init(void)
{
FLEXCOMM_Init(I2S7, FLEXCOMM_PERIPH_I2S_TX);

/* protocol: i2s
* sampleRate: 48K
* bitwidth:16
* masterSlave = kI2S_MasterSlaveNormalMaster;
* mode = kI2S_ModeI2sClassic;
* rightLow = false;
* leftJust = false;
* pdmData = false;
* sckPol = false;
* wsPol = false;
* divider = 1;
* oneChannel = false;
* dataLength = 16;
* frameLength = 32;
* position = 0;
* watermark = 4;
* txEmptyZero = true;
* pack48 = false;
*/
/*****************************************************************************
* 2:3 Channel Pair selection
* 4:5 Mode Selection
* 16:19 Data length selection
*****************************************************************************/
I2S7->CFG1 = 0<<2 | 0<<3 | 1<<4 | 1<<5 | 1<<16 | 1<<17 | 1<<18 | 1<<19;
/*****************************************************************************
* 0:7 Frame length selection
*****************************************************************************/
I2S7->CFG2 = 1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<5;
/*****************************************************************************
* 0:7 Clock divider selection
*****************************************************************************/
I2S7->DIV = 0x6f;//0X2f; //0x6f - proper value
/*****************************************************************************
* 0 Transmit FIFO enabled
* 2 Tx FIFO becomes empty
* 5 Data length is less then 16 bit
*****************************************************************************/
I2S7->FIFOCFG = 1<<0 | 1<<2 | 1<<5;
/*****************************************************************************
* 0 Interrupt is generated for an transmission
*****************************************************************************/
I2S7->FIFOTRIG = 1<<0 | 1<<10;
/*****************************************************************************
* 0 Disable Tx error interrupt
* 2 Tx value level specifier
*****************************************************************************/
I2S7->FIFOINTENCLR = 1<<0 | 1<<2;
}

void WM8904(void)
{
codec_config_t boardCodecConfig = {.codecDevType = kCODEC_WM8904, .codecDevConfig = &wm8904Config};
codec_handle_t codecHandle;

CODEC_Init(&codecHandle, &boardCodecConfig);

/* Initial volume kept low for hearing safety. */
/* Adjust it to your needs, 0x0006 for -51 dB, 0x0039 for 0 dB etc. */
CODEC_SetVolume(&codecHandle, kCODEC_PlayChannelHeadphoneLeft , 0x0039);

}

0 件の賞賛
返信

12,413件の閲覧回数
Pavel_Hernandez
NXP TechSupport
NXP TechSupport

Hello, sorry for the late response, if the modifications meet your requirements, is ok.

Best regards,
Pavel

0 件の賞賛
返信

12,381件の閲覧回数
Arularasan
Contributor II

@Pavel_Hernandez  The rhythm for the audio is coming but the correct tone is not coming .

 I am using mono channel (left side).

 kindly navigate to change the tone.

 

0 件の賞賛
返信

12,377件の閲覧回数
Pavel_Hernandez
NXP TechSupport
NXP TechSupport

Hello, could you share with me at least 2 audios in a reproducible format (mp3 or wav) and the hex (corresponding to that audio files)? this is to do a test; I do not have an audio hex converter.

Best regards,
Pavel

0 件の賞賛
返信

12,344件の閲覧回数
Arularasan
Contributor II

@Pavel_HernandezI have attached 2 audio files with hex code below.

in the example code i2s interrupt transfer  I changed stereo to "mono" channel and Divide the clock by the hex value of "0X57"

1) I changed stereo to mono channel

void I2S_TxGetDefaultConfig(i2s_config_t *config)
{
config->masterSlave = kI2S_MasterSlaveNormalMaster;
config->mode = kI2S_ModeI2sClassic;
config->rightLow = false;
config->leftJust = false;
#if (defined(FSL_FEATURE_FLEXCOMM_I2S_HAS_DMIC_INTERCONNECTION) && FSL_FEATURE_FLEXCOMM_I2S_HAS_DMIC_INTERCONNECTION)
config->pdmData = false;
#endif
config->sckPol = false;
config->wsPol = false;
config->divider = 1U;
config->oneChannel = true;// (***********MONO CHANNEL**************)
config->dataLength = 16U;
config->frameLength = 32U;
config->position = 0U;
config->watermark = 4U;
config->txEmptyZero = true;
config->pack48 = false;
}

2) Divide the clock by the hex value of 0X57

/* set the clock divider */
base->DIV = 0X57;//I2S_DIV_DIV(config->divider - 1UL);

0 件の賞賛
返信

12,287件の閲覧回数
Pavel_Hernandez
NXP TechSupport
NXP TechSupport

 

Hello, I reviewed your information and I noticed at first the audio is too quick at the difference of mp3, so I reduce the clock divider and I checked, the sound is better, could you confirm this? 

#define DEMO_I2S_CLOCK_DIVIDER (CLOCK_GetPll0OutFreq() / 48000U / 2U / 2U)

Best regards,
Pavel

0 件の賞賛
返信

12,262件の閲覧回数
Arularasan
Contributor II

@Pavel_HernandezYes, if we fix the clk divider, we get the rhythm correct, but the problem here is the "tone" is different .

The audio file played in the audio player "TONE"  is not the same when played on our i2s speaker.

Here the problem is "TONE".

I want to increase the base of this tone.

kindly navigate to change the tone.

0 件の賞賛
返信

12,253件の閲覧回数
Pavel_Hernandez
NXP TechSupport
NXP TechSupport

Hello, sorry for the late response, you need to review the datasheet of the codec WM8904 I suggest reviewing the information that information about the tone.

Pavel_Hernandez_0-1684268769476.png

Best regards,
Pavel

 

0 件の賞賛
返信

12,237件の閲覧回数
Arularasan
Contributor II

@Pavel_Hernandez  Thanks for your update I will check

 

0 件の賞賛
返信