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

Thread: Redefining I2S pins from software

  1. #1
    Junior Member
    Join Date
    Jul 2021
    Posts
    5

    Redefining I2S pins from software

    Hi,

    On a prototype PCB for a Teensy 4.1 + WM8731 I'm working on, I mistakenly swapped the I2S pins BCLK and SCLK. I have no way to rewire that without printing a new PCB, so I was wondering if it was possible to temporarily swap those pins somewhere in the library until I can debug the full board and print a new one ?

    I've searched in the library for some pin constants somewhere but couldn't find those.

    Best,

  2. #2
    Senior Member
    Join Date
    Jul 2020
    Posts
    1,460
    SCLK? Do you mean SCK on the teensy pinout card? That's an SPI signal, not I2S. I2S clocks are MCLK/BCLK/LRCLK.

    Unfortunately the I2S peripheral (aka SAI1) doesn't work like that, its selectable to only a small selection of GPIO pins
    (typically only 3 choices per signal, not all of which may be brought out as T4.1 pins)
    The I2S code in the audio library has all of this I/O setup code hardwired like this:
    Code:
    	CORE_PIN21_CONFIG = 3;  // AD_B1_11  ALT3=SAI1_RX_BCLK
    	CORE_PIN20_CONFIG = 3;  // AD_B1_10  ALT3=SAI1_RX_SYNC
    	IOMUXC_SAI1_RX_BCLK_SELECT_INPUT = 1; // 1=GPIO_AD_B1_11_ALT3, page 868
    	IOMUXC_SAI1_RX_SYNC_SELECT_INPUT = 1; // 1=GPIO_AD_B1_10_ALT3, page 872
    Full details for the SAI peripheral in the iMXRT1062 processor is in the 3437-page datasheet here:
    https://www.pjrc.com/teensy/IMXRT1060RM_rev2.pdf - not for the faint-hearted(!)

  3. #3
    Junior Member
    Join Date
    Jul 2021
    Posts
    5
    OK I see, thanks a lot for your answer anyways! Indeed I meant one I2S pin and one SPI pin (which are both used to communicate with the same chip, I guess the SPI pin is the control interface to the audio chip).

    I went a different route and did some green wire routing on tiny vias to swap the traces, hope it'll work.

  4. #4
    Senior Member
    Join Date
    Jul 2020
    Posts
    1,460
    No prototype board is complete without a few bodges like this(!)
    I significantly reduced my error rate with PCBs by introducing a rule that I never submitted a PCB design to manufacturer
    the same day I completed the layout, but came back the next day and reviewed it carefully. My worst PCB gaffe was forgetting
    any connectors for the power rails on one PCB!

Posting Permissions

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