Other Parts Discussed in Thread: DRV8711, MSP430FR2355, DRV8711EVM
Am trying to configure DRV8711 using the launchpad MSP430FR2355 through SPI, the SPI is working fine, but when I try to read the registers of the DRV, I always get 0xFF, I made sure that the sleep pin is high and the reset pin is low, so could you help if there are any constraints or something wrong with my code?
And is there a way to know if the DRV8711 is running correctly or not?
Find the code overview as below:
--- INIT PART ---
** SPI pins init:
// SPI 3 pins
GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P4,
GPIO_PIN5 + GPIO_PIN6 + GPIO_PIN7,
GPIO_PRIMARY_MODULE_FUNCTION );
// Chip select
GPIO_setAsOutputPin(GPIO_PORT_P3, GPIO_PIN0);
** SPI clock and configuration init:
// Set Ratio and Desired MCLK Frequency and initialize DCO
CS_initFLLSettle(20000, 600);
// Set MCLK= DCO with frequency divider of 1
CS_initClockSignal(CS_MCLK, CS_DCOCLKDIV_SELECT, CS_CLOCK_DIVIDER_1);
// Set SPI config
SpiConfig.clockPhase= 32768;
SpiConfig.clockPolarity= 0;
SpiConfig.msbFirst= 32768;
SpiConfig.spiMode= 0;
SpiConfig.selectClockSource= 128;
SpiConfig.clockSourceFrequency= CS_getSMCLK();
SpiConfig.desiredSpiClock= 1000000;
EUSCI_B_SPI_initMaster(EUSCI_B1_BASE, &SpiConfig);
EUSCI_B_SPI_enable(EUSCI_B1_BASE);
** DRV pins init:
GPIO_setAsOutputPin(GPIO_PORT_P3, GPIO_PIN4);
GPIO_setAsOutputPin(GPIO_PORT_P5, GPIO_PIN2);
GPIO_setOutputLowOnPin(GPIO_PORT_P3, GPIO_PIN4);
GPIO_setOutputHighOnPin(GPIO_PORT_P5, GPIO_PIN2);
--- SEND/RECEIVE PART ---
GPIO_setOutputHighOnPin(GPIO_PORT_P3, GPIO_PIN0);
UCB1IFG &= ~UCRXIFG;
EUSCI_B_SPI_transmitData(EUSCI_B1_BASE, TxData]);
while ( !(UCB1IFG & UCRXIFG) );
RxData= EUSCI_B_SPI_receiveData(EUSCI_B1_BASE);
GPIO_setOutputLowOnPin(GPIO_PORT_P3, GPIO_PIN0);