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

     

  • 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..

  • Alas, scanner still cannot see anything !

  • Hello iraivelo,

    I have noticed that you connected the SCL and SDA line to pins 1 and 3 of the slave control port (J1) respectively. But it's not going to work because those weren't' connected to the DSP. In our Eval board - Slave control port J1, Pins 5 and 7 are connected to the DSP (pin 38 and 39).

    Pins 5 and 7 are MISO and SCLK respectively which were multiplexed with SDA and SCL. This is a feature where you can shift between I2C and SPI protocols in software without changing the hardware. For that you have to short pin 1 with 7 and pin 3 with 5.

     In the context of I2C, now pin 5 is SDA and pin 7 is SCL. Connect that directly from teensy. please refer the below block diagram.

    Regards,

    Harish

  • Hello iravelo and Harish,

    Good find Harish! 

    Yes, this board is setup to have the USBi only use SPI to talk to the DSP slave port. 

    Keep in mind that if you use the USBi and SigmaStudio to load in a program and then switch over to the Teensy you will have to power down the DSP and then power it back up. Because, once the slave port is switched over to SPI it cannot go back to using I2C without a power cycle or reset. 

    Dave T

  • hi harish, the mystery starts to vanish a bit now, thanks for the tip, so to sum up, i need to :

    • short J1's pin 1 & 7, then connect it to MCU's SCL
    • short J1's pin 3 & 5, then connect it to MCU's SDA
    • ground ADDR0 (J1's pin 8) to set I2C 7bit addr to 0x39
    • connect MCU and J1's ground and reset lines
    • pray and rescan and something should respond on addr 0x39 this time...
  • Hello iravelo,

    I would not put in the jumpers. It will not be needed. The Teensy will communicate directly using I2C. The USBi will use SPI, just do not use both at the same time. 

    If you install the jumpers then plug in the USBi it may cause a problem because the jumpers are connecting the I2C to the SPI port of the USBi. So you donot need to jumpers. 

    Dave T

  • i have a very good news : my i2c scanner app now gets some answer also from adress 0x39 ! right on point ! i've never been that far ! now we are talking. next step is read some register value...

  • hello, currently I must choose between using the PC and its usbi interface/cable, in SPI and connected to evalBoard's J1 (obviously without the jumper wires) , or use my mcu connected in I2C on same J1 but with the jumper wires

  • Hello iravelo,

    You will never need the jumper wires. Your MCU is directly connected to the SDA and SCL lines. 

    Just have the pull up resistors be located on your MCU board, and they are, so just disconnect your MCU and connect the USBi. Then disconnect the USBi and reconnect your MCU. You will have to power down when you switch so the comms port can switch between SPI and I2C mode. 

    Dave T

Reply
  • Hello iravelo,

    You will never need the jumper wires. Your MCU is directly connected to the SDA and SCL lines. 

    Just have the pull up resistors be located on your MCU board, and they are, so just disconnect your MCU and connect the USBi. Then disconnect the USBi and reconnect your MCU. You will have to power down when you switch so the comms port can switch between SPI and I2C mode. 

    Dave T

Children
  • Hello everyone,

    I'm trying something similar with a nrf52840 eval board. I would like in the end to be able to flash the ADAU1467 with my MCU using the I2C protocol.

    But for now I'm trying to follow iravelo's work. But there's a few thing I don't understand yet : 

    - What are the jumper wires that are mentionned and not useful ? the ones between pin 1&7 and pin 3&5 ?

    - Why do we have to connect the USBi first ? Is it to flash to the Dsp a short program writing a known value to a specific register and then read it through the I2C communication ?

    Have a nice day,

    Kind regards,

    William.

  • Hi there, my working solution involves these wires : gnd, scl, sda and one gpio for reset, going from mcu to dsp board; in addition, i needed 3 jumper wires : for scl , sda and to ground addr0; anything different than that , i cannot garantee it could also work