- Joined
- Jul 28, 2017
- Messages
- 2,606
I tracked down some major problems with my pulse qualification code. One slap-the-forehead problem was in the function that updates the circular buffer and was simple to correct (once I found it), but the other was more subtle. The interrupt routine that runs the ADC does several things, one of which is to set a flag if a lowpass-filtered version of the input is greater than the trigger level (the intent is to reject noise). My main pulse-processing routine waits for that trigger flag to be set, and as soon as it happens it starts processing the pulse data. And that was the problem -- since the processor clock runs at 600MHz it was outpacing the ADC by a huge factor. So the data it was seeing in my circular buffer didn't contain any information regarding the current pulse.
The solution was fairly simple, basically insert a delay in the pulse processing code to allow the circular buffer to capture the entire pulse. After that I started getting some valid pulses. Most pulses still weren't right, but just reflected the fact that I had done a lot of guessing on the expected pulse width values (maximum-valid pulse width and minimum-valid pulse width). I also hadn't initialized my "goodness of fit" parameter so my pulse qualification code was rejecting everything.
One thing that needs some attention actually is that goodness of fit parameter. The values I'm seeing are consistently very low, ranging from 0 to .01. Given the liklihood of pulse overlap plus system noise, I think there should be some pulses being rejected for an excessively high error coming out of the fitting routine so....more code validation is in the near future.
I could upload my latest version to my Google Drive for folks to examine, but at this point it's full of debug code and not useful for a real MCA.
The solution was fairly simple, basically insert a delay in the pulse processing code to allow the circular buffer to capture the entire pulse. After that I started getting some valid pulses. Most pulses still weren't right, but just reflected the fact that I had done a lot of guessing on the expected pulse width values (maximum-valid pulse width and minimum-valid pulse width). I also hadn't initialized my "goodness of fit" parameter so my pulse qualification code was rejecting everything.
One thing that needs some attention actually is that goodness of fit parameter. The values I'm seeing are consistently very low, ranging from 0 to .01. Given the liklihood of pulse overlap plus system noise, I think there should be some pulses being rejected for an excessively high error coming out of the fitting routine so....more code validation is in the near future.
I could upload my latest version to my Google Drive for folks to examine, but at this point it's full of debug code and not useful for a real MCA.