Hi,
I observed this issue using MCUXpresso IDE 11.8.0, SDK 2.14.0 for LPC5536.
To use ADC or DAC of LPC553x you have to enable VREF.
If you enable VREF using Peripherals Tool, you'll get these lines of code added:
const vref_config_t VREF_config = {
.bufferMode = kVREF_ModeHighPowerBuffer,
.enableLowPowerBuff = true,
.enableInternalVoltageRegulator = true,
.enableChopOscillator = true,
.enableHCBandgap = true,
.enableCurvatureCompensation = true
};
static void VREF_init(void) {
/* VREF peripheral initialization */
VREF_Init(VREF_PERIPHERAL, &VREF_config);
}
This is insufficient as it does not power on VREF.
You have to call
/* Enable internal voltage reference */
POWER_DisablePD(kPDRUNCFG_PD_VREF);
before VREF_init() is called.
At least that worked for me.
I consider this a bug in Peripherals Tool.
Hello @danielholala,
Unfortunately, as you mentioned the POWER_DisablePD(kPDRUNCFG_PD_xxxx) is missing from ConfigTools' Peripherals.
We have suggested the team in charge to include it in future releases. At the meantime, as you did, you could add the POWER_DisablePD(kPDRUNCFG_PD_xxxx) after finishing your ConfigTools' configuration.
Thank you for letting us know about this.
Kind regards, Raul.
Hello @RaRo ,
Thank you for answering my request.
While we are at it, I just figured that enabling VREF is not checked when ADC or DAC is enabled in Peripherals Tool. I expected an error to pop up in Problems view similar to a missing clock, for example.
I suggest that the Peripherals team could look into making VREF a dependency. Does that make sense to you?
Hello @danielholala,
Just for double check, instead of just having it like a warning related to the ADC after initializing both DAC and ADC modules, do you suggest it be shown as an Error like the CAN_clock in the following picture?
[Peripherals Tool and Problems view]
Best regards, Raul.
Hello @RaRo ,
Oh, obviously when I tested the VREF dependency of ADC in Peripheral Tools I tried this on a LPC5528 project by mistake. I just checked on a LPC5536 based project and now I see this warning regarding VREF, too.
Thanks for double checking.
Now the question is whether this notice should be at "warning" or at "error" level. As the ADC / DAC is not working without VREF enabled, I think this warrants an "error" level. Further, I suggest to add a "quick fix" (via context menu) to enable VREF, similar to the "inactive clock" error.
Best regards,
Daniel
Hello @danielholala,
As the ADC / DAC is not working without VREF enabled, I think this warrants an "error" level.
In the LPC553x Reference Manual. Section 47.1.1. ADC subsystem Introduction., it is mentioned that VREF would be desirable for proper ADC operation, but not entirely necessary. Even if it is not recommended to use the ADC without VREF, it is not mandatory.
Thank you for the feedback, we appreciate it and take it into account to provide a better support.
Best regards, Raul.