Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

Metro M4 - I2S Slave Clock Inversion
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Metro M4 - I2S Slave Clock Inversion

by klw1971 on Wed Jul 22, 2020 12:15 pm

Hi everyone,

On SAMD51 I2S in slave mode, does anyone know how to invert the logic of the external clock? This would be the reverse of normal - i.e. with inversion, SAMD51 should change the bit on the rising edge and the codec then reads the bit on the falling edge.

On SAMD51 there are controls for FSINV, SCKOUTINV and MCKOUTINV which I assume work in master mode. I tried this with slave mode... no luck.

Code: Select all | TOGGLE FULL SIZE
    uint32_t FSINV:1;          /*!< bit:      9  Frame Sync Invert                  */
    uint32_t SCKOUTINV:1;      /*!< bit:     12  Serial Clock Output Invert         */
    uint32_t MCKOUTINV:1;      /*!< bit:     15  Master Clock Output Invert         */


On Raspi, both BCM2835_I2S_CLKI and BCM2835_I2S_FSI are available and do work in slave mode.

Code: Select all | TOGGLE FULL SIZE
From bcm2835-i2s.c:

   /*
    * Invert clocks?
    *
    * The BCM approach seems to be inverted to the classical I2S approach.
    */
   switch (dev->fmt & SND_SOC_DAIFMT_INV_MASK) {
   case SND_SOC_DAIFMT_NB_NF:
      /* None. Therefore, both for BCM */
      mode |= BCM2835_I2S_CLKI;
      mode |= BCM2835_I2S_FSI;
      break;
   case SND_SOC_DAIFMT_IB_IF:
      /* Both. Therefore, none for BCM */
      break;
   case SND_SOC_DAIFMT_NB_IF:
      /*
       * Invert only frame sync. Therefore,
       * invert only bit clock for BCM
       */
      mode |= BCM2835_I2S_CLKI;
      break;
   case SND_SOC_DAIFMT_IB_NF:
      /*
       * Invert only bit clock. Therefore,
       * invert only frame sync for BCM
       */
      mode |= BCM2835_I2S_FSI;
      break;
   default:
      return -EINVAL;
   }


Anyone have any good ideas? ... make using CCL?

Thanks!
klw1971

klw1971
 
Posts: 4
Joined: Fri Jun 22, 2018 1:12 pm

Re: Metro M4 - I2S Slave Clock Inversion

by User_UMjT7KxnxP8YN8 on Fri Jul 31, 2020 10:18 am

I'd start in Chapter 51. I2S - Inter-IC Sound Controller in the SAM D5x/E5x Family Data Sheet, available at http://ww1.microchip.com/downloads/en/DeviceDoc/SAM_D5xE5x_Family_Data_Sheet_DS60001507F.pdf.

User_UMjT7KxnxP8YN8
 
Posts: 153
Joined: Tue Jul 17, 2018 1:28 pm

Please be positive and constructive with your questions and comments.