Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 7 of 7

Thread: sgtl5000 I2S question...

  1. #1
    Junior Member
    Join Date
    May 2019
    Posts
    12

    sgtl5000 I2S question...

    Hi All,

    I am running the basic PassThroughStereo code using a Teensy 4.0 and the sgtl5000 shield and it works great!

    The question I have is:
    Is there a function such as sgtl5000_1.disable()?

    I would like to learn how to shut down or stop the I2S clocks. Let's say I want to minimize power consumption and want to put everything as much as possible into idle or sleep mode, I would like to enable and disable the I2S engine or clocks as I need to. Turn them on as I want to pass audio and turn them off as I stop and don't need to pass audio anymore.

    Is this possible?

    Thanks!
    Normal.User.

  2. #2
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    6,906
    Possible - yes.
    But I fear YOU have to write the code...

    The SGTL code has a function disable() .. but turns out it looks like this:
    Code:
        bool disable(void) { return false; }
    So I think, it was left blank as TODO for us..

  3. #3
    Junior Member
    Join Date
    May 2019
    Posts
    12
    I understand, would you point me in the right direction where to find the source code for this?
    Thanks!

  4. #4
    Senior Member
    Join Date
    Aug 2016
    Location
    Australia
    Posts
    161
    A quick look at the SGTL data sheet (p30) suggests that most, ifg not all of the enable/disable functions can be found in the CHIP_DIG_POWER register (0x0002).

    Simply set bits 0,1, 4,5,6 to zero.

    You should be able to find prototype code in Paul's SGTL5000 control object for how to set register bits.

    I hope this helps.

  5. #5
    Junior Member
    Join Date
    May 2019
    Posts
    12
    Teensy is in charge of the I2S clocks, how can I tell Teensy to stop the clocks? The SGTL is an I2S slave.

  6. #6
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    22,077
    Quote Originally Posted by NormalUser View Post
    how can I tell Teensy to stop the clocks?
    The answer varies depending on which Teensy. Earlier you said Teensy 4.0, so this info is for 4.0 and applies to the IMXRT1062 chip (in case anyone else later finds this thread).

    The clock is created by "CCM_ANALOG_PLL_AUDIO", which is documented starting on page 1165 of the "i.MX RT1060 Processor Reference Manual, Rev. 1, 12/2018". You can get that manual here:

    https://www.pjrc.com/teensy/datasheets.html

    A clock divider following the PLL is controlled by 2 bits in CCM_ANALOG_MISC2, documented starting on page 1187.

    This clock is routed to the I2S interfaces by bits in the IOMUXC_GPR_GPR1, documented at page 324.

    Every pin has a mux which allows it to performs 1 of several functions. The GPIO_AD_B1_09 mux is the one for pin 23 where MCLK appears. It IOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B1_09 register is documented on page 497.

    To specifically answer your question "how can I tell Teensy to stop the clocks", you do so by writing different settings to some combination of those registers. Again, this is only for Teensy 4.0 with the IMXRT1062. Teensy 3.x boards have completely different registers.

    And to specifically answer your earlier question "where to find the source code for this", just in case this wasn't clear from Frank's answer and the info above, there currently is no such source code you to find. You will need to write it yourself. Hopefully this message with the exact register names and specific pages in the reference manual where they are documented will help you to write the code. If you get it working, maybe consider sharing here, so others who later find this thread can have a better answer?

  7. #7
    Junior Member
    Join Date
    May 2019
    Posts
    12
    Let me look into this... Thanks!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •