Unable to get SPI slave working with DMA controller with CRC enabled
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-03-31 5:11 AM
Posted on March 31, 2016 at 14:11
The original post was too long to process during our migration. Please click on the attachment to read the original post.
This discussion is locked. Please start a new topic to ask your question.
3 REPLIES 3
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-03-31 5:53 AM
Posted on March 31, 2016 at 14:53
The following change in the HAL-layer seems to solve the problem:
HAL_StatusTypeDef HAL_SPI_TransmitReceive_DMA(SPI_HandleTypeDef *hspi, uint8_t *pTxData, uint8_t *pRxData, uint16_t Size)
{
.
.
.
hspi->pTxBuffPtr = (uint8_t*)pTxData;
hspi->TxXferSize = Size;
hspi->TxXferCount = Size;
hspi->pRxBuffPtr = (uint8_t*)pRxData;
hspi->RxXferSize = Size;
hspi->RxXferCount = Size;
.
.
.
}
status = HAL_SPI_TransmitReceive_DMA(&hspi2, transmitDMAbuffer, receiveDMAbuffer, DMA_RECEIVE_BUFFER_SIZE);
HAL_StatusTypeDef HAL_SPI_TransmitReceive_DMA(SPI_HandleTypeDef *hspi, uint8_t *pTxData, uint8_t *pRxData, uint16_t TxSize, uint16_t RxSize)
{ . . . hspi->pTxBuffPtr = (uint8_t*)pTxData; hspi->TxXferSize = TxSize; hspi->TxXferCount = TxSize; hspi->pRxBuffPtr = (uint8_t*)pRxData; hspi->RxXferSize = RxSize; hspi->RxXferCount = RxSize; . . . } status = HAL_SPI_TransmitReceive_DMA(&hspi2, transmitDMAbuffer, receiveDMAbuffer, DMA_RECEIVE_BUFFER_SIZE, DMA_RECEIVE_BUFFER_SIZE + 1);Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-03-31 6:58 AM
Posted on March 31, 2016 at 15:58
I guess I was too quick to conclude that it was working. If I run several times this is what I get:
1st attemp: Everything ok.2nd attempt: The received data is correct, but I get a CRC error and I never get a SPI_DMATransmitReceiveCplt interrupt on the transmit DMA stream (stream 4).3rd attemp: This starts with an interrupt from the receive DMA stream (stream3), but no interrupt flag is set. Everything else is ok.4th attempt: The received data is correct. but I never get a SPI_DMATransmitReceiveCplt interrupt on the transmit DMA stream (stream 4).5th attempt: This starts with an interrupt from the receive DMA stream (stream3), but no interrupt flag is set. Everything else is ok.Anybody know what's wrong?Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-04-04 9:00 AM
Posted on April 04, 2016 at 18:00 The original post was too long to process during our migration. Please click on the provided URL to read the original post. https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I6de&d=%2Fa%2F0X0000000bsH%2FBGRMTlN2GYK2juCdvM2pe9vUzCzitjb6tYvHwEsqK8s&asPdf=false
