public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: "Morris, Richard" <Richard.Morris@lifetech.com>
To: eCos Discussion <ecos-discuss@ecos.sourceware.org>
Subject: [ECOS] Re: STM32F4 timers test problem
Date: Thu, 23 Aug 2012 22:00:00 -0000	[thread overview]
Message-ID: <9BF6099D-F751-47CD-BA3E-28A3B7A7A0F4@lifetech.com> (raw)

An additional update on the APB timer initialization.

I'm not yet familiar with the process for having code submitted to the source tree, and so I am posting this here.

Upon further reading of the initialization code for the STM32Fx, I found what appears to be a reasonable location for the initialization.

As a result, I moved the APB timer initialization to a place that looks more appropriate in stm32x0g_eval_misc.c.  Right at the beginning of the APB initialization.  (See my previous posts for details leading up to this point.)

__externC void hal_system_init( void )
{
    CYG_ADDRESS base;
    
    // Enable peripheral clocks in RCC

    base = CYGHWR_HAL_STM32_RCC;

    // Enable clocks for timers
    {
      unsigned int reg;
      HAL_READ_UINT32((base + CYGHWR_HAL_STM32_RCC_APB1ENR), reg );
      HAL_WRITE_UINT32((base + CYGHWR_HAL_STM32_RCC_APB1ENR),
		       (reg
			| BIT_(CYGHWR_HAL_STM32_RCC_APB1ENR_TIM2)
			| BIT_(CYGHWR_HAL_STM32_RCC_APB1ENR_TIM3)
			| BIT_(CYGHWR_HAL_STM32_RCC_APB1ENR_TIM4)
			| BIT_(CYGHWR_HAL_STM32_RCC_APB1ENR_TIM5)
			| BIT_(CYGHWR_HAL_STM32_RCC_APB1ENR_TIM6)
			| BIT_(CYGHWR_HAL_STM32_RCC_APB1ENR_TIM7)
#if (CYGHWR_HAL_CORTEXM_STM32_FAMILY_HIPERFORMANCE)
			| BIT_(CYGHWR_HAL_STM32_RCC_APB1ENR_TIM12)
			| BIT_(CYGHWR_HAL_STM32_RCC_APB1ENR_TIM13)
			| BIT_(CYGHWR_HAL_STM32_RCC_APB1ENR_TIM14)
#endif
			)
		       );
      HAL_READ_UINT32((base + CYGHWR_HAL_STM32_RCC_APB2ENR), reg );
      HAL_WRITE_UINT32((base + CYGHWR_HAL_STM32_RCC_APB2ENR),
		       (reg
			| BIT_(CYGHWR_HAL_STM32_RCC_APB2ENR_TIM1)
			| BIT_(CYGHWR_HAL_STM32_RCC_APB2ENR_TIM8)
#if (CYGHWR_HAL_CORTEXM_STM32_FAMILY_HIPERFORMANCE)
			| BIT_(CYGHWR_HAL_STM32_RCC_APB2ENR_TIM9)
			| BIT_(CYGHWR_HAL_STM32_RCC_APB2ENR_TIM10)
			| BIT_(CYGHWR_HAL_STM32_RCC_APB2ENR_TIM11)
#endif
			)
		       );
    }

    // All GPIO ports
    // FIXME: this should be done in variant HAL at point of gpio_set
    HAL_WRITE_UINT32(base+CYGHWR_HAL_STM32_RCC_AHB1ENR,
#if defined(CYGHWR_HAL_CORTEXM_STM32_FAMILY_F4) // enable CCM clock
                     BIT_(CYGHWR_HAL_STM32_RCC_AHB1ENR_CCMDATARAMEN) |
#endif // CYGHWR_HAL_CORTEXM_STM32_FAMILY_F4
                     BIT_(CYGHWR_HAL_STM32_RCC_AHB1ENR_GPIOA) |
                     BIT_(CYGHWR_HAL_STM32_RCC_AHB1ENR_GPIOB) |
                     BIT_(CYGHWR_HAL_STM32_RCC_AHB1ENR_GPIOC) |
                     BIT_(CYGHWR_HAL_STM32_RCC_AHB1ENR_GPIOD) |
                     BIT_(CYGHWR_HAL_STM32_RCC_AHB1ENR_GPIOE) |
                     BIT_(CYGHWR_HAL_STM32_RCC_AHB1ENR_GPIOF) |
                     BIT_(CYGHWR_HAL_STM32_RCC_AHB1ENR_GPIOG) |
                     BIT_(CYGHWR_HAL_STM32_RCC_AHB1ENR_GPIOH) |
                     BIT_(CYGHWR_HAL_STM32_RCC_AHB1ENR_GPIOI) );




--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

             reply	other threads:[~2012-08-23 22:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-23 22:00 Morris, Richard [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-08-23 14:14 Morris, Richard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9BF6099D-F751-47CD-BA3E-28A3B7A7A0F4@lifetech.com \
    --to=richard.morris@lifetech.com \
    --cc=ecos-discuss@ecos.sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).