cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F051R8 TMER3 ISSUE

jaikrishnamail
Associate II
Posted on September 22, 2014 at 16:48

Hi..

In STM32F051R8 board, Iam using TIM3. I need to set timer interrupt for every every 10 seconds. Iam unable calculate the prescaler, CCR and time period values.

Can any one explain me please...

17 REPLIES 17
Posted on October 06, 2014 at 16:36

void T1_USART_IRQHandler(void) // ?? Is that in the vector table?

USART1_IRQHandler(void)
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
jaikrishnamail
Associate II
Posted on October 06, 2014 at 20:02

I did not specially added  the handler in veector table. For every USART interrupt, that handler was calling. That was USART interrupt handler

Posted on October 06, 2014 at 20:13

I did not specially added  the handler in veector table. For every USART interrupt, that handler was calling. That was USART interrupt handler

Ok, but I don't understand what that means. Suggest you provide a complete/concise example that fully demonstrates your issue.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
jaikrishnamail
Associate II
Posted on October 07, 2014 at 16:42

The below is some sample code... In this code the receiver timeout interrupt is not raising.....

.ExternalClass761F732276C4429EB9F90C98CF37580E p {margin-bottom:0.1in;line-height:120%;}

main()

{

GPIO_InitTypeDef

GPIO_InitStructure;

NVIC_InitTypeDef

NVIC_InitStructure;

/*clock configuaration*/

SysTick_Config(SystemCoreClock/1000);

RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG,

ENABLE

);

GPIO_PinAFConfig(USART

1

_TX_GPIO_PORT, USART

1

_TX_SOURCE, USART

1

_TX_AF);

/* Connect PXx to SC_USART_CK */

GPIO_PinAFConfig(USART

1

_CK_GPIO_PORT,USART

1

_CK_SOURCE,USART

1

_CK_AF);

/* Configure USART CK pin as alternate function push-pull */

GPIO_InitStructure.

GPIO_Pin

= USART

1

_CK_PIN;

GPIO_InitStructure.

GPIO_Mode

=

GPIO_Mode_AF

;

GPIO_InitStructure.

GPIO_OType

=

GPIO_OType_PP

;

GPIO_InitStructure.

GPIO_Speed

= GPIO_Speed_50MHz;

GPIO_InitStructure.

GPIO_PuPd

=

GPIO_PuPd_UP

;

GPIO_Init(USART

1

_CK_GPIO_PORT, &GPIO_InitStructure);

/* Configure USART

Tx

pin as alternate function open-drain */

GPIO_InitStructure.

GPIO_Pin

= USART

1

_TX_PIN;

GPIO_InitStructure.

GPIO_OType

=

GPIO_OType_OD

;

GPIO_Init(SC_USART_TX_GPIO_PORT, &GPIO_InitStructure);

SC_USART_APBPERIPHCLOCK(USART

1

_CLK,

ENABLE

);

/* Enable USART IRQ */

NVIC_InitStructure.

NVIC_IRQChannel

= USART

1

_IRQn;

NVIC_InitStructure.

NVIC_IRQChannelPriority

= 0;

NVIC_InitStructure.

NVIC_IRQChannelCmd

=

ENABLE

;

NVIC_Init(&NVIC_InitStructure);

/* USART Clock set to 4 MHz (PCLK2 (48 MHz) / 12) */

USART_SetPrescaler(USART

1

, usart_presc);

/* USART Guard Time set to 16 Bit */

USART_SetGuardTime(USART

1

, 16);

USART_ClockInitStructure.

USART_Clock

= USART_Clock_Enable;

USART_ClockInitStructure.

USART_CPOL

= USART_CPOL_Low;

USART_ClockInitStructure.

USART_CPHA

= USART_CPHA_1Edge;

USART_ClockInitStructure.

USART_LastBit

= USART_LastBit_Enable;

USART_ClockInit(SC_USART, &USART_ClockInitStructure);

/* Configure the USART

baudrate

*/

SC_USART_Baud_Config(baudrate);

/* Disable the NACK Transmission */

USART_SmartCardNACKCmd(USART

1

,

DISABLE

);

/* Enable SC_USART */

USART_Cmd(USART

1

,

ENABLE

);

USART_ITConfig(USART1,USART_IT_RXNE,

ENABLE

);

//Receiver interrupt enable

USART_ITConfig(USART1,USART_IT_PE,

ENABLE

);

//PARITY INTERRUPT ENABLE

USART_ReceiveData(USART1);

USART_Cmd(USART1,

ENABLE

);

/*Receiver time out configuaration*/

USART_ReceiverTimeOutCmd(USAR

T1

,

DISABLE

);

USART_SetReceiverTimeOut(USART1,0x2760);

USART_ITConfig(USART1, USART_IT_RTO,

ENABLE

);

USART_ReceiverTimeOutCmd(USART

1

,

ENABLE

);

while

(1);

}

/* Interrupt Hnadler*/

void USART1_IRQHandler()

{

if

(USART_GetITStatus(USART

1

, USART_IT_RTO) !=

RESET

)

{

USART_ClearITPendingBit(SC_USART, USART_IT_RTO);

printf

(

''\n\r TIMEOUT INTERRUPT \n\r''

);

}

}

Thanks in advance!

Posted on October 07, 2014 at 18:22

This doesn't seem to enable the GPIO clock, enables multiple interrupts that aren't serviced, and is insufficiently complete to compile.

.ExternalClass761F732276C4429EB9F90C98CF37580E p {margin-bottom:0.1in;line-height:120%;}
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
jaikrishnamail
Associate II
Posted on October 07, 2014 at 19:07

Yes i know.. The above code is just reference flow of code..  I had initialised GPIO CLOCK perfectly.. I just want  to know whether above mentioned receiver time out instructions are enough or Do i need to add some extra lines to enable receiver time out?

The receiver timeout instructions are at below lines of the code....

If you have any example code please post it

Thanks in advance!

Posted on October 07, 2014 at 20:09

I'm not using the STM32F0 or Smartcards, I do static analysis by sight reading. So no I don't have examples to hand, and I'm not able to rack up code in a compiler to see what the hardware does quickly/easily. The code looks reasonable enough, you'll need to do some more debugging.

.ExternalClass761F732276C4429EB9F90C98CF37580E p {margin-bottom:0.1in;line-height:120%;}
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
jaikrishnamail
Associate II
Posted on October 09, 2014 at 15:37

Ok Thankyou clive1 for your support. At last I got the solutions..