Chip: STM32H750XBH6
DMA Config
Mode: Circular
Data Width: Byte/Byte
No Sync/Event used
SPI Config:
Mode: Slave with hardware SS Input
Frame Format: Motorola
Data Size: 8Bits
Other configs are default.
Here I encountered a strange problem.
Code: Select all
//This is the definition of the DMA Buffers
uint8_t pTX[8];
uint8_t pRX[8];
Code: Select all
//in "setup" function, I use this function to start SPI with DMA
HAL_SPI_TransmitReceive_DMA(&hspi2, (uint8_t *)pTX, (uint8_t *)pRX, 8);
After I change the definition of pTX and pRX to the following code, data appears in pRX[0] ~ pRX[7] (DMA transfers data) and the data is exactly what I send.
Code: Select all
uint8_t pTX[16];
uint8_t pRX[16];
Because I try to force the variable at the same memory address in CubeIDE as the address in Arduino, everything works fine.
I've tested that when X is between 8 to 12, DMA won't transfer. And when X is equal to or larger than 13, data present in pRX.
Code: Select all
uint8_t pTX[X];
uint8_t pRX[X];
Sometimes it can work after I exchange the definition of pTX and pRX.
Code: Select all
uint8_t pRX[8]; //was pTX
uint8_t pTX[8]; //was pRX
Well, my brain keeps exploding for several days

I'd appreciate it very much if someone could save me from this hell.
