MIMXRT1060-EVK(B): Enabling Speakers w/SAI Examples

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

MIMXRT1060-EVK(B): Enabling Speakers w/SAI Examples

770 Views
michaelsmorto
Contributor IV

Ok.  Been working on the SAI examples and have not had a problem with the hearing through the headset plugged into the board.  According to the schematic, j16/17 are speaker connectors which I would like to use.  However, it is not clear to me how I can control the wm8960 to use the speakers from the examples provided.  Are there any examples that show how to do this?

Thanks

Mike

0 Kudos
2 Replies

634 Views
weidong_sun
NXP TechSupport
NXP TechSupport

Hello Michael,

    By default, I.MXRT1060 SDK didn't enable Speaker output, the related source code is in "fsl_wm8960.c", see below, please! You can enable it in the function, try it , please!

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

status_t WM8960_SetDataRoute(codec_handle_t *handle, wm8960_route_t route)

{

       /* add a line */

       uint16_t val = 0;

...

        case kWM8960_RoutePlayback:
            /* Data route I2S_IN-> DAC-> HP */
            /*
             * Left DAC to left output mixer, LINPUT3 left output mixer volume = 0dB
             */
            WM8960_WriteReg(handle, WM8960_LOUTMIX, 0x100);

            /*
             * Right DAC to right output mixer, RINPUT3 right output mixer volume = 0dB
             */
            WM8960_WriteReg(handle, WM8960_ROUTMIX, 0x100);
            WM8960_WriteReg(handle, WM8960_POWER3, 0x0C);

            /* add here*/

            WM8960_ReadReg(WM8960_POWER2, &val);

            val |= 0x18;

            WM8960_WriteReg(handle, WM8960_POWER2, val ); //  set 1A register bit 3 & bit 4 to be 11b

            WM8960_ReadReg(WM8960_CLASSD1, &val); 

            val |= 0xD0;

            WM8960_WriteReg(handle, WM8960_CLASSD1, val ); // Enable 2 speakers
            /* Set power for DAC */
            WM8960_SetModule(handle, kWM8960_ModuleDAC, true);
            WM8960_SetModule(handle, kWM8960_ModuleOMIX, true);
            WM8960_SetModule(handle, kWM8960_ModuleLineOut, true);
            break;

...

}

Above method is just for you reference, you can try to debug it according to your requirement.

Below is related registers for speaker control of WM8960, you can also download wm8960 datasheet from wolfson website.

pastedImage_3.png

Below is volume control, if no volume or too slow, you can configure the register:

pastedImage_4.png

pastedImage_5.png

have a nice day!

NXP TIC weidong sun

634 Views
michaelsmorto
Contributor IV

Hi Wigros,

I added the appropriate to WM8960_SetDataRoute and no luck.  I also added these lines after that as a test:

            WM8960_WriteReg(handle, WM8960_CLASSD3, 0x11B);  //DCGAIN-ACGAIN 1.52x(3.6db)
            //WM8960_WriteReg(handle, WM8960_LOUT2, 0x179);    //volume update endabled
            //WM8960_WriteReg(handle, WM8960_ROUT2, 0x179);

but still no luck.  Since I was using the evkbimxrt1050_sai_edma_record_playback example I also added those lines to the recordplayback case but still did not work.  

Oh, for reference I also found this application note by Wolfson very helpful: WM8960-6158-FL320M-REV1 Example Configurations.

Now for a possible issue may be I am using a simple 8ohm speaker that I had from an old computer, so I don't know it that could be an issue.

Really appreciate the help.  Really, a newbie at this and anything related to audio.

Respectfully,

Mike

0 Kudos