2019-12-16 02:59 PM
I have been banging my head against the wall for days on this one. I'm using STM32CubeIDE 1.1.0. I create a simple project with a SPI interface and DMA. I'm attaching the full project. I call one function:
MX_GPIO_Init();
MX_USART2_UART_Init();
MX_SPI2_Init();
MX_DMA_Init();
/* USER CODE BEGIN 2 */
__enable_irq();
uint8_t buf[164];
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_12, RESET);
HAL_SPI_Receive_DMA(&hspi2, buf, 164);
//HAL_SPI_TransmitReceive_DMA(&hspi2, buf, buf, 10);
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_12, SET);
To transfer 164 bytes. Nothing happens. The CS is not set in the correct state and not data is transfered. What an I doing wrong?
I've attached a capture from a logic analyzer, there is no traffic and the CS is not in the correct state.
I've tried using software controlled CS, but that does nothing. Is SPI DMA broke on STM32F401s?
2019-12-16 03:52 PM
My advice would be to start from included in Cube_FW examples.
I am not sure about the rest of you program but MX_DMA_Init() should be right after MX_GPIO_Init().
Why? Because MX_DMA_Init() starts DMA clock and without this clock any write to DMA registers has no results.
Regards,
Pawel