工具与软件:
嗨、团队:
我正在查看 spi_controller_multibyte_fifo_pol_lp_MSPM0G3507示例。 如何多于4字节的数据传输? 在 FIFO 示例中、我可以传输的最大数据字节为5字节。 为什么会这样?
#define SPI_PACKET_SIZE (8)
/* Data for SPI to transmit */
uint8_t gTxPacket[SPI_PACKET_SIZE] = {'M', 'S', 'P', '!', 'M', 'S', 'P', '!'};
/* Data received from SPI Peripheral */
volatile uint8_t gRxPacket[SPI_PACKET_SIZE];
int main(void)
{
SYSCFG_DL_init();
/* Fill TX FIFO with data and transmit to SPI Peripheral */
DL_SPI_fillTXFIFO16(SPI_0_INST, &gTxPacket[0], SPI_PACKET_SIZE);
/* Wait until all bytes have been transmitted and the TX FIFO is empty */
while (DL_SPI_isBusy(SPI_0_INST))
;
/*
* Wait to receive the SPI data
* This loop expects SPI_PACKET_SIZE bytes
*/
for (uint8_t i = 0; i < SPI_PACKET_SIZE; i++) {
gRxPacket[i] = DL_SPI_receiveDataBlocking8(SPI_0_INST);
}
/*
* If this example is used with the spi_peripheral_multibyte_fifo_poll
* example, the expected data to receive in gRxPacket is
* {0x01, 0x02, 0x03, 0x04}.
*/
/* If write and read were successful, toggle LED */
while (1) {
DL_GPIO_togglePins(GPIO_LEDS_PORT,
GPIO_LEDS_USER_LED_1_PIN | GPIO_LEDS_USER_TEST_PIN);
delay_cycles(16000000);
}
}
非常感谢
Matthew Chen