Dear team,
The customer needs to read the 0xFA register value of the slave device, but after he write the register value (0xFA) SPI_transfer, CS is pulled high which caused the slave register value to be unable to be read. What operations need to be done to ensure that it is read correctly?
Please help.
SPI_Transaction transaction;
bool transferOK;
/* Initialize master SPI transaction structure */
memset((void *)masterTxBuffer, 0, SPI_TX_BUFF_SIZE);
masterTxBuffer[0] = reg_addr | 0x80; //0xFA
//strncpy((void *) &masterTxBuffer[1], value, len);
transaction.count = 1;
transaction.txBuf = (void *) masterTxBuffer;
transaction.rxBuf = (void *)value;
/* Perform SPI transfer */
transferOK = SPI_transfer(masterSpi, &transaction);
if (!transferOK) {
Display_printf(display, 0, 0, "1spi_read_reg Unsuccessful master SPI transfer");
return -1;
}
