• AVR Freaks

Helpful ReplyHot!Problem with multiple hardware digital filters on ADCHS module in PIC32MZ EF part

Author
Paul Bjork
Super Member
  • Total Posts : 213
  • Reward points : 0
  • Joined: 2011/09/21 14:08:10
  • Location: 0
  • Status: offline
2015/11/11 11:08:26 (permalink)
0

Problem with multiple hardware digital filters on ADCHS module in PIC32MZ EF part

I have adapted the Harmony v1.06 adcs_oversample project to include measuring two ADC channels using Class 1 inputs.  When using a single digital filter (oversampling mode) on either of the ANx inputs, the filter output is as expected.  However, an attempt to filter two ANx inputs using two digital filters results in both filter outputs giving the same number.  
 
Using the filters one at a time, the outputs are correct.  Say for a 0 V input, the filter result is 0x0000, and for a full scale voltage, the output is 0x7FFF.
 
But if I attempt to filter two different ANx inputs using two digital filters respectively, both filter outputs come out the same.  For several combinations of filter number and ANx input number, the output comes out to be that of the higher numbered ANx input.  For example, for a full scale voltage, the output (as measured at the ADCFLTRx register after the AFRDY bit is set) is 0x7FFF for BOTH filters, even though one of them should be filtering 0 V.
 
This does NOT appear to be a Harmony problem.  I have verified that the the only difference in the actual respective ADCFLTRx registers is the CHNLID bits, which select the analog input channels to filter.  These are set correctly as expected by the MHC boilerplate code as generated directly by choices in the MHC options.
 
This is on a PIC32MZ2048EFM064 part, XC32 1.40, MPLABX 3.06, PICKit 3.
 
Has anyone gotten the ADCHS filters to work independently as expected?
 
Paul
post edited by Paul Bjork - 2015/11/11 11:13:14
#1
Larry.Standage
Super Member
  • Total Posts : 927
  • Reward points : 0
  • Joined: 2011/12/30 09:50:47
  • Location: 0
  • Status: offline
Re: Problem with multiple hardware digital filters on ADCHS module in PIC32MZ EF part 2015/11/11 12:05:56 (permalink) ☄ Helpfulby dragondgold 2017/08/07 12:12:11
3 (1)
This is a known problem, and we are getting ready to issue an errata about it.
 
The problem comes from having the filters try to access the data simultaneously. One workaround is to have the SAMC for one of the channels be a couple of TAD more than the other, assuming they have identical triggers. This will make sure that the data is ready at different times, and the filters operate correctly.
#2
Paul Bjork
Super Member
  • Total Posts : 213
  • Reward points : 0
  • Joined: 2011/09/21 14:08:10
  • Location: 0
  • Status: offline
Re: Problem with multiple hardware digital filters on ADCHS module in PIC32MZ EF part 2015/11/11 13:45:16 (permalink)
0
Thanks, Larry.
 
Hmmm, not having the same sample/convert times would seem to play havoc on the ideal of having simultaneous samples across all ADC channels.
 
I'm using the global software trigger from the adcs_oversample project, so the triggers are identical.
 
With the nTadc clock divider set at 1 (as selected in the MHC option list), I varied nSAMC (ADCxTIME) on the filter channel that reads correctly from 1 to 4.  No change in behavior.  Then I varied SAMC from 5 to 8. Though at least the filter outputs weren't locked together, results were all over the map.  At no time did I get a actual zero filter output, as I expected from the 0V input source and the actual solid conversion result of 0x000.  I bumped up nTADC to 4 with similar poor results.
 
Then I held the correctly reading filter channel nSAMC at 1 and varied that of the incorrect filter channel.  Even with bumping nTADC up to 3 (from 1) on both channels and setting SAMC to 5 on the incorrect channel, the filter output wouldn't go lower than 0x01FF (511) for a 0V input.
 
I also bumped the SAMC values up to 200 and 202, with the hope that over 64 oversample readings there would be no overlap.  No better results were observed.  Same with an oversample ratio of 2.
 
Can you please help me understand your workaround better?  It doesn't seem to be working.
 
Paul
 
 
post edited by Paul Bjork - 2015/11/12 13:30:37
#3
Paul Bjork
Super Member
  • Total Posts : 213
  • Reward points : 0
  • Joined: 2011/09/21 14:08:10
  • Location: 0
  • Status: offline
Re: Problem with multiple hardware digital filters on ADCHS module in PIC32MZ EF part 2015/11/12 07:21:31 (permalink)
0
The last errata for this part is from the end of July.  With such a long turnaround on the errata documents, it would be very helpful if Microchip would make a temporary note of a known problem on these forums.
#4
Paul Bjork
Super Member
  • Total Posts : 213
  • Reward points : 0
  • Joined: 2011/09/21 14:08:10
  • Location: 0
  • Status: offline
Re: Problem with multiple hardware digital filters on ADCHS module in PIC32MZ EF part 2015/11/13 08:08:52 (permalink)
0
Still looking for some help on Larry's workaround for this problem.  It didn't work for me.
#5
Larry.Standage
Super Member
  • Total Posts : 927
  • Reward points : 0
  • Joined: 2011/12/30 09:50:47
  • Location: 0
  • Status: offline
Re: Problem with multiple hardware digital filters on ADCHS module in PIC32MZ EF part 2015/11/13 14:51:09 (permalink)
3 (1)
Hi Paul,
 
Sorry for the delay in getting back to you. I need to go back to our guy who originally found this issue, and see what we did and how we worked around it. I remember that we were doing the same thing, with the global sw trigger, but just upping the SAMC for one of the channels was enough.
 
One other question: Are you using the level sw trigger, and are you looking at the data through the debugger? We have observed an issue that the level sw trigger doesn't stay on when debugging and a breakpoint is hit.
#6
Paul Bjork
Super Member
  • Total Posts : 213
  • Reward points : 0
  • Joined: 2011/09/21 14:08:10
  • Location: 0
  • Status: offline
Re: Problem with multiple hardware digital filters on ADCHS module in PIC32MZ EF part 2015/11/14 16:03:01 (permalink)
0
Thanks, Larry.
 
For both channels, I'm using  ADCHS_TRIGGER_SOURCE_GLOBAL_SOFTWARE_EDGE in the MHC option list. As I understand it, the filter hardware turns the edge trigger into a level mode until enough sample have come in, correct?
 
I look at the data both through a PICKit3 and a USB console output.  Both agree.  I don't seem to have a problem with the trigger going away on a breakpoint if in the middle of a set of samples.  But I'm not sure that I would see that without watching carefully at this point.  I'll keep an eye out.
 
Oh, what should one expect to see on the ADCxFLTR register as the filter processes samples if looking at it before AFRDY is set?  Does the oversampling filter asymptotically approach its final value, as in an actual digital filter?  What is the DSP filter type and coefficient set?  I don't see a technical description in the data sheet.
 
Paul
post edited by Paul Bjork - 2015/11/14 16:10:00
#7
Paul Bjork
Super Member
  • Total Posts : 213
  • Reward points : 0
  • Joined: 2011/09/21 14:08:10
  • Location: 0
  • Status: offline
Re: Problem with multiple hardware digital filters on ADCHS module in PIC32MZ EF part 2015/11/24 09:55:53 (permalink)
0
I have a support ticket in on this, Larry.  Have you had a chance yet to look into it?
 
Paul
#8
Taïga
Starting Member
  • Total Posts : 36
  • Reward points : 0
  • Joined: 2015/03/17 14:00:17
  • Location: Belgium
  • Status: offline
Re: Problem with multiple hardware digital filters on ADCHS module in PIC32MZ EF part 2020/05/22 09:58:16 (permalink)
0
Hello,
 
how did the problem was solved eventually?
#9
NKurzman
A Guy on the Net
  • Total Posts : 18667
  • Reward points : 0
  • Joined: 2008/01/16 19:33:48
  • Location: 0
  • Status: offline
Re: Problem with multiple hardware digital filters on ADCHS module in PIC32MZ EF part 2020/05/22 10:22:49 (permalink)
#10
Taïga
Starting Member
  • Total Posts : 36
  • Reward points : 0
  • Joined: 2015/03/17 14:00:17
  • Location: Belgium
  • Status: offline
Re: Problem with multiple hardware digital filters on ADCHS module in PIC32MZ EF part 2020/05/22 10:29:41 (permalink)
0
Hello,
 
I already checked the errata, and it does not really help.
I am stuck for days to use 2 digital filters with the ADC, and i do not manage to get them working reliably.
#11
Jump to:
© 2020 APG vNext Commercial Version 4.5