/var/www/restricted/ssh/stm32/www/stm32circle/ STM CircleOS forum / Rbprimer on Primer2

Username:     
Password:     
             

Forum

# 1   2010-09-06 16:36:56 Rbprimer on Primer2

vikram846
New member
Registered: 2010-08-25
Posts: 9

Rbprimer on Primer2

Hi,

I am trying to run the Rbprimer on Primer 2.

When downloaded and run as such I get a lot of Tim1_ ... errors.

I removed a lot of these errors after including "stm32f10x_tim1.h

now I get

C:\Users\Vik\Desktop\RbPrimer-1[1].0\rprj\objrelease\RbPrimer.o: In function `InitHardware': 
C:\Users\Vik\Desktop\RbPrimer-1[1].0\rprj/RbPrimer.c:640: undefined reference to `TIM1_DeInit' 
C:\Users\Vik\Desktop\RbPrimer-1[1].0\rprj/RbPrimer.c:647: undefined reference to `TIM1_TimeBaseInit' 
C:\Users\Vik\Desktop\RbPrimer-1[1].0\rprj/RbPrimer.c:659: undefined reference to `TIM1_OC1Init' 
C:\Users\Vik\Desktop\RbPrimer-1[1].0\rprj/RbPrimer.c:664: undefined reference to `TIM1_OC2Init' 
C:\Users\Vik\Desktop\RbPrimer-1[1].0\rprj/RbPrimer.c:667: undefined reference to `TIM1_Cmd' 
C:\Users\Vik\Desktop\RbPrimer-1[1].0\rprj/RbPrimer.c:670: undefined reference to `TIM1_CtrlPWMOutputs' 
collect2: ld returned 1 exit status 
 
Build failed



Can anyone help me with this?

Thanks in Advance

Offline

 

# 2   2010-09-06 21:20:47 Rbprimer on Primer2

Pierre
Member
Registered: 2007-10-02
Posts: 19

Re: Rbprimer on Primer2

Hello,

I'm sorry, Rbprimer works with the primer 1 hardware and the "old" circleOS.  "TIM1_DeInit" function is not any more part of the hardware library use by the last version of circle OS (it's same problem for the "TIM1_Cmd" function). I'm not try to port rbprimer on new primer2, but I think so you need to remove the "TM1_DeInit" and try to replace "TIM1_Cmd" by the "TIM_Cmd(TIM1, ENABLE)" function.

tell me if is work after these modifications.

Best regards,
Pierre

Offline

 

# 3   2010-09-07 04:31:31 Rbprimer on Primer2

vikram846
New member
Registered: 2010-08-25
Posts: 9

Re: Rbprimer on Primer2

Hi Pierre,

Rbprimer is a neat concept!! Congrats on your prize!! and thanks for your tip.
Should I still use stm32f10x_tim1.h ?
I tried what u told me, Tim_DeInit(TIM1) and Tim_Cmd(TIM1,ENABLE).

I also had to increase the memory to 128k by changing the circle_app.ld file

It works!!! except for the OC1 init and CtrlPWMOuputs.

How should I replace TIM1_OC1Init ? & TIM1_CtrlPWMOutputs ? How do I bypass the wrong MCU device error  when I transfer the program from RIDE  to primer 2 ?(Does this come because this is a Primer 1 program ?)

Thanks Again,
Vik.

Offline

 

# 4   2010-09-08 06:22:57 Rbprimer on Primer2

yrt
Administrator
From: Grenoble-France
Registered: 2008-06-11
Posts: 520
Website

Re: Rbprimer on Primer2

To avoid the wrong MCU device error, you have to change the processor in the Ride project.
Change the parameter "Advanced ARM options\Processor\Device" to STM32_Primer2_CircleOS.

Offline

 

# 5   2010-09-08 22:10:51 Rbprimer on Primer2

Pierre
Member
Registered: 2007-10-02
Posts: 19

Re: Rbprimer on Primer2

Hello Vik,

Thank very much for your comment.
About your problem, to create a PWM on a output, maybe you could try to use the code below (just by example on TIM3):

//-----------------------definition-------------------------------------
TIM_TimeBaseInitTypeDef  TIM_TimeBaseStructure;
TIM_OCInitTypeDef  TIM_OCInitStructure;
//--------------------config time base-------------------------------
TIM_TimeBaseStructure.TIM_Period = 1000;
TIM_TimeBaseStructure.TIM_Prescaler = PrescalerValue;
TIM_TimeBaseStructure.TIM_ClockDivision = 0;
TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;
TIM_TimeBaseInit(TIM3, &TIM_TimeBaseStructure);
//----------------create PWM on channel 1------------------------
TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_PWM1;
TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable;
TIM_OCInitStructure.TIM_Pulse = 500;
TIM_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_High;
TIM_OC1Init(TIM3, &TIM_OCInitStructure);
TIM_OC1PreloadConfig(TIM3, TIM_OCPreload_Enable);
//----------------------enable PWM---------------------------------
TIM_Cmd(TIM3, ENABLE);

Best regards,
Pierre

Offline

 

# 6   2010-09-09 04:10:55 Rbprimer on Primer2

vikram846
New member
Registered: 2010-08-25
Posts: 9

Re: Rbprimer on Primer2

Thanks yrt and Pierre. I am now able to achieve my pwm output.

Offline

 

Board footer