Part Number: BEAGLEBK
Hi,
I am having trouble from the past week trying to use SPI instance 1 on beaglebone black.
I have used the following to initialize SPI on board:
void Board_SPI_init(void) { UINT32 spi_status=0; spi_status = PRCMModuleEnable(CHIPDB_MOD_ID_MCSPI, 1 , NULL); if(S_PASS == spi_status ) { spi_status = PINMUXModuleConfig(CHIPDB_MOD_ID_MCSPI, 1, NULL); } if(spi_status) { UART_printf("\n config successful"); } SPI_HWAttrs spiCfg; SPI_socGetInitCfg(SPI1, &spiCfg); SPI_socSetInitCfg(SPI1, &spiCfg); }
I am using the following task to test my SPI:
/** * @brief Function spi_test_task : Execute read on SPI bus * * @param[in] arg0, arg1: Arguments ( Currently not used) * @retval none */ void spi_test_task(UArg arg0, UArg arg1) { appPrint("\n spi_test task started"); SPI_Params spiParams; /* SPI params structure */ SPI_Handle hwHandle; /* SPI handle */ SPI_Transaction transaction; /* SPI transaction structure */ uint32_t len=1; uint16_t txBuf, rxBuf; uint32_t count = 0; uint32_t terminateXfer = 0; bool retVal; uint32_t stat=0; stat=12; GPIO_write(0,1); Board_SPI_init(); SPI_init(); /* Default SPI configuration parameters */ SPI_Params_init(&spiParams); spiParams.frameFormat = SPI_POL0_PHA1; /* TODO: Add SPI functionality test here */ hwHandle = (SPI_Handle)SPI_open(1, &spiParams); txBuf = 0x5400; /* Test data */ len = sizeof(txBuf); transaction.txBuf = (uint16_t *) &txBuf; transaction.rxBuf = (uint16_t *) &rxBuf; transaction.count = len; transaction.arg = (void *)&terminateXfer; GPIO_write(0, 0); stat = SPI_transfer(hwHandle, &transaction); Task_sleep(10); appPrint("\n spi_test task ended"); Task_exit(); }
I am using a Analog Discovery 2 logic analyzer to observe the waveform. Screenshot shows the outputs, I am not able to see any data. Clock looks very unusual and I am driving Chip select low before transfer (as suggested for my SPI slave device - DRV88889-Q1 (also from TI). Please guide me, is there something I am missing here?
Clock keeps varying, sometimes I get only two triangular signals, other times a random sequence of triangle signals.
I am looking forward to your response.
Thank you,
Arshiya Tabassum