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

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