Hi, Since I am planning on using a SAMD based arduino (MKR) and the timer stuff is really complex. I though I would ask you if what I want to do is even possible before I begin.
I have a serial input that I want to measure the idle time between characters. It is the output from a pair of bathroom scales at 115220 baud.
Since this is similar in function to a logic analyser I thought I would title it as such and maybe over time i could expand it to do that job.
Firstly, currently I'm not really interested in the actual data characters just the idle time between them.
So this my proposed method:
set up two SAMD 32bit timers as incrementing counters to count at 48MHz wait for a trigger condition (say input has gone high) set one timer to count when my serial input is high. set the other timer to count when my serial input is low. This means that only one timer is counting at any one time.
Regularly the current idle counter is read, stored in a memory based log file and then the counter is reset to zero. when the log file is full it is printed on the serial monitor.
I think this method should allow long capture times at high resolution.
But is it possible? I have lost count of the number of times that I have discovered something I want to do is impossible. It usually happens after I realize the implications of something in a data sheet after hours of experimentation.
This time I thought I would ask first!
While solution code would be nice. I really only need an opinion and perhaps some tips.