I'm using a STM32F4 and its SPI to talk to a 74HC595 like in this tutorial. Difference is for starters I'm using the non-DMA version for simplicity. I used STMCubeMX to configure SPI and GPIO
Issue is: I'm not getting the latch PIN, that I set to PA8 to toggle during transmission fast enough.
The code I'm using:
spiTxBuf[0] = 0b00000010;
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_8, GPIO_PIN_RESET);
HAL_SPI_Transmit(&hspi1, spiTxBuf, 1, HAL_MAX_DELAY);
// while(HAL_SPI_GetState(&hspi1) != HAL_SPI_STATE_READY);
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_8, GPIO_PIN_SET);
HAL_Delay(1);
Things I tried:
Set the Maxium Output Speed of the Pin PA8 to Very Fast
Wait for the SPI to be done (see commented line above)
- Use DMA for the SPI as in here, that made it actually slower.
How do i get that to toggle faster? Should i create and interrupt for when the SPI is done and set the latch there?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…