2012-07-20 05:49 AM
Hi everyone I'm also trying to do an encoder control unit with stm32f4 discovery using of the standard periphberal libriaries and I have two problems.
1-) When I want to build codes, there is an error occuring which is ; Error : L6218E : Undefined symbol assert-param (referred from misc.o) after that problem I researched about this error with it's Error Number and I found something. The answer of my problem was USE_STDPERIPH_DRIVER definition (at 'Configure Flash Tools' => 'C/C++' => 'Define' ). Then I applied it to my project but another error occured. I added second error's pic and project files. Thanks.2012-07-25 07:26 AM
Hard to say, the problem isn't in the code presented, but could relate to the vector table, or how you have initialized the peripherals. ZIP up an example project, I'll take a look.
As for priority, the only time the sub-priority matters is the instant that both interrupts are asserted together (within the context setup), and the processor decides which to handle first. If you want one to interrupt the other you'll need to play with the preemption level.2012-07-25 07:58 AM
in misc.c, start line 159 end line Why enable and disable selections are doing the same operations? Or am I wrong?
void NVIC_Init(NVIC_InitTypeDef* NVIC_InitStruct) { . ... ... ... ... NVIC->IP[NVIC_InitStruct->NVIC_IRQChannel] = tmppriority;/* Enable the Selected IRQ Channels --------------------------------------*/
NVIC->ISER[NVIC_InitStruct->NVIC_IRQChannel >> 0x05] = (uint32_t)0x01 << (NVIC_InitStruct->NVIC_IRQChannel & (uint8_t)0x1F); } else {/* Disable the Selected IRQ Channels -------------------------------------*/
NVIC->ICER[NVIC_InitStruct->NVIC_IRQChannel >> 0x05] = (uint32_t)0x01 << (NVIC_InitStruct->NVIC_IRQChannel & (uint8_t)0x1F); } } ________________ Attachments : STM32F4xx_StdPeriph_Templates.rar : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Hzmb&d=%2Fa%2F0X0000000bQ4%2FSwL3sFAhNls9gwG_9U7kEqm.1GjndcSdgpqEEUx7DX4&asPdf=false2012-07-25 08:51 AM
One uses a SET register, the other a CLEAR register, which operate bitwise on the actual register.
2012-07-25 10:28 AM
void TIM2_IRQHanler (void)
{
TIM_ClearFlag(TIM2, TIM_FLAG_Update);
GPIO_WriteBit(GPIOD, GPIO_Pin_15, Bit_SET);
delayxs(200000);
GPIO_WriteBit(GPIOD, GPIO_Pin_15, Bit_RESET);
delayxs(200000);
}
This needs to be TIM2_
Handler() for the name to match the one in the vector table. The other code doesn't look unreasonable, but I've not used encoder mode, or checked the TIM2 pins.
2012-07-25 12:11 PM
I saw it, thank you clive1. Not hanler I had to write handler :S counter is counting correctly but I wrote int routine wrongly. I started to do the same thing which is wrong writing I'm sorry to loaf something away to you. I'm going to try it afternoon of tomorrow now I'm studying to my tomorrow morning's exam. Thanks to you again clive1.
2012-08-01 05:24 AM
It's working well. Thank you clive1
2012-08-10 06:38 AM
I'm trying to measure encoders speed (x2-x1)/T or X/(t2-t1) but Timer 6 is not counting true. Psc = 9999, Arr = 83, RCR = 0 , My event rate(period) is ;
EP = (84MHz)/[(10000)*(84)*(1)] = 100 Hz I want to read encoder's pulses per by 10ms but it's always interrupting at every (1,4 MHz) 0,7us. I wrote to PSC=65535, ARR=839, RCR=0 it is still same.... (I found it thank you for everyone :) )2015-10-14 01:46 AM
clive1's links from July 2012 now seem to be broken; try these:
AN3988 Application note, ''Clock configuration tool for STM32F40xx/41xx/427x/437x microcontrollers''http://www.st.com/web/en/resource/technical/document/application_note/DM00039457.pdf
STSW-STM32091 ''Clock configuration tool for STM32F40x/41x microcontrollers''(AN3988)http://www.st.com/web/en/catalog/tools/PF257927
But note that this is all now deprecated by ST - superseded by:http://www.st.com/web/en/catalog/tools/PF259242
STM32Cube initialization code generator (UM1718)