Part Number: DAC81404
I want to test the digital interface (SPI) btw MCU/STMF411 and 81404.
One way to make sure SPI works as expected is to read device ID from it.
According to data sheet, two communication cycles are needed to read register value, provided that SDO-EN bit is set in SPICONFIG register, which I did.
Here is my code to read device ID:
a_SPI2_RxBuf[0] = 0; a_SPI2_RxBuf[1] = 0; a_SPI2_RxBuf[2] = 0; /* 1st cycle to send read command */ // Device ID Reg Address: 0x01; highest bit 1 for reading. a_SPI2_TxBuf[0] = 0x80 + 0x01; Dac81404_CS_Low(); ... // SPI DMA code to tx/rx 3 bytes Dac81404_CS_High(); /* 2nd cycle to receive */ Dac81404_CS_Low(); ... // SPI DMA code to tx/rx 3 bytes Dac81404_CS_High();
My problem is the 3 received bytes are not as expected: supposed to be 0x81, 0x0A60 (0x0298 << 2).
What I got are: 0x40, 0x8538.
My SPI code is working well because I have managed to use it to change the voltage output for a long time.
Only recently did I want to use it receive.