libopenstm32-devel Mailing List for libopenstm32 (Page 7)
Status: Inactive
Brought to you by:
uh1763
You can subscribe to this list here.
2010 |
Jan
(10) |
Feb
(8) |
Mar
(27) |
Apr
(2) |
May
(16) |
Jun
(1) |
Jul
|
Aug
(2) |
Sep
(4) |
Oct
(11) |
Nov
(3) |
Dec
(11) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2011 |
Jan
(18) |
Feb
(17) |
Mar
(5) |
Apr
(2) |
May
|
Jun
(4) |
Jul
(20) |
Aug
(1) |
Sep
(4) |
Oct
(3) |
Nov
(1) |
Dec
|
From: Thomas O. <to...@vi...> - 2010-03-04 20:51:05
|
Hi, I wrote some ADC functions/definitions and corrected some definitions. Patch attached. cu Tommi |
From: Uwe H. <uw...@he...> - 2010-03-01 23:58:42
|
Hi, On Sun, Feb 28, 2010 at 11:09:14PM +0100, Thomas Otto wrote: > I wrote some I2C functions today. These are a basic set only, but i have > successfully spoken to a temperature sensor from ST in master tranciever > mode with them. Nice! Merged with some small changes, thanks! Uwe. -- http://www.hermann-uwe.de | http://www.randomprojects.org http://www.crazy-hacks.org | http://www.unmaintained-free-software.org |
From: Thomas O. <to...@vi...> - 2010-02-28 22:09:32
|
Hello, I wrote some I2C functions today. These are a basic set only, but i have successfully spoken to a temperature sensor from ST in master tranciever mode with them. They are needed for configuring mostly. I will add some functions the next days and give you a running example. Patch is attached. Best regards, Thomas Otto |
From: Thomas O. <to...@vi...> - 2010-02-28 12:51:36
|
Hello, I had 2 problems with the function gpio_set_mode(). 1. it generally sets the submited config to the mentioned gpio-pins but kills configs for other pins on the same gpio port. So if i want to set PB6 and PB7 to push-pull and I2C2 SDA and SCL (PB10 and PB11) to open drain its simply impossible, because the second config try kills the first. 2. the floating-bit thing isnt working correctly. if i enable a config for PB6 for instance the same config will also apply to all following pins of that port (aka PB7-PB15). Thats because the shifting isnt only done if a pin isnt to configure, if you are hitting a matching bit the shiftig is missing. I think shifting isnt nessessary for a separate variable. We have the counting index from the for statement. so I've rewritten the function a little bit to address these problems. Patch is attached. Best regards, Thomas Otto |
From: Thomas O. <to...@vi...> - 2010-02-28 09:42:07
|
Reference manual 0008 - starting from page 77 especially figure 8. If you look at the ST examples you will also see the recommended way of waiting after clock initialization. And i have done many tests here. If you try it with an external 16MHz crystal you will kicked back to the internal HSI if you omit the waiting after rcc_osc_on(HSE). One little error in my code: the comment rcc_set_adcpre(ADCPRE_PLCK2_DIV8); //prescales the ADC from the AHB clock; max 14MHz is wrong. Instead the ADC prescales its clock from APB2 (see figure 8). And funny to see... I have 2 48Pin stm32 here. One which run at 36mhz with 0WS and the other one needs 1WS. 8-) it seems that your stms runs also stable with 0WS at 36MHz. Best regards, Thomas Otto Am Sonntag, den 28.02.2010, 01:22 +0100 schrieb Uwe Hermann: > On Sat, Feb 27, 2010 at 06:41:42PM +0100, Thomas Otto wrote: > > see patch. > > Thanks, merged. > > Will look at the clock stuff tomorrow or so. Is there a special appnote > about clock setup somewhere or did you get that info from the reference > manual? > > Thanks, Uwe. |
From: Uwe H. <uw...@he...> - 2010-02-28 01:28:58
|
On Sat, Feb 27, 2010 at 06:41:42PM +0100, Thomas Otto wrote: > see patch. Thanks, merged. Will look at the clock stuff tomorrow or so. Is there a special appnote about clock setup somewhere or did you get that info from the reference manual? Thanks, Uwe. -- http://www.hermann-uwe.de | http://www.randomprojects.org http://www.crazy-hacks.org | http://www.unmaintained-free-software.org |
From: Thomas O. <to...@vi...> - 2010-02-27 17:42:12
|
Hello, see patch. Best regards, Thomas Otto |
From: Thomas O. <to...@vi...> - 2010-02-26 21:14:31
|
Hello, it seems to me that all the examples have a "wrong" clock initialization. At least the mb525 is documented as running at 72MHz. But this is definitely wrong. All examples run at 36MHz. Thats also the reason why the hardcoded frequency of 36000000 in usart.c of the lib is correct and working. Each STM32 has a 8MHz HSI build in. And that divided by 2 (PLLSRC_HSI_CLK_DIV2) is 4MHz. Multiplied by 9 (PLLMUL_PLL_CLK_MUL9) gives us 36MHz. And even that 36MHz is overclocking of the flash. Default setting is 0 waitstates after bootup, but this is limited to 24MHz. From 24-48MHz one should set 1 WS and from 48-72MHz one should set 2 WS. (From RM0008 Dec 9 page 49) With the internal clock (HSI) there is a maximum clock of 64MHz possible. 8 div 2 -> multiplied by 16. Its also documented like this in Document RM0008 from Dec 09 page 78. Another thing is that we should wait after clock enable til the clock is stabilized. And that we should do for every clock and not only the PLL. I have some correct initializations attached. Best regards, Thomas Otto |
From: Uwe H. <uw...@he...> - 2010-02-23 23:42:00
|
On Thu, Feb 18, 2010 at 04:56:26PM +0100, Thomas Otto wrote: > I've created an header file for the I2C sub-system. > Find it attached. Thanks a lot, committed with some minor changes, see below. > /* Bit [7:6] Reserved */ Replaced these with a longer version which states that the bits are forced to 0 by hardware. > #define I2C_CR2_FREQ_2MHZ (0x2) > #define I2C_CR2_FREQ_3MHZ (0x3) Dropped the parenthesis here, not needed. > /* PEC Error in Reception */ > #define I2C_SR1_PECERROR (1 << 12) Changed "PECERROR" to "PECERR" here to match the datasheet name. Also, I prefixed all bit comments with the bit name as per datasheet, I'm trying to enforce that on the whole code-base consistently (some of the existing files still need to be fixed, will do soonish). Example: /* Fast mode duty cycle */ #define I2C_CCR_DUTY (1 << 14) becomes: /* DUTY: Fast mode duty cycle */ #define I2C_CCR_DUTY (1 << 14) Cheers, Uwe. -- http://www.hermann-uwe.de | http://www.randomprojects.org http://www.crazy-hacks.org | http://www.unmaintained-free-software.org |
From: Thomas O. <to...@vi...> - 2010-02-18 15:56:52
|
Hello, I've created an header file for the I2C sub-system. Find it attached. Best regards, Thomas Otto |
From: Uwe H. <uw...@he...> - 2010-01-22 01:04:14
|
On Thu, Jan 21, 2010 at 08:37:32PM +0100, Thomas Otto wrote: > added the missing bits from the rcc_ahbenr. Applied, thanks. Uwe. -- http://www.hermann-uwe.de | http://www.randomprojects.org http://www.crazy-hacks.org | http://www.unmaintained-free-software.org |
From: Uwe H. <uw...@he...> - 2010-01-22 01:03:54
|
On Thu, Jan 21, 2010 at 08:23:20PM +0100, Thomas Otto wrote: > there is a little typo in the rcc.h... Indeed. Fixed, thanks! Uwe. -- http://www.hermann-uwe.de | http://www.randomprojects.org http://www.crazy-hacks.org | http://www.unmaintained-free-software.org |
From: Thomas O. <to...@vi...> - 2010-01-21 19:46:01
|
Hello, added the missing bits from the rcc_ahbenr. Patch is attached. cu Tommi |
From: Thomas O. <to...@vi...> - 2010-01-21 19:41:02
|
Hello, there is a little typo in the rcc.h... Patch is attached. cu Tommi |
From: Uwe H. <uw...@he...> - 2010-01-19 19:10:15
|
On Fri, Jan 15, 2010 at 04:33:03PM +0100, Thomas Otto wrote: > thanks for the commits. 8-) > But my functions for setting the prescalers are missing... Thanks, applied with some minor whitespace changes and a few function renames. I tried to keep as close as possible to the register names from the datasheet to prevent too much confusion. Uwe. -- http://www.hermann-uwe.de | http://www.randomprojects.org http://www.crazy-hacks.org | http://www.unmaintained-free-software.org |
From: Thomas O. <to...@vi...> - 2010-01-15 15:33:22
|
Hello, thanks for the commits. 8-) But my functions for setting the prescalers are missing... Best regards, Thomas Otto |
From: Uwe H. <uw...@he...> - 2010-01-15 00:10:00
|
On Thu, Jan 14, 2010 at 08:35:50PM +0100, Thomas Otto wrote: > I've attached 2 files to add some basic flash things. Thanks, committed with a few minor cosmetic and whitespace changes. Uwe. -- http://www.hermann-uwe.de | http://www.randomprojects.org http://www.crazy-hacks.org | http://www.unmaintained-free-software.org |
From: Thomas O. <to...@vi...> - 2010-01-14 19:36:13
|
Hi, I've attached 2 files to add some basic flash things. This would allow to use higher frequencies with the stm32. The following code push my stm32 with an external 16MHz oscillator to 72MHz. void clock_setup(void) { /* enable Internal High Speed Oscillator */ rcc_osc_on(HSI); rcc_wait_for_osc_ready(HSI); /* Select HSI as SYSCLK source. */ rcc_set_sysclk_source(SW_SYSCLKSEL_HSICLK); /* enable External High Speed Oscillator */ rcc_osc_on(HSE); rcc_wait_for_osc_ready(HSE); rcc_set_sysclk_source(SW_SYSCLKSEL_HSECLK); /* set prescalers for ADC, ABP1, ABP2 */ rcc_set_adcpre(ADCPRE_PLCK2_DIV8); rcc_set_abp1pre(PPRE1_HCLK_DIV2); rcc_set_abp2pre(PPRE2_HCLK_NODIV); /* should run with 72MHz -> 2 Waitstates */ flash_set_ws(LATENCY_2WS); /* Set the PLL multiplication factor to 9. -> 16MHz (external) * 9 (Multiplikator) / 2 (PLLXTPRE) = 72MHz */ rcc_set_pll_multiplication_factor(PLLMUL_PLL_CLK_MUL9); /* Select HSE as PLL source. */ rcc_set_pll_source(PLLSRC_HSE_CLK); /* divide external frequency by 2 before entering pll */ rcc_set_pllxtpre(PLLXTPRE_HSE_CLK_DIV2); /* Enable PLL oscillator and wait for it to stabilize. */ rcc_osc_on(PLL); rcc_wait_for_osc_ready(PLL); /* Select PLL as SYSCLK source. */ rcc_set_sysclk_source(SW_SYSCLKSEL_PLLCLK); } |
From: Uwe H. <uw...@he...> - 2010-01-14 18:54:43
|
Hi, On Wed, Jan 06, 2010 at 05:27:33PM +0100, Thomas Otto wrote: > 124c124 > < while ((RCC_CR & PLLRDY) != 0); > --- > > while ((RCC_CR & PLLRDY) == 0); > 127c127 > < while ((RCC_CR & HSERDY) != 0); > --- > > while ((RCC_CR & HSERDY) == 0); > 130c130 > < while ((RCC_CR & HSIRDY) != 0); > --- > > while ((RCC_CR & HSIRDY) == 0); > 133c133 > < while ((RCC_BDCR & LSERDY) != 0); > --- > > while ((RCC_BDCR & LSERDY) == 0); > 136c136 > < while ((RCC_CSR & LSIRDY) != 0); > --- > > while ((RCC_CSR & LSIRDY) == 0); Thanks a lot! Patch is now applied. Sorry for the delay. Uwe. -- http://www.hermann-uwe.de | http://www.randomprojects.org http://www.crazy-hacks.org | http://www.unmaintained-free-software.org |
From: Thomas O. <to...@vi...> - 2010-01-06 16:46:01
|
Hello, I've just tried out the library and if i follow the clock and pll setup recommended by ST the controller hangs in the rcc_wait_for_osc_ready(HSI). This is caused by an wrong comparation in this function. I've attached a patch so that just now also the following for external oscillators will work: void clock_setup(void) { /* enable Internal High Speed Oscillator */ rcc_osc_on(HSI); rcc_wait_for_osc_ready(HSI); rcc_set_sysclk_source(SW_SYSCLKSEL_HSICLK); /* enable External High Speed Oscillator */ rcc_osc_on(HSE); rcc_wait_for_osc_ready(HSE); rcc_set_sysclk_source(SW_SYSCLKSEL_HSECLK); /* Set the PLL multiplication factor to 4. -> 4*16 = 64MHz */ rcc_set_pll_multiplication_factor(PLLMUL_PLL_CLK_MUL4); /* Select HSI/2 as PLL source. */ rcc_set_pll_source(PLLSRC_HSE_CLK); rcc_set_pllxtpre(PLLXTPRE_HSE_CLK_DIV2); /* Enable PLL oscillator and wait for it to stabilize. */ rcc_osc_on(PLL); rcc_wait_for_osc_ready(PLL); /* Select PLL as SYSCLK source. */ rcc_set_sysclk_source(SW_SYSCLKSEL_PLLCLK); } |