>> 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