2019-06-28 04:49 AM
SPI works fine if we use HAL_SPI_Receive_IT, but we are getting all 0's if we call HAL_SPI_Receive_DMA.
We are using below 2 apis
1) HAL_SPI_Transmit_DMA
2) HAL_SPI_Receive_DMA
call to HAL_SPI_Receive_DMA always read 0's. We handled D-cache as per Example.
There is errata for SPI simplex transmission, work around suggested was to hardware reset SPI peripheral before call to receive DMA.
We used macro __SPI1_FORCE_RESET(); but did not work.
Any help is appreciated.
Thanks in Advance.
2019-06-28 11:31 PM
Hi,
Perhaps this will help: https://community.st.com/s/article/FAQ-DMA-is-not-working-on-STM32H7-devices.
I had a similar problem with the ADC and DMA. I have now placed the data buffer in SRAM3. Now it works.
Scatter file:
EXEC_SRAM3 0x30040000 0x00008000 { ; SRAM3 (32kbyte)
*(.sram3)
}
C file:
__attribute__((section (".sram3")))
static uint16_t mgAdc3Buffer[ADC3_BUFFER_SIZE];
Regards
Jakob
2019-06-30 10:14 PM
Hi,
Thanks for response.
We have tried this, Problem may not be due to D-Cache handling, because we have tried same code with D-Cache disabled also.
HAL_SPI_TransmitReceive_DMA() works fine with DMA for us.
The problem start when we use HAL_SPI_Transmit() function.
problem seems due to below errata
2.12 SPI
2.12.1 Spurious DMA Rx transaction after simplex Tx trafficDescriptionWith empty RXFIFO, SPI/I2S can spuriously generate a DMA read request upon enabling DMA receive traffic (by setting RXDMAEN bit), provided that the preceding completed transaction is a simplex transmission.
Workaround : Before enabling DMA Rx transfer following a completed Tx simplex transfer, perform hardware reset of the SPI/I2S peripheral
How to implement this workaround?
2019-06-30 11:13 PM
Hi,
No idea. I'd have to get used to this myself.
Regards
Jakob
2019-07-01 03:16 AM
__HAL_RCC_SPIX_FORCE_RESET();
__HAL_RCC_SPIX_RELEASE_RESET()
can do a full hardware reset through RCC unit. After this you need to re-initialise SPI hardware.
2019-09-26 05:21 PM
Hi, I also have the same problem. Any solution?
Regards
Ari.