analogdevicesinc / msdk

Software Development Kit for Analog Device's MAX-series microcontrollers
Apache License 2.0
61 stars 81 forks source link

Using the ADC SFR Interface to Load the Reference Trim #965

Open TerryWoo123 opened 6 months ago

TerryWoo123 commented 6 months ago
  1. I received void MXC_ADC_RefCalibration(mxc_adc_revb_regs_t adc, mxc_adc_req_t req) this function from Sanjay.Jaroli last year. this is used to load trim value of ADC reference, to improve accuracy of ADC, for MAX32672-B2 variant.
  2. this function works well. with internal 2.048V, we see output result is significantly colser to the atual voltage.
  3. ADC feature in MAX32662 is not fully the same as MAX32672-B2. According to UG of MAX32662, I ported MXC_ADC_RefCalibration(mxc_adc_revb_regs_t adc, mxc_adc_req_t req) for MAX32662, but I don't see any slight/significant improvement of ADC accuracy. with 2.048 internal reference, there is about 40mV gap between ADC output and actual voltage.

please help to check why my code for MAX32662 doesn't work well? Once we confirm that these code work well, please merge this feature to MSDK in our next release.

thanks adc_revb.zip

Terry Wu 2024.03.27

TerryWoo123 commented 6 months ago

After a bug fix, it works well with with 2.048V internal reference in MAX32662. Please check new version code. adc_revb.zip Please help to verify my code and update it to MSDK.

Jake-Carter commented 6 months ago

Thanks @TerryWoo123, it should be relatively straightforward to pull this into the MSDK. There are just a few changes we will need to make:

  1. We try to make sure any part-specific code is implemented in the adc_mexx.c files.
  2. As you noted the bias and wake-up counter values will need to be updated based on the sample rate. It seems straightforward to implement based on the table in the UG. The sample-rate calculation actually seems like the most complicated part of this.

My understanding is that Rev A1 of the MAX32672 is the only special case. Otherwise, the procedures for the MAX32662 and MAX32672 are identical. Is that correct?

TerryWoo123 commented 6 months ago
  1. MAX32672-A1 is not on sell any more. We don’t need to pull any code for MAX32672-A1.
  2. MCR_ADC_CFG3 register is added in MAX32672-B2, but I don’t see this register in MAX32662.

From: Jake Carter @.> Sent: Thursday, April 4, 2024 5:48 AM To: analogdevicesinc/msdk @.> Cc: Wu, Terry @.>; Mention @.> Subject: Re: [analogdevicesinc/msdk] Using the ADC SFR Interface to Load the Reference Trim (Issue #965)

[External]

Thanks @TerryWoo123https://urldefense.com/v3/__https:/github.com/TerryWoo123__;!!A3Ni8CS0y2Y!_hKdUwLcFQyp0aYoIOvdWpoE14iWvgSbf1-3ZVt4Y0cR29DQl5PiEz5nCW0NUSagFBe7m6faNPGRT2H_u1Dq3HSO$, it should be relatively straightforward to pull this into the MSDK. There are just a few changes we will need to make:

  1. We try to make sure any part-specific code is implemented in the adc_mexx.c files.
  2. As you noted the bias and wake-up counter values will need to be updated based on the sample rate. It seems straightforward to implement based on the table in the UG. The sample-rate calculation actually seems like the most complicated part of this.

My understanding is that Rev A1 of the MAX32672 is the only special case. Otherwise, the MAX32662 and MAX32672 are identical. Is that correct?

— Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https:/github.com/analogdevicesinc/msdk/issues/965*issuecomment-2035659174__;Iw!!A3Ni8CS0y2Y!_hKdUwLcFQyp0aYoIOvdWpoE14iWvgSbf1-3ZVt4Y0cR29DQl5PiEz5nCW0NUSagFBe7m6faNPGRT2H_u-W-XFup$, or unsubscribehttps://urldefense.com/v3/__https:/github.com/notifications/unsubscribe-auth/A6P45JHAQANZG6PINXCEXWDY3R2KTAVCNFSM6AAAAABFKL4Z42VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMZVGY2TSMJXGQ__;!!A3Ni8CS0y2Y!_hKdUwLcFQyp0aYoIOvdWpoE14iWvgSbf1-3ZVt4Y0cR29DQl5PiEz5nCW0NUSagFBe7m6faNPGRT2H_u3ZZ8bfY$. You are receiving this because you were mentioned.Message ID: @.**@.>>