Other Parts Discussed in Thread: MOTORWARE,
I'm having issues bringing up the SPI-B peripheral on a custom board. This SPI channel is connected to two DRV8305s which I have removed for the time being from the board to isolate the issue.
I've got the SPI-A peripheral broken out to a pin header and have configured it according to the motorware example code for boards using the TMS320F28069 and have it working (can transmit and receive data).
Upon trying the same steps with the SPI-B peripheral, I am unable to get any useful output from the configured pins.
I am using GPIOs 13, 14 and 14 for SDO, SCLK and SDI, respectively (wanting to use 3 wire SPI and handle the CS lines myself as there will be two devices on the bus). I configure them as follows:
// SPI_SDI_B GPIO_setMode(obj->gpioHandle,GPIO_Number_24,GPIO_24_Mode_SPISIMOB); GPIO_setDirection(obj->gpioHandle,GPIO_Number_24,GPIO_Direction_Output); // unnecessary // SPI_SDO_B GPIO_setMode(obj->gpioHandle,GPIO_Number_13,GPIO_13_Mode_SPISOMIB); GPIO_setPullup(obj->gpioHandle, GPIO_Number_13, GPIO_Pullup_Disable); GPIO_setDirection(obj->gpioHandle,GPIO_Number_13,GPIO_Direction_Output); // unnecessary // SPI_CLK_B GPIO_setMode(obj->gpioHandle,GPIO_Number_14,GPIO_14_Mode_SPICLKB); GPIO_setDirection(obj->gpioHandle,GPIO_Number_14,GPIO_Direction_Output); // unnecessary
inside of the HAL_setupGpios() function.
The SPI handles are initialised as follows:
// initialize the SPI handles obj->spiAHandle = SPI_init((void *)SPIA_BASE_ADDR,sizeof(SPI_Obj)); obj->spiBHandle = SPI_init((void *)SPIB_BASE_ADDR,sizeof(SPI_Obj));
void HAL_setupSpiB(HAL_Handle handle) { HAL_Obj *obj = (HAL_Obj *)handle; SPI_reset(obj->spiBHandle); SPI_setMode(obj->spiBHandle,SPI_Mode_Master); SPI_setTriWire(obj->spiAHandle, SPI_TriWire_ThreeWire); //!!! SPI_setClkPolarity(obj->spiBHandle,SPI_ClkPolarity_OutputRisingEdge_InputFallingEdge); SPI_enableTx(obj->spiBHandle); SPI_enableTxFifoEnh(obj->spiBHandle); SPI_enableTxFifo(obj->spiBHandle); SPI_setTxDelay(obj->spiBHandle,0x0018); SPI_setBaudRate(obj->spiBHandle,(SPI_BaudRate_e)(0x000d)); SPI_setCharLength(obj->spiBHandle,SPI_CharLength_16_Bits); SPI_setSuspend(obj->spiBHandle,SPI_TxSuspend_free); SPI_enable(obj->spiBHandle); return; } // end of HAL_setupSpiB() function
I've tried copying the exact same settings as for SPI-A as well to no avail.
I have tried configuring the same GPIOs as outputs and toggling their state, which I can successfully view with an oscilloscope.
I'm really not sure why the SPI-B peripheral doesn't work when SPI-A works with the same settings. I've been careful to ensure that the initialisation routines are being called for B as well as A throughout the setup.