cancel
Showing results for 
Search instead for 
Did you mean: 

std peripheral library error on stm32f207ve

bruce2399
Associate II
Posted on May 10, 2012 at 01:17

This function:  

ITStatus DMA_GetITStatus(DMA_Stream_TypeDef* DMAy_Streamx, uint32_t DMA_IT);

Does not correctly detect the interrupt status on this chip.   The interrupt status can be correctly discovered by the simple access to the register  

... ie

 tmpReg = DMA2->LISR;

   if( tmpReg &  DMA_FLAG_TCIF0 )

   { 

     DMA_ClearITPendingBit(DMA2_Stream0, DMA_FLAG_TCIF0);

   }

However, the function fails to detect the status, appearing to mask the enabled bits incorrectly (stepped through it, the interrupt is correct, the masking for whether it is enabled is not. ).  

It may work on other variations of the chip.  YMMV. 

This is probably not the right place to report bugs, but I have already wasted an hour looking for a right place for this.     

ciao

BJ

#dma-stm32f2-library-bug #!bug
1 REPLY 1
Posted on May 10, 2012 at 02:20

These functions are documented to expect an DMA_IT_TCIF0 flag not DMA_FLAG_TCIF0

Interrupt Source
----------------
1. DMA_IT_FEIFx : specifies the interrupt source for the FIFO Mode Transfer Error event.
2. DMA_IT_DMEIFx : specifies the interrupt source for the Direct Mode Transfer Error event.
3. DMA_IT_TEIFx : specifies the interrupt source for the Transfer Error event.
4. DMA_IT_HTIFx : specifies the interrupt source for the Half-Transfer Complete event.
5. DMA_IT_TCIFx : specifies the interrupt source for the a Transfer Complete event.
In this Mode it is advised to use the following functions:
- void DMA_ITConfig(DMA_Stream_TypeDef* DMAy_Streamx, uint32_t DMA_IT, FunctionalState NewState);
- ITStatus DMA_GetITStatus(DMA_Stream_TypeDef* DMAy_Streamx, uint32_t DMA_IT);
- void DMA_ClearITPendingBit(DMA_Stream_TypeDef* DMAy_Streamx, uint32_t DMA_IT);

Many of the library defines encode functionality which it later decodes, and do not explicitly represent bits in specific hardware registers directly. It's very nuanced, and you have to be careful not to assume, or blind copy other code.
Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..