cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F3 Discovery next steps?

don23
Associate II
Posted on December 13, 2012 at 04:35

Hi,

I successfully setup IAR 6.5 and got the F3 Discovery Bd. demo working along with modifying the code to change the LED timing. I read through UM5170 User Manual. I'm looking for more examples to learn about the peripherals. So, I downloaded the AN4157 firmware examples. This includes brief descriptions of each peripheral but not the tutorials to work them.

I also found examples with, ''This example has been tested with STMicroelectronics STM32303C-EVAL (STM32F30x)  evaluation board and can be easily tailored to any other supported device and development board.'' However, it doesn't explain How to do this.

Since I'm new to ARM and 32F3, I would appreciate what next steps to learn this platform.

Thanks!

#stm32f3-iar #adc #discovery-board #:-discovery-board-stm32f3
53 REPLIES 53
Posted on September 17, 2013 at 18:18

I spent a lot of time to debug but no success, can you please help me on this. I m working with STM32f3 discovery.

I'm not using F3 parts, and can't afford to spend any time on them.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
hilwan
Associate II
Posted on September 17, 2013 at 18:21

Ok understand. I hope that someone else would have the answer.

Any case thank you and I'll continue to resolve the problem.

frankmeyer9
Associate II
Posted on September 18, 2013 at 16:37

There is an ''ADC_DualMode'' example in the STM32F30x_DSP_StdPeriph_Lib, as found on the ST website, which employs the ADC with DMA.

I think you can take this example as template for your code.

Posted on September 19, 2013 at 06:05

The original post was too long to process during our migration. Please click on the provided URL to read the original post. https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I6nJ&d=%2Fa%2F0X0000000bvb%2FfSgjK_cHIXpcsfVhiuoLQj1nC_3zRbhEDys5_JoHBG0&asPdf=false
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
hilwan
Associate II
Posted on September 20, 2013 at 12:46

Thanks clive1, your code is similar to what i'm looking for.

But i still have some remarks and questions.

First off all, to configure the ADC clocks you put :

1) RCC_ADCCLKConfig(RCC_ADC12PLLCLK_Div1); that's mean that the ADC is clocked is derived from the PLL Clock (72Mhz in this case). In the same time  ADC_CommonInitStructure.ADC_Clock = ADC_Clock_AsynClkMode;

So based on the data sheet, with this configuration has the advantage to reach the maximum of the ADC clock but it's not synchronized with the AHB clock. but we should  use the AHB clock to drive the ADC in order to use timers to trigger the ADC.

This is way i make some modification, but i don't know if is correct;

/* Configures the AHB clock (HCLK) ***/

      RCC_HCLKConfig(RCC_SYSCLK_Div1); // RCC_AHB_Clock_Source( 72MHz in this case ).

then : ADC_CommonInitStructure.ADC_Clock = ADC_Clock_SynClkModeDiv4; // this gives us 18 MHz.

I have a question about how to read from ADC12DualConvertedValue [SAMPLES * 2]?i put :

     ADC1ConvertedVoltage= ADC12DualConvertedValue[0] *2960/0xFFF;

     ADC2ConvertedVoltage= ADC12DualConvertedValue[1] *2960/0xFFF;

2) Timer : Timer 2 uses the ABP1 clock,so its clock is 36 MHz if TIM_Prescaler=0.

TIM_TimeBaseStructure.TIM_Period = (SystemCoreClock / 50) - 1; // 25Hz Sample Rate and not 50, because SystemCoreClock =72Mhz.

3) void DMA1_Channel1_IRQHandler(void)

// 2 Hz

: i Don't understand how you compute 2Hz.

Thanks in advance

Posted on September 20, 2013 at 16:21

1) I'll have to look at that some more, I suspect it just adds some additional delay while resynchronizing the already synchronous signals.

The low 16-bit word is for ADC1, the high 16-bit word is for ADC2, the secondary buffer has ADC3 and ADC4.

2) No, I really think it will be clocking at 72 MHz, you should review the ''Clock Tree'' in the reference manual, and observe the routing of the TIMCLK. These can be, are typically are, APBCLK * 2 on the slower buses.

3) 25 Samples at 20 ms (50 Hz) will occur every 500 ms (2 Hz)
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
hilwan
Associate II
Posted on September 20, 2013 at 17:48

response to 1) So in this case

volatile uint16_t ADC12DualConvertedValue[SAMPLES * 2] be

should

volatile uint32_t ADC12DualConvertedValue[SAMPLES * 2] no?  And my variables become:   ADC1ConvertedValue = (ADC12DualConvertedValue[0] & 0xFFFF);  ADC1ConvertedVoltage = ADC1ConvertedValue *2960/0xFFF;  ADC2ConvertedVoltage= ((ADC12DualConvertedValue[0] & 0xFFFF0000) >>16); ADC2ConvertedVoltage = ADC2ConvertedValue *2960/0xFFF; 

what would happen if we put ADC_InitStructure.ADC_ContinuousConvMode = ADC_ContinuousConvMode_Enable; ? instead of ADC_InitStructure.ADC_ContinuousConvMode=ADC_ContinuousConvMode_Disable; */// Triggered 

Posted on September 20, 2013 at 19:11

No, I want to access them as 16-bit values, the DMA is filling them in pairs (32-bit), and why the 16-bit array is twice the number of samples. The compiler doesn't have to treat them as 32-bit, it's just memory. It fills 100 bytes in 500 ms, be that 25x 32-bit or 50x 16-bit.

ADC12DualConvertedValue[0] ADC1 Sample 1

ADC12DualConvertedValue[1] ADC2 Sample 1

ADC12DualConvertedValue[2] ADC1 Sample 2

ADC12DualConvertedValue[3] ADC2 Sample 2

..

ADC34DualConvertedValue[0] ADC3 Sample 1

ADC34DualConvertedValue[1] ADC4 Sample 1

ADC34DualConvertedValue[2] ADC3 Sample 2

ADC34DualConvertedValue[3] ADC4 Sample 2

..

Well if you have it in continuous mode it's just going to jam results as quickly as it can. Usually I'm more concerned about the time domain, and getting the sample at a specific time/rate.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
hilwan
Associate II
Posted on September 23, 2013 at 10:42

Ok, thank you very much clive1,I'll take in considerations all your helpful suggestions and remarks; I'll give you i feedback when the code will be tested.

 

hilwan
Associate II
Posted on September 23, 2013 at 15:17

when I put ADC_InitStructure.ADC_ContinuousConvMode = ADC_ContinuousConvMode_Enable; LED3 stays on (but don't blink)  and LED4 stays off. do you have an idea why ?

In other hand, in debug mode, the CDR registers contain value even if the analog inputs are disconnected, so we always have converted value! this is because the CMOS level ?