2016-10-22 05:16 PM
Hello folks,
Would anyone know why this does NOT work while (DMA1->ISR & DMA_ISR_TCIF1==0); //wait until transfer complete but this WORKs tc_flag=DMA1->ISR & DMA_ISR_TCIF1; //save transfer complete flag while (!tc_flag){ tc_flag=DMA1->ISR & DMA_ISR_TCIF1; //wait until transfer complete } Thank you #c2016-10-23 12:43 AM
does your compiler not give you a warnimg like mine ? eg:
src\main.c 49 warning: suggest parentheses around comparison in operand of '&' [-Wparentheses] hint: Operator Precedence2016-10-23 07:31 AM
Try
while ((DMA1->ISR & DMA_ISR_TCIF1) == 0); //wait until transfer complete2016-10-24 03:46 PM
Michael, my compiler does not give me a warning.
That worked clive1, thank you2016-10-25 12:21 AM
''Michael, my compiler does not give me a warning.''
I'm using ARM-GCC compiler not setup anything special (Em:Blocks) it doesn't give quite all issues, but is pretty good ''That worked clive1, thank you'' yes, butwhy
! how will you know to avoid this error in future, especially since your compiler is giving you any warnings !2016-10-25 01:27 AM
> yes, but
why
!> how will you know to avoid this error in future, especially since your
> compiler is giving you any warnings ! The code was valid C. There were no syntax errors. So the warning that the up-to-date compilers are giving is a courtesy.McC.Joe, my advice would be to better learn the C language, use an updated GCC version, and make sure you are telling your compiler to be verbose about the errors and warnings, something like this must be OK (I'd use -Werror too but some of ST libraries throw warnings and restrict us from using such strict but safer compiler options): -std=c99 -Wall -Wextra -Wformat -Wformat-security -Wno-missing-field-initializers -Wno-unused-function -Wno-unused-but-set-variable -fno-strict-aliasing