• AVR Freaks

How to use SPI instead of I2C in the Generic Codec Driver?

Author
thoraz
Junior Member
  • Total Posts : 100
  • Reward points : 0
  • Joined: 2013/06/01 18:37:43
  • Location: 0
  • Status: offline
2020/06/03 03:51:41 (permalink)
0

How to use SPI instead of I2C in the Generic Codec Driver?

Hi everyones!
I'm approacing to develop an audio application with the ADAU1961 codec interfaced whit an PIC32MZ through SPI. Now in the Help doc (Harmony\v3\audio\docs) I read that the Generic Codec Driver is designed for the I2C interface and again I read:

Note: this module assumes the codec is controlled over an I2C interface. The I2C Driver will need to be enabled in the MHC Project Graph. If another type of interface is used, the user will need to modify the code to suit.

 
Is there a guide to how make that modify? Do you have some suggestion or example regard the easiest way to do it?
#1

3 Replies Related Threads

    ric
    Super Member
    • Total Posts : 27595
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: offline
    Re: How to use SPI instead of I2C in the Generic Codec Driver? 2020/06/03 04:11:20 (permalink)
    0
    I think you are confusing the data port and the control port. They are seperate.
    The ADAU1961 control port can operate in either I2C or SPI mode.

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #2
    thoraz
    Junior Member
    • Total Posts : 100
    • Reward points : 0
    • Joined: 2013/06/01 18:37:43
    • Location: 0
    • Status: offline
    Re: How to use SPI instead of I2C in the Generic Codec Driver? 2020/06/03 04:42:02 (permalink)
    0
    ric
    I think you are confusing the data port and the control port. They are seperate.
    The ADAU1961 control port can operate in either I2C or SPI mode.




    No I'm not confusing the two interfaces. I'm referring to the control port. I know that the ADAU1961 can operate in either I2C and SPI but on the custom board I'm using I can use only the SPI since the connections are:


    ADAU1961 ------ PIC32MX
    --------------------------------
    CCLK/SCL ------- PIN10 (AN14/C1IND/ECOL/RPG6/SCK2/RG6)
    MISO/SDA ------ PIN11 (EBIA4/AN13/C1INC/ECRS/RPG7/SDA4/PMA4/RG7)
    MOSI/A1 -------- PIN12 (EBIA3/AN12/C2IND/ERXDV/ECRSDV/AERXDV/AECRSDV/RPG8/SCL4/PMA3/RG8)
    CLATCH/A0 ----- PIN16 (EBIA2/AN11/C2INC/ERXCLK/EREFCLK/AERXCLK/ AER-EFCLK/RPG9/PMA2/RG9)
     
    I have the CCLK/SCL of the connect to the SCK2 of SPI2 and not on the SCL4 of the I2C4.
    #3
    ric
    Super Member
    • Total Posts : 27595
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: offline
    Re: How to use SPI instead of I2C in the Generic Codec Driver? 2020/06/03 15:38:27 (permalink)
    0
    ok.
    I guess your choices are:
    [1] As mentioned, modify the code to use SPI instead of I2C
    [2] Use bit-banged I2C on the connections you do have.
    Bit banging is slower than a peripheral, but you can do it on any pins. As it's only a control interface, slow occasional access shouldn't be a problem.
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #4
    Jump to:
    © 2020 APG vNext Commercial Version 4.5