Other Parts Discussed in Thread: CC1310
当COUNT数小于等于9时,CS信号会在每一个字节后拉高;大于9时,CS信号会在整个周期拉低,结束后拉高。
count=9:
SPI_init(); // Initialize the SPI driver GPIO_init(); GPIO_setConfig(Board_SPI_SLAVE_READY, GPIO_CFG_IN_PD | GPIO_CFG_IN_INT_RISING); /* install Button callback */ GPIO_setCallback(Board_SPI_SLAVE_READY, gpioButtonFxn0); /* Enable interrupts */ GPIO_enableInt(Board_SPI_SLAVE_READY); SPI_Params_init(&spiParams); // Initialize SPI parameters spiParams.transferMode = SPI_MODE_BLOCKING; // spiParams.dataSize = 8; // 8-bit data size spiParams.mode = SPI_MASTER; //SPI MASTER spiParams.frameFormat = SPI_POL0_PHA1; //SPI POL0 PHA0 spiParams.bitRate = 4000000; //4MHZ spi = SPI_open(Board_SPI0, &spiParams); if (spi == NULL) { while (1); // SPI_open() failed } while(1) { spiTransaction.count = 9; spiTransaction.txBuf = (void *)transmitBuffer; spiTransaction.rxBuf = (void *)receiveBuffer1; SPI_transfer(spi,&spiTransaction); sleep(1); }
count=10:
SPI_init(); // Initialize the SPI driver GPIO_init(); GPIO_setConfig(Board_SPI_SLAVE_READY, GPIO_CFG_IN_PD | GPIO_CFG_IN_INT_RISING); /* install Button callback */ GPIO_setCallback(Board_SPI_SLAVE_READY, gpioButtonFxn0); /* Enable interrupts */ GPIO_enableInt(Board_SPI_SLAVE_READY); SPI_Params_init(&spiParams); // Initialize SPI parameters spiParams.transferMode = SPI_MODE_BLOCKING; // spiParams.dataSize = 8; // 8-bit data size spiParams.mode = SPI_MASTER; //SPI MASTER spiParams.frameFormat = SPI_POL0_PHA1; //SPI POL0 PHA0 spiParams.bitRate = 4000000; //4MHZ spi = SPI_open(Board_SPI0, &spiParams); if (spi == NULL) { while (1); // SPI_open() failed } while(1) { spiTransaction.count = 10; spiTransaction.txBuf = (void *)transmitBuffer; spiTransaction.rxBuf = (void *)receiveBuffer1; SPI_transfer(spi,&spiTransaction); sleep(1); }