Other Parts Discussed in Thread: DCA1000EVM, , MMWAVEICBOOST
Tool/software: TI C/C++ Compiler
I want to send data from IWR6843 to PC/Raspberry Pi via SPI or I2C instead of UART. I don't have DCA1000EVM, so I need a solution without it. Please tell me
1) Which part of IWR6843 dss & mss source code can do this function? How to write code for SPI/I2C? Any reference?
2) Is there any device required to do the data transmission?
3) Currently I only have python sample code for GUI via UART, is there any source code for GUI via SPI/I2C?
Below is the code for SPI in SDK. Please explain why:
a. Chip select of slave 1 & 2 are 0xFFU (None)? Why does 0xFFU mean None?
b. MIBSPI_RAM_MAX_ELEM = 64U. But SPI hardware has an internal RAM buffer that stores transmit/receive data element in 8bits or 16bits. Why does RAM Length in bytes that used by the slave 0 can reach 64 bytes?
#include <stdint.h> #include <stdlib.h> #include <ti/drivers/spi/SPI.h> #include <ti/drivers/dma/dma.h> #include <ti/common/sys_common.h> /* Externs */ extern const SPI_Config SPI_config[]; /* Used to check status and initialization */ static int32_t SPI_count = MINUS_ONE; /* Default Master params */ const SPI_MasterModeParams SPI_defaultMasterParams = { /* Master Params */ 5000000U, /* bitRate */ 1, /* numSlaves */ 0, /* t2cDelay */ 0, /* c2tDelay */ 0, /* wDelay */ { /* Slave - 0 */ { (uint8_t)0U, /* CS0 */ (uint8_t)MIBSPI_RAM_MAX_ELEM, /* ramBufLen in number of dataSize */ { DMA_CHANNEL_NONE, /* TX DMA channel */ DMA_CHANNEL_NONE /* RX DMA channel */ } }, /* Slave - 1 - not valid */ { (uint8_t)0xFFU, /* CS_NONE */ (uint8_t)0U, /* ramBufLen in number of dataSize */ { DMA_CHANNEL_NONE, /* TX DMA channel */ DMA_CHANNEL_NONE /* RX DMA channel */ } }, /* Slave - 2 - not valid */ { (uint8_t)0xFFU, /* CS_NONE */ (uint8_t)0U, /* ramBufLen in number of dataSize */ { DMA_CHANNEL_NONE, /* TX DMA channel */ DMA_CHANNEL_NONE /* RX DMA channel */ } } } }; /* Default Slave params */ const SPI_SlaveModeParams SPI_defaultSlaveParams = { /* Slave Params */ { DMA_CHANNEL_NONE, /* TX DMA channel */ DMA_CHANNEL_NONE /* RX DMA channel */ }, 0U /* CS0 */ }; /* Default SPI parameters structure */ const SPI_Params SPI_defaultParams = { .mode = SPI_SLAVE, .pinMode = SPI_PINMODE_4PIN_CS, .dataSize = 16U, .frameFormat = SPI_POL0_PHA0, .shiftFormat = SPI_MSB_FIRST, .dmaEnable = (uint8_t)1U, .dmaHandle = (DMA_Handle)NULL, .eccEnable = (uint8_t)1U, .csHold = (uint8_t)0U, .txDummyValue = (uint16_t)0xFFFFU, .transferMode = SPI_MODE_BLOCKING, .transferTimeout = SPI_WAIT_FOREVER, .transferCallbackFxn = NULL, .custom = (uintptr_t) NULL }; /* * ======== SPI_close ======== */ void SPI_close(SPI_Handle handle) { handle->fxnTablePtr->closeFxn(handle); } /* * ======== SPI_control ======== */ int32_t SPI_control(SPI_Handle handle, uint32_t cmd, void *arg) { return (handle->fxnTablePtr->controlFxn(handle, cmd, arg)); } /* * ======== SPI_getStats ======== */ int32_t SPI_getStats(SPI_Handle handle, SPI_Stats *ptrStats) { return (handle->fxnTablePtr->getStatsFxn(handle, ptrStats)); } /* * ======== SPI_init ======== */ void SPI_init(void) { if (SPI_count == MINUS_ONE) { /* Call each driver's init function */ for (SPI_count = 0; SPI_config[SPI_count].fxnTablePtr != NULL; SPI_count++) { SPI_config[SPI_count].fxnTablePtr->initFxn((SPI_Handle)&(SPI_config[SPI_count])); } } } /* * ======== SPI_open ======== */ SPI_Handle SPI_open(uint32_t index, SPI_Params *params) { SPI_Handle handle; if ((int32_t)index >= SPI_count) { return ((SPI_Handle)NULL); } /* If params are NULL use defaults */ if (params == NULL) { params = (SPI_Params *) &SPI_defaultParams; } /* Get handle for this driver instance */ handle = (SPI_Handle)&(SPI_config[index]); return (handle->fxnTablePtr->openFxn(handle, params)); } /* * ======== SPI_Params_init ======== */ void SPI_Params_init(SPI_Params *params) { *params = SPI_defaultParams; if(params->mode == SPI_MASTER) { /* Set Master Params */ params->u.masterParams = SPI_defaultMasterParams; } else { /* Set Slave Params */ params->u.slaveParams = SPI_defaultSlaveParams; } } /* * ======== SPI_serviceISR ======== */ void SPI_serviceISR(SPI_Handle handle) { handle->fxnTablePtr->serviceISRFxn(handle); } /* * ======== SPI_transfer ======== */ bool SPI_transfer(SPI_Handle handle, SPI_Transaction *transaction) { return (handle->fxnTablePtr->transferFxn(handle, transaction)); } /* * ======== SPI_transferCancel ======== */ void SPI_transferCancel(SPI_Handle handle) { handle->fxnTablePtr->transferCancelFxn(handle); }