Skip to main content
Preis.1
Visitor II
November 19, 2021
Question

while(state) get stuck for ever !!!

  • November 19, 2021
  • 1 reply
  • 764 views

hi

im driving ili9341 lcd with spi1 and w25q128 with spi2 with stm32f103c8t6.

im loading some images from w25q128 to lcd via dma (peripheral to peripheral).

i should check if the last image has been sent to lcd or not before putting other images . so i used :

_Bool LCD_BUSY

before sending new data to lcd i will check it .....

but i get stuck in while loop for ever . and in debugger it says that (_Bool LCD_BUSY ) is 0 !!!

but if i put HAL_DELAY(1); in while loop it will work !

not WORKING:

while(LCD_BUSY){}

working;

while(LCD_BUSY){HAL_DELAY(1);}

This topic has been closed for replies.

1 reply

TDK
November 19, 2021

LCD_BUSY needs to be declared volatile if it is used in both an ISR and the main loop.

volatile _Bool LCD_BUSY;

"If you feel a post has answered your question, please click ""Accept as Solution""."