unexpected GPIO behavior
- May 14, 2021
- 16 replies
- 5428 views
Hi ST community,
I am interrested in using the STM32F767-Nucleo board for SPI communication. My system is as follows. I have one STM32F767-Nucleo board which is my SPI slave and a Raspberry Pi which acts as SPI master device. The Raspi should read data via SPI from the Nucleo board. There is also one wire which is used from the Nucleo board to tell the Raspi when data is ready to be read. So every time data is ready the STM32 toggles this GPIO pin and the Raspi gets an interrupt and forces a read command.
Now my problem is not the SPI communication, no this works very well. The problem is the GPIO pin which forces interrupts at the Raspi and after that SPI read commands for the STM32. After some time of working properly the GPIO pin does nothing for about 400ms to 500ms and I don't know why this happens (see picture GPIO_stop_working.png) .
I use the DMA to transfer data from the memory to the SPI peripheral. If timer 3 generates an Interrupt (this happens every 100ms) HAL_TIM_PeriodElapsedCallback will be called. In the callback function I toggle GPIO pin PG2 which is the wire that tells the Raspi data are ready to be read. If the first timer interrupt occurs the STM32 will send only one number and after that at every timer interrupt data gets sent with HAL_SPI_Transmit_DMA.
My first idea was maybe the Raspi causes this discrepancy at GPIO PG2 but I replaced it with antother STM32F767-Nucleo board which has the same task as the Raspi and the same problem occurs. Therefore I think the problem is at the side of the Nucleo board and not the Raspi.
ps: The code from the STM32 is in the first reply of this post.
-Lukas
