ATT7053CU SPI is always returning null

image

Hello everyone, i am using ATT7053CU for get current energy from device, i attachment to device but i tried everything with help of gpt3 always returning null or 0

My spi code is like

AT7053_CS_PIN = PA4

void setup() {

pinMode(AT7053_CS_PIN, OUTPUT);
digitalWrite(AT7053_CS_PIN, HIGH);
SPI_2.setMOSI(PA7);
SPI_2.setMISO(PA6);
SPI_2.setSCLK(PA5);
SPI_2.begin();
SPI_2.setDataMode(SPI_MODE0);
SPI_2.setClockDivider(SPI_CLOCK_DIV4);
SPI_2.setBitOrder(MSBFIRST);

and in loop region

digitalWrite(PA4, LOW);

// Send the byte to be written
byte dataToWrite = 0xAA;
SPI.transfer(dataToWrite);

// Take the slave select pin high to deselect the device
digitalWrite(AT7053_CS_PIN, HIGH);

// Wait a bit before reading
delay(10);

// Take the slave select pin low to select the device
digitalWrite(AT7053_CS_PIN, LOW);

// Read a byte from the device
byte dataRead = SPI.transfer(0x00);

// Take the slave select pin high to deselect the device
digitalWrite(AT7053_CS_PIN, HIGH);

// Print the data read from the device
Serial.print("Data read: ");
Serial.println(AT7053_CS_PIN, HEX);

String xy = String(dataRead,HEX);

what is problem any idea?

Post a complete wiring diagram of your setup!

Post your complete code! Use code tags!

Just a wild guess: try without that code section. Most probably the write of the register to read and the read itself must be in the same bus cycle.

What Arduino board are you using and why do you use the low level pin labels instead of the Arduino variants?