Hi,
We are using DRV8243-Q1 for motor control, and using SPI interface to communicate with DRV8243 and stm32f401re MCU. While reading and writing to the registers facing an issue. And also please clarify some of my doubts regarding communication with driver through SPI Communication.
1. what are the SPI initialization settings to be done to communicate with driver?
2. Any pins like nsleep, nfault, DRVOFF should be kept high or low for the communication to start?
3.For communicating with the driver(i.e to read and write to the registers) I Configured the SPI mode to mode 0 ,MSB first, clock at 1MHZ and 16bit frame format. Trying to read the Device_ID register, but unable to get the expected result. And using SPI HAL library.
Expected result should be 0x32 since i am using DRV8243-Q1,But I am getting 0x80 as attached the screenshot below.

The code snippet for the above read is attached below,
uint8_t R_device_id = 0b01000000;
//Read data from the DRV8243 DeviceID register
uint32_t DeviceIDRegisterAddress = R_device_id;
DeviceIDRegisterValue1 = readDRV8243Register(&hspi2,DeviceIDRegisterAddress,0x00);
//function definition for read register
uint16_t readDRV8243Register(SPI_HandleTypeDef *hspi,uint8_t regAddress,uint8_t regValue)
{
// Select the DRV8243(DRV1) by pulling CS low
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_1, 0);
// Send the register address to request data
uint16_t dataToSend = ((uint16_t)regAddress << 8) | regValue;
//HAL_SPI_Transmit(hspi,(uint8_t*)&dataToSend, 2, 100);
// Receive the data from the DRV8243
uint16_t receivedData;
HAL_SPI_TransmitReceive(hspi, (uint8_t*)&dataToSend, (uint8_t*)&receivedData, 1, 100);
// Deselect the DRV8243(DRV1) by pulling CS high
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_1, 1);
return receivedData;
}Thank you








