I am trying to interface a DAC8742 HART ic with micropython on esp32 devboard, using SPI interface. I made a basic circuit for the ic, using the schematics of DAC8742H evaluation module.
these are my spi settings:
>>> spi
SPI(id=1, baudrate=10000000, polarity=0, phase=1, bits=8, firstbit=0, sck=18, mosi=23, miso=19)
IC pin setup:
2 :- pulled up with 1M ohm resistor to 5v, final voltage - 2.3v
3 :- NC
4:- pulled up with 1M ohm resistor to 5v, final voltage - 2.3v
5:- connected to ground
6:- pulled up with 1M ohm resistor to 5v, final voltage - .9v +- .1v
7:- IO32 of esp32 board
9:- pulled up with 1M ohm resistor to 5v, final voltage - .85v
10:- pulled up with 1M ohm resistor to 5v, and connected to IO4 of esp32 as CS
11:- pulled up with 1M ohm resistor to 5v, and connected to IO18 of esp32 as CLK
12:- pulled up with 1M ohm resistor to 5v, and connected to IO23 of esp32 as MOSI
13:- pulled up with 1M ohm resistor to 5v, and connected to IO19 of esp32 as MISO
14,23 :- VCC of esp32 board, +5V
15,29,26:- GND of esp32 board
30,31:- pulled up with 1M ohm resistor to 5v, final voltage - 2.3v
I left the remaining pins open as currently I just want to interface with the IC and read it's registry data, then as a next step I will make the circuit for remaining pins and connect it to a signal source.
to read the registry i used the following command;
>>> a=bytearray([0x02,0x00,0x00]) # send this buffer
>>> b=bytearray([0x00,0x00,0x00]) # receive in this buffer
>>> spi.write_readinto(a,b)
>>> b
bytearray(b'\xff\xff\xff') # this is what I received.
NO matter what I send the received bytes are the same. I tested it with CS pin high, low and not connected, the results were same.
Please help us in understanding the issue.
reference:
micropython spi doc: https://docs.micropython.org/en/latest/library/machine.SPI.html
DAC8742H evaluation module schematics: http://www.ti.com/lit/ug/slau700a/slau700a.pdf , page-17