public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: Steven Clugston <steven.clugston@newcastle.ac.uk>
To: ecos-discuss <ecos-discuss@ecos.sourceware.org>
Subject: RE: [ECOS] ARM7 ADC drivers - any progress?
Date: Tue, 01 Sep 2009 08:58:00 -0000	[thread overview]
Message-ID: <4DCF6DBD3535F742BB167C528BBEE9803827660BD7@EXSAN01.campus.ncl.ac.uk> (raw)
In-Reply-To: <op.uyyweltykeg3uf@localhost>


>> Hi Steven
>> I do not know the AT91SAM7S, but assume its pretty the same ADC peripheral.

>> No, I can not think of anything why it should not work on your S-machine.
>> But indeed (and for historical reasons) there is another init-routine in my system - see attachment. If it works with this, then check out what you really need of it :-) Lazy approach!

>> Another hint: Our board runs with an external 25 MHz clock and parameters are such to bring its main clock to 48 Mhz (done in configtool).

>> Hope this brings you one step further. Regards Robert

Thanks for the additional code Robert.

I chased it through from just taking single shot software triggered samples with no DMA and in the end, just changing the code from TC2 to TC1 made it work. For some reason just enabling HW triggering and setting it to TC2 stops the ADC from returning any results. I've not had chance to find out why yet, but I'm not sure which TC is being used for the system timer. I had assumed it was TC0, but if it is TC2, then this might explain a few things.

I'm slightly confused by a couple of things, perhaps someone who is familiar with the AT91 hal code might be able to clearup.

In hal/arm/at91/at91sam7s/current/src/at91sam7s_misc.c:

#ifdef CYGBLD_HAL_ARM_AT91_TIMER_TC
  /* Enable peripheral clocks for TC 0 and 1 if they are to be used */
  HAL_WRITE_UINT32(AT91_PMC+AT91_PMC_PCER,
                   AT91_PMC_PCER_TC0 |
                   AT91_PMC_PCER_TC2);
#endif

The above only enbles the clocks, so is not the cause of my problem, but the comment seems to contradict the statement below it. Should TC1 or TC2 be enabled here?

Also in hal/arm/at91/var/current/src/timer_tc.c:

void hal_delay_us(cyg_int32 usecs)
{
    cyg_uint32 stat;
    cyg_uint64 ticks;
#if defined(CYGHWR_HAL_ARM_AT91_JTST)
    // TC2 is reserved for AD/DA. Use TC1 instead.
    CYG_ADDRESS timer = AT91_TC+AT91_TC_TC1;
#else
    CYG_ADDRESS timer = AT91_TC+AT91_TC_TC2;
#endif

What is CYGHWR_HAL_ARM_AT91_JTST ? I can't find anything in CDL for it. If it is not being defined, then this answers my question about which timer is being used for the system clock.

Thanks,

Steven

--
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:[~2009-09-01  8:58 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-18 13:50 Steven Clugston
2009-05-18 14:16 ` Robert Brusa
2009-05-18 14:43   ` Steven Clugston
2009-08-20 10:23   ` Steven Clugston
2009-08-20 15:38     ` Robert Brusa
2009-09-01  8:58       ` Steven Clugston [this message]
2009-09-01  9:50         ` Andrew Lunn
2009-09-01 10:40           ` Steven Clugston
2009-09-03 14:26           ` Bob Brusa

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=4DCF6DBD3535F742BB167C528BBEE9803827660BD7@EXSAN01.campus.ncl.ac.uk \
    --to=steven.clugston@newcastle.ac.uk \
    --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).