Post Go back to editing

working tutorial, eval adau 1467 and teensy4.1 to control it, in C

Category: Hardware

Hello, as i was not able to get a working solution with my esp32 in spi to control my eval adau 1467, this time i will try with another board i have and whose sister (teensy 4.0) was the chosen one by ADI for its tuto. We will try spi and i2c. The goal is to help the community to get started with all the needed details of the actions i will go thru to get the mcu control this eval board.



Typos fix
[edited by: iravelo at 6:38 PM (GMT -4) on 31 Oct 2022]
Parents
  • The twisted white and green wires are out of today’s equation, they are used by another project involving the little red daughterboard and one of its dual canbuses.

  • Hello iravelo,

    If you are using I2C then please note this.

    The ADDR0 and ADDR1 are those pins who choose the device address. It has different combinations. Look at the below table from the datasheet.

    In our ADAU1467 Eval board , the ADDR0 is tied to IOVDD. which represents a binary one (HIGH) always. So by connecting ADDR1 to GND ( '0' - LOW)  OR connecting ADDR1 to 3.3v ( '1' - HIGH), You can get the addresses 0x72 (ADDR1 - LOW) and 0x76 (ADDR1 - HIGH) respectively.

    In the example code given in that wiki page assumes that both ADDR0 and ADDR1 pins are set to LOW. That's not gonna be true for our Eval board since ADDR0 is tied to IOVDD. So you have to change the binary value in the below code, based on any of these addresses (0x72 or 0x76) that is given in hex.

    Also keep in mind that the wire library of teensy uses 7-bit addressing. It omits the Read/Write bit. That's why 7 bits were given for addressing in the below code.

    In hardware set up, simply change this - Pin-8 of the slave control port (J1) is ADDR1. Connect it to either ground (0x72)  or 3.3v (0x76). In 7-bit addressing it is 0x39 and 0x3B respectively.

    The other way around is Pin-9 of the slave control port (J1) is ADDR0 .which is already tied to IOVDD. You can leave that as it is for now. You don't really need to touch it now.

    If you want to change the state then remove that R68 resistor. Refer the schematics for more info.

    So in your set up you have to connect pin 8 to either ground or 3.3v.

    Regards,

    Harish

     

  • hi Harish, nice you took a few minutes to take care of my project.

    I did not pay special attention to I2C addr of ADAU1467 changing according to states of ADDR0 & ADDR1 (meaning SS and MOSI lines in fact), thanks for mentionning that, I appreciate.

    What I was about to code was :

    const int DSP_I2C_ADDR = 0b0111000; // From ADAU1463 datasheet Table 26; assumes ADDR1 and ADDR0
    // low (eval board); adjust for your application.
    as found in ADI provided file.
    So, I understand that if I leave pin 9 / ADDR0 / SS alone (==not connected, not used), its state is HIGH as it is internally tied to IOVDD;
    But i need to decide what to do with pin 8 / MOSI / ADDR1; I'll go the LOW / GND way for him ! so my ADAU's I2C will be at address 0x72, or 0x39 in 7 bits
  • as you mentionned "wire library of teensy uses 7-bit addressing" (i'll try to find some reference saying that elsewhere), then in my case, I need to consider using in fact address 0x39.

    -> const int DSP_I2C_ADDR = 0x39;

    am I right ?

    edit: I've found here ...  www.pjrc.com/teensy/td_libs_Wire.html and also www.arduino.cc/reference/en/language/functions/communication/wire/

    the mention ... "The Wire library requires addresses which do not include the R/W bit. Based only on the datasheet, you might conclude the address is 160 when writing and 161 when reading. The Wire library needs address 80 to communicate with this chip. The R/W bit is automatically created based on your use of the send or receive functions."

    and this .. "Note: There are both 7 and 8-bit versions of I2C addresses. 7 bits identify the device, and the eighth bit determines if it’s being written to or read from. The Wire library uses 7 bit addresses throughout. If you have a datasheet or sample code that uses 8-bit address, you’ll want to drop the low bit (i.e. shift the value one bit to the right), yielding an address between 0 and 127. However the addresses from 0 to 7 are not used because are reserved so the first address that can be used is 8."

    Now I know why!

  • Here we go with the addition of grounding addr1 (sorry the forum seems to refuse my photo uploads), i might need to go the photo host and all the spam review by the moderators...

  • Hello iravelo,

    I forgot to mention one important thing.

    Since it is I2C protocol, Please don't forget to add pull up resistors:

    2.2 kΩ from SDA to 3.3V
    2.2 kΩ from SCL to 3.3V

    Regards,

    Harish

  • Hi, as reading a register return the same value on the teensy while being or not being connected to the eval board, i had to step back and try something even more basic as an i2c bus scanner, alas, it failed to detect anything

  • now i gonna add those 2.2K explicit and external pullup resistors between teensy's 3.3V and its SCL/SDA lines... we'll see

  • Here are the pullup resistors, in full glory..

Reply Children
No Data