您好!
是否有示例说明如何在 SPI 通信中使用 DMA?
您好!
Michal
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
您好!
是否有示例说明如何在 SPI 通信中使用 DMA?
您好!
Michal
SDK 中的 SPI 驱动程序使用 DMA:
Siri.
你好。
该 SDK 似乎可以正常运行、只是存在一个问题、即 RX 缓冲区未填充任何数据。 我已使用逻辑分析器检查 MOSI 和 MISO 线路、传输正常-所有字节均已传输。
问题可能是什么?
传输的配置如下:
SPI_Transaction transaction; /* Initialize master SPI transaction structure */ transaction.count = len; transaction.txBuf = (void*)spiTempTxBuf; transaction.rxBuf = (void*)spiTempRxBuf; //buf; /* Perform SPI transfer */ bool retVal = SPI_transfer( dmaSpi, &transaction );
我使用的是 LAUNCHXL-CC1312R1。
我使用的代码直接取自示例"nvsexternal"
NVS_Handle nvsHandle;
NVS_Attrs regionAttrs;
NVS_Params nvsParams;
NVS_init();
NVS_Params_init(&nvsParams);
nvsHandle = NVS_open(CONFIG_NVSEXTERNAL, &nvsParams);
if (nvsHandle == NULL)
{
LOG( LOG_RAW, LOG_INFO, LOG_MASK_UNSPEC | LOG_MASK_PASSIVE, "memory open fail\n" );
}
/*
* This will populate a NVS_Attrs structure with properties specific
* to a NVS_Handle such as region base address, region size,
* and sector size.
*/
NVS_getAttrs(nvsHandle, ®ionAttrs);
/*
* Copy "sizeof(signature)" bytes from the NVS region base address into
* buffer.
*/
int16_t returnValue = NVS_read(nvsHandle, 0, (void *)buffer, sizeof(signature));
if( returnValue == NVS_STATUS_SUCCESS )
{
LOG( LOG_RAW, LOG_INFO, LOG_MASK_UNSPEC | LOG_MASK_PASSIVE, "Read SPI flash OK");
}
/*
* Determine if the NVS region contains the signature string.
* Compare the string with the contents copied into buffer.
*/
if (strcmp((char *)buffer, (char *)signature) == 0)
{
/* Write buffer copied from flash to the console. */
LOG( LOG_RAW, LOG_INFO, LOG_MASK_UNSPEC | LOG_MASK_PASSIVE, "%s", buffer);
LOG( LOG_RAW, LOG_INFO, LOG_MASK_UNSPEC | LOG_MASK_PASSIVE, "Erasing SPI flash sector...");
/* Erase the entire flash sector. */
NVS_erase(nvsHandle, 0, regionAttrs.sectorSize);
}
else
{
/* The signature was not found in the NVS region. */
LOG( LOG_RAW, LOG_INFO, LOG_MASK_UNSPEC | LOG_MASK_PASSIVE, "Writing signature to SPI flash...");
/*
* Write signature to memory. The flash sector is erased prior
* to performing the write operation. This is specified by
* NVS_WRITE_ERASE.
*/
NVS_erase(nvsHandle, 0, regionAttrs.sectorSize);
NVS_write(nvsHandle, 0, (void *)signature, sizeof(signature), NVS_WRITE_ERASE | NVS_WRITE_POST_VERIFY);
}恐怕我真的不明白你究竟遇到什么问题、或者我如何帮助你。
您询问有关 SPI + DMA 的信息、我已向您推荐了我们的 SPI 驱动程序。
您声称它有问题(数据没有被放入 spiTempRxBuf 中)、我询问了您的代码/您是如何使用它的、这样我就可以查看它。
然后您突然引用 nvsexternal 示例、它使用 NVS 驱动程序、您发布该示例(几乎与我们的示例相同)、但您不会说您面临什么问题。
如果您在 SPI 驱动程序方面有问题、请在我们的 LP 上发布此示例、该示例将重新创建 SPI 驱动程序问题、并说明我应该寻找什么器件(在该示例中为)。 到底哪些是不起作用的。
NVS 也是如此;
如果您在 NVS 驱动程序方面有问题、请在我们的 LP 上发布此示例、该示例将重新创建 NVS 驱动程序问题、并说明我应该查找什么内容(在该示例中)。 到底哪些是不起作用的。
我很抱歉现在不能再多帮助你了。
Siri.