AnsweredAssumed Answered

USART missing characters stm32f10x

Question asked by mohamadi.parisa on Mar 7, 2017
Latest reply on Mar 8, 2017 by KIC8462852 EPIC204278916

Hi,

Here is my transmission code:

 

void USART1_IRQHandler(void){
  if (USART_GetITStatus(USART1, USART_IT_TXE) != RESET){
        if(Counter<=65 && TX==1){

            if(MESSAGE[Counter]=='\0'){
            USART_ITConfig(USART1, USART_IT_TXE, DISABLE);
            TX=0;
            Counter=0;
            return;
            }            

            USART_SendData(USART1,MESSAGE[Counter]);        
            Counter=Counter+1;             
  }
        else
        {
            USART_ITConfig(USART1, USART_IT_TXE, DISABLE);
        }
}
}

 

Before Enabling USART Transmission flag I set

    sprintf(MESSAGE,"ABCDEFGHIJKLMNOPQRSWXVZ0123456789>!>!>Hello The world<!<!<\n\r");

   TX=1;

Counter=1;

 

However in receiver device I get several strings like these:

As you can see I missed one of my sending string.Actually I have changed delay between each string and USART baudrate but it shows me the same result. why did I miss some strings during transmission?

In addition, when I remove interrupt subroutine and send string directly with a simple loop it works better.

1)what is my mistake?

2)would it possible to decrease error with using DMA?

 

Thanks

Outcomes