cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with the DMA datacounter of stm8l051

710733720
Associate
Posted on February 18, 2016 at 05:02

Hi,

I'm using DMA to transfer the data from USART1,The length of the data is varible.So I open the USART IDLE LINE interrupt.I try to set the DMA data counter to zero by using the function ''DMA_SetCurrDataCounter(DMA1_Channel2,0);''

But the return value of the function ''DMA_GetCurrDataCounter(DMA1_Channel2);'' doesn't change to the value i set.

So,What's the problem?

Thank U.

MCU: stm8l051f3

Board: Custom

IDE: IAR

STM8L15x/16x/05x/AL31-L Standard Peripherals Library version:V1.6.2

USART1 RX ISR function:

INTERRUPT_HANDLER(USART1_RX_TIM5_CC_IRQHandler,28)

{

    /* In order to detect unexpected events during development,

       it is recommended to set a breakpoint on the following instruction.

    */

  uint8_t temp=USART_ReceiveData8(USART1);

  temp=DMA_GetCurrDataCounter(DMA1_Channel2);

  DMA_SetCurrDataCounter(DMA1_Channel2,0);

  temp=DMA_GetCurrDataCounter(DMA1_Channel2);

  USART_ClearITPendingBit(USART1,USART_IT_IDLE);

}
0 REPLIES 0