cancel
Showing results for 
Search instead for 
Did you mean: 

A bug is ST's library?

michael
Associate II
Posted on April 16, 2008 at 16:26

A bug is ST's library?

5 REPLIES 5
michael
Associate II
Posted on May 17, 2011 at 09:51

People,

please do forgive me if I'm wrong - my head hurts, have been debugging all day long and I may have found the problem!

See pevious threads related to UART interrupts. I never acknowledge the interrupt because

Code:

void UART_ClearITPendingBit(UART_TypeDef* UARTx, u16 UART_IT)

{

/* Clear the specified interrupt */

UARTx->ICR &= UART_IT;

}

does not write a 1 to acknowledge the receive interrupt if ICR is already 0 when the call occurs.

if you do this:

Code:

UART0->ICR = 0x10

the interrupt is acknowledge.

execuse me if I oversee something, I am ''kapoot'' but happy I managed to more on a little!

kais
Associate II
Posted on May 17, 2011 at 09:51

Hi,

Now I understand your issue

Well it seems you are using an old library version!

This software limitation is already corrected with library v1.2 and above.

Anyway if you want an UART example with loopback mode just tell me.

Eris.

michael
Associate II
Posted on May 17, 2011 at 09:51

hello,

thanks for your reply. no it is not fixed! this is an excerpt from version 2.0:

Code:

void UART_ClearITPendingBit(UART_TypeDef* UARTx, u16 UART_IT)

{

/* Clear the specified interrupt */

UARTx->ICR = UART_IT;

}

now this should be actually

Code:

void UART_ClearITPendingBit(UART_TypeDef* UARTx, u16 UART_IT)

{

/* Clear the specified interrupt */

UARTx->ICR |= UART_IT;

}

or not?

kais
Associate II
Posted on May 17, 2011 at 09:51

Hi,

Sorry for the late reply, in fact I’ve just seen your message!

Fore sure this software limitation is already fixed in Lib2.0

So the following peace of code works properly:

--------------------------------------------------------------------------------

void UART_ClearITPendingBit(UART_TypeDef* UARTx, u16 UART_IT)

{

/* Clear the specified interrupt */

UARTx->ICR = UART_IT;

}

--------------------------------------------------------------------------------

Moreover you have previously said that the following code solves your problems: (it matches exactly code of Lib2.0)

UART0->ICR = 0x10;

Now why we are using (UARTx->ICR = UART_IT) not (UARTx->ICR |= UART_IT)

as you have suggested?

Well because as it was written in the reference manual “writing ‘0’ has no effect in Interrupt clear register�?.

Regards,

Eris.

michael
Associate II
Posted on May 17, 2011 at 09:51

eris,

thanks for the reply. you are right, somebody else already drew my attention to this fact.