Tool/software: Code Composer Studio
Hello,
I would like controll the drv8301-69m kit with spi, to start and stop the motor and set the speedref value. I use an Arduino as master and the pins of the Arduino are connected to the J8 of the board (SOMI->SD-I, SIMO->SD-O, GND-GND, CLK->CLK, GPIO->GPIO(SS)). I didn't change the void HAL_setupSpiA(HAL_Handle handle) at the moment.
The problem is i don't getting any value.
In the proj_lab main i added HAL_setupSpiA(halHandle); to init the SPIA.
// variable
uint_least16_t value;
The read function is in the for-loop -> value = SPI_read(spiAHandle);
hal.c:
void HAL_setupSpiA(HAL_Handle handle)
{
HAL_Obj *obj = (HAL_Obj *)handle;
SPI_reset(obj->spiAHandle);
SPI_setClkPolarity(obj->spiAHandle,SPI_ClkPolarity_OutputRisingEdge_InputFallingEdge);
SPI_disableLoopBack(obj->spiAHandle);
SPI_setCharLength(obj->spiAHandle,SPI_CharLength_16_Bits);
SPI_setMode(obj->spiAHandle,SPI_Mode_Slave);
SPI_setClkPhase(obj->spiAHandle,SPI_ClkPhase_Delayed);
SPI_enableTx(obj->spiAHandle);
SPI_enableChannels(obj->spiAHandle);
SPI_enableTxFifoEnh(obj->spiAHandle);
SPI_enableTxFifo(obj->spiAHandle);
SPI_setTxDelay(obj->spiAHandle,0);
SPI_clearTxFifoInt(obj->spiAHandle);
SPI_enableRxFifo(obj->spiAHandle);
//not needed for slave mode SPI_setBaudRate(obj->spiAHandle,(SPI_BaudRate_e)(0x000d));
SPI_setSuspend(obj->spiAHandle,SPI_TxSuspend_free);
SPI_enable(obj->spiAHandle);
return;
} // end of HAL_setupSpiA() function
This is a pic of the register.
Are there any guides or examples to setup the SPI?
Thanks