AnsweredAssumed Answered

Generate USART Tx DMA using timer expire on backend without any CPU intervention like DAC with Timer?

Question asked by Sukhdeep Singh on May 25, 2017

Hi,

      Generally i do like

Option 1)

unsigned char tmp;

unsigned char *ptr="Hello World!";

for(tmp=0;tmp<10;tmp++){

   HAL_UART_Transmit(&huart1,ptr,strlen(ptr),100);

   HAL_Delay(10);  //10ms

}

Option 2)

Start TIM2 ,which generate interrupt every 10ms.

unsigned char *ptr="Hello World!";

void TIM2_IRQHandler(void)
{
    static unsigned char tmp;

    

   HAL_UART_Transmit(&huart1,&ptr[tmp],1,100);

   if(++tmp<=strlen(ptr)){

      tmp=0;

   }
   HAL_TIM_IRQHandler(&htim2);
}

 

Is there way Above whole process goes in backend, like calling function

HAL_UART_Transmit_DMA_TIM();

As we do in DAC transfer data on output after timer update interrupt on backend.

 

How can i generate USART Tx DMA using timer expire on backend without any CPU intervention like DAC with Timer?

 

I read that there is way to do using DMA2 Memory to Memory copy using Timer. How Can i do this?

 

Please answer using HAL library template code only.

 

Thanks to ST Community.

Sukhdeep Singh

Outcomes