2014-03-13 03:45 AM
Hallo together,
I want to use Timer 1 to capture a logic high input at Pin A9 and to create an output signal at Pin A10.I have written the following code which is derived from an STM32F10x example.I do not get any output signal at PA10.Would be nice if someone could tell me what is wrong with my code!Thanks in advance.Code can be seen attached in Tim_13_3.txtAdditional questions:In the end I want to produce 2 pulses where the duration of the first one is dependent on a changing value and the second pulse is fixed. The delay between the first and second pulse is also fixed. Do you know any possibility except the delay function how this double pulse could be built up with high precision (+/- 0.5 microseconds)?Thank you,Best regards, Patrick #f4-!=-f12014-03-13 06:30 AM
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AN;
Pick ONE, preferably the one that doesn't turn off the schmitt trigger for the digital input path.2014-03-13 09:20 AM
Hi,
I have changed it to:GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9;GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;GPIO_Init(GPIOA, &GPIO_InitStructure);but it still does not work!2014-03-13 09:32 AM
GPIO_InitTypeDef GPIO_InitStructure;
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9 | GPIO_Pin_10;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
GPIO_Init(GPIOA, &GPIO_InitStructure);
/* Connect TIM1 pins to AF */
GPIO_PinAFConfig(GPIOA, GPIO_PinSource9, GPIO_AF_TIM1); // TIM1_CH2
GPIO_PinAFConfig(GPIOA, GPIO_PinSource10, GPIO_AF_TIM1); // TIM1_CH3
2014-03-14 05:47 AM
Hi,
I also had to change TIM_OC1Init(TIM1, &TIM_OCInitStructure); to TIM_OC3Init(TIM1, &TIM_OCInitStructure); and now it works. I have added the finished file and try to go on with the next pulse! Thank you Clive!!! ________________ Attachments : One_Pulse_14_03_14.txt : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Hzrb&d=%2Fa%2F0X0000000bRL%2F9MbbSaeSQQGDFTAx8X9r8X1P730BKnzZrTqp9JfSikY&asPdf=false