> I have attached the code I am using. I have added my own function,
> chirp() inside the 'get adc' command and an external interrupt routine
> as well as all the initialisation for the timer and interrupts. I seem
> to have isolated the problem to the while-loop inside chirp() but I'm
> not quite sure why this is causing a problem and how it relates to the
> prescaler. Any ideas?
The ProcessCommand function runs from interrupt context, and the SCL
clock is stretched for the duration of the ProcessCommand function.
The entire operation needs to finish in some small number of
milliseconds, otherwise the host will timeout.
So it's probably ok to initiate the chirp, but you'd need to stop it,
or get the results, or whatever, using another call later on.
The actual chirp could be performed from the main loop (which can
delay for as long as it wants to).
Vancouver, BC, Canada