Hi Experts,
We have some question regarding drv8311.c library (from TI). In the lines 534 to 538 you read SPI values. We cannot understand, why you do this concatenation of readword1 and readword2. We would expect to find the desired data exclusively in readword2. Can you please explain the process a little more? How often do we have to read the SDO data to have the correct answer of the DRV8311?
// Read the word
readWord = SPI_readDataNonBlocking(obj->spiHandle);
readWord1 = SPI_readDataNonBlocking(obj->spiHandle);
readWord2 = SPI_readDataNonBlocking(obj->spiHandle);
readWord = ((readWord1 & 0xFF) << 8) | (readWord2 & 0xFF); //concatenate D14:D0
The second question is about the parity bit calculation in drv8311.h (from TI). At the lines 1254 to 1270 you calculate the parity bit. It seems, that the read or write bit does not count for calculating the parity bit. Is this correct? So for reading the parity is always uneven and for writing the parity is always even?
static inline DRV8311_Word_t DRV8311_buildCtrlHeader(
const DRV8311_CtrlMode_e ctrlMode,
const DRV8311_Address_e regAddr)
{
uint16_t parity = 0;
uint16_t temp = regAddr;
while(temp)
{
parity ^= (temp & 1);
temp >>= 1;
}
DRV8311_Word_t ctrlHeader = ctrlMode | (regAddr) | (parity & 1);
return(ctrlHeader);
} // end of DRV8311_buildHeader() function
Thank you.
Regards,
Archie A.