Part Number:CC3220SF-LAUNCHXL
Hello,
I'm stuck with SPI receive issue. I've connected CC3220SF-LAUNCHXL as master and STPM34 power measurement chip board as slave.
I've tried every approach and setting I could imagine, however, nothing works and instead of MISO data I see on oscilloscope (0x2703270F) I get wrong data with MAP_SPIDataGet (0xFF8007FF). I get wrong data if I choose 8bit or 16bit SPI word size as well.
I tried exactly the same board/wires/configuration with another (non-TI) ucontroller and it works perfectly.
I checked if SPI on the CC3220SF-LAUNCHXL works by connecting it to ADC AD7490 (SPI 16bit word). It works perfectly. That means that there is no major hardware issue.
Please see code, photo from oscilloscope and UART screenshot below.
Can somebody help me please?
Thank you!
#include "common.h" #define SPI_CLK_HZ 1000000 uint32_t ultxBuf; uint32_t ulrxBuf; int main() { MAP_IntMasterEnable(); MAP_IntEnable(FAULT_SYSTICK); PRCMCC3200MCUInit(); MAP_PRCMPeripheralClkEnable(PRCM_GSPI, PRCM_RUN_MODE_CLK); MAP_PRCMPeripheralClkEnable(PRCM_UARTA0, PRCM_RUN_MODE_CLK); MAP_PRCMPeripheralReset(PRCM_GSPI); MAP_PRCMPeripheralReset(PRCM_UARTA0); MAP_PinTypeUART(PIN_55, PIN_MODE_3); MAP_PinTypeUART(PIN_57, PIN_MODE_3); MAP_PinTypeSPI(PIN_05, PIN_MODE_7); MAP_PinTypeSPI(PIN_06, PIN_MODE_7); MAP_PinTypeSPI(PIN_07, PIN_MODE_7); MAP_PinTypeSPI(PIN_08, PIN_MODE_7); MAP_SPIReset(GSPI_BASE); MAP_SPIConfigSetExpClk(GSPI_BASE, MAP_PRCMPeripheralClockGet(PRCM_GSPI), SPI_CLK_HZ, SPI_MODE_MASTER, SPI_SUB_MODE_3, (SPI_SW_CTRL_CS | SPI_4PIN_MODE | SPI_TURBO_OFF | SPI_CS_ACTIVELOW | SPI_WL_32)); MAP_SPIEnable(GSPI_BASE); init_term(); Report("Press any key to transmit data...\n\r"); MAP_UARTCharGet(UARTA0_BASE); ultxBuf = 0x18FF00FF; //Answer in RX for that expected 0x2703270F while(1) { MAP_SPICSEnable(GSPI_BASE); MAP_SPIDataPut(GSPI_BASE, ultxBuf); MAP_SPIDataGet(GSPI_BASE, (unsigned long *) &ulrxBuf); MAP_SPICSDisable(GSPI_BASE); Report("TX: %.8X ", ultxBuf); Report("RX: %.8X\n\r", ulrxBuf); } }