How to enable SAI MCLK on iMX8MP?

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

How to enable SAI MCLK on iMX8MP?

2,861 Views
ensc
Contributor III

What is required to output a clock e.g. on the `SAI2_MCLK` pin?

With iMX8MM, the clock started immediately after iomux have been configured.  E.g. in barebox bootloader I see the signal after

mw 0x303301c8 0

 

But on iMX8MP the signal stays static

mw 0x303a00d8 32    ## power up audio block
mw 0x303301b4 0     ## ALT0_AUDIOMIX_SAI2_MCLK

and can be toggled by changing pull up/down settings

mw 0x30330414 0x140     ## signal becomes high
mw 0x30330414 0x100     ## signal becomes low

 

Clocks are enabled, audio_blk_ctrl controller is having power-on settings and I enabled MOE in SAI MCTL:

 md 0x30384650  
30384650: 00000003 00000003 00000003 00000003                ................

:/ md 0x30e20000+8  
30e20000: ff777777 0000003f                                  www.?...

:/ md 0x30e20300+0x20
30e20300: 00000000 00000000 00000000 00000000                ................
30e20310: 00000000 00000000 00000000 00000000                ................

:/ md 0x30c20100          
30c20100: 80000000 00000000 xxxxxxxx xxxxxxxx                ................

 

What has to be configured else to output the MCLK signal?  I require it for using an SGTL5000 which needs MCLK for its i2c communication.

10 Replies

2,733 Views
Dhruvit
NXP TechSupport
NXP TechSupport

Hi @ensc,

I have sent the additional details over email.

Thank you.

Best Regards,
Dhruvit.

0 Kudos
Reply

2,493 Views
VoVan
Contributor III
Can you see a solution to this problem? I have the same situation, the sgtl5000 works fine on the imx8mm board, since a normal clock is generated (MCLK - SAI3), but on the imx8mp board the clock does not work, as a result, there is no i2c device.
0 Kudos
Reply

845 Views
Eddy1
Contributor V

Hi:

Can your sgtl5000 work properly? Can you provide your device tree configuration? Currently, I followed your patch, but there is still no mclk output.

0 Kudos
Reply

2,484 Views
VoVan
Contributor III
Thanks, i'll try add this patches
0 Kudos
Reply

2,787 Views
Dhruvit
NXP TechSupport
NXP TechSupport

Hi @ensc,

I think there is no dependency of MCLK on I2C to work.

Could you please confirm at your end if there is something that you are missing related to any pins/GPIOs or SGTL5000?

 

Best Regards,
Dhruvit.

0 Kudos
Reply

2,782 Views
ensc
Contributor III

I think there is no dependency of MCLK on I2C to work.

MCLK is required; see Table 7 "Dynamic Electrical Characteristics", note 1

The SGTL5000 has an internal reset that is deasserted 8 SYS_MCLK cycles after all power rails have been brought up. After this time, communication can start.

and figure 4 "Power Up Timing"

ensc_1-1660829353535.png

But this question is about the iMX8MP;  I want to know how to generate SAI MCLK there.

0 Kudos
Reply

2,776 Views
Dhruvit
NXP TechSupport
NXP TechSupport

Hi @ensc,

 

Could you please try playing/recording something first to make SAI work?

For example, with default i.MX8MP evk, when I use the wm8960 for playback, SAI3 will be used, then I can read the register like,

ot@imx8mpevk:~# /unit_tests/memtool 30e20000 1
E
Reading 0x1 count starting at address 0x30E20000

0x30E20000:  04000300

 

Best Regards,
Dhruvit.

0 Kudos
Reply

2,774 Views
ensc
Contributor III

Could you please try playing/recording something first to make SAI work?

The problem is, that I can not play or record anything because I can not initialize the SGTL5000 due to the missing SAI_MCLK.

With iMX8MM on a similar hardware, this clock was easy to generate just by setting iomux.  This does not work anymore with iMX8MP.

What have I to do for generating SAI_MCLK?

 

For example, with default i.MX8MP evk, when I use the wm8960 for playback

I do not know the wm8960; perhaps its I2C works without the global mclk.

0 Kudos
Reply

2,471 Views
edwardtyrrell
Senior Contributor I

Hi @ensc 

Have you resolved your issues?

0 Kudos
Reply