I'm trying to read registers from current-sensing chip ACS71020 connected over SPI.
This is how I initialize the SPI:
bc_spi_init(BC_SPI_SPEED_1_MHZ, BC_SPI_MODE_0);
The code for reading is such:
uint8_t tx_buffer[2]= {0x1E | 0x80 }; // Register to read with highest bit set to 1
uint8_t rx_buffer[4] = {0x01, 0x02,0x03, 0x04};
if(bc_spi_is_ready())
{
bc_spi_transfer(tx_buffer, NULL, 0);
bc_spi_transfer(NULL, rx_buffer, sizeof(rx_buffer));
bc_log_info("rx_buffer1:%d", rx_buffer[0]);
bc_log_info("rx_buffer2:%d", rx_buffer[1]);
bc_log_info("rx_buffer3:%d", rx_buffer[2]);
bc_log_info("rx_buffer4:%d", rx_buffer[3]);
}
` Is it correct to set the highest bit of the register to 1 when reading? That is how I understand the spec.
Also no matter what register I read, I always get the same four values back. Is there something I'm missing?
I'm using the Big Clown (STM32L083CZ) https://developers.hardwario.com/hardware/about-core-module