Hello,
I have encountered a problem with the ADC block in LPC1758 in a custom made PCB. While the ADC block works normally with reliable values that allow the vehicle equipped with the PCB to drive smoothly without issues, sporadically and in a non-deterministic way after waking up from power down mode, the ADC block does not produce values any more for at least 1100 cycles of its burst mode period in any of its channels. It is like the block dies. Going back to power down and waking up restores the correct functionality.
During these occurrences both the ready flag(ADC_DR_DONE_STAT) for each channel is not set and the value read is higher than the maximum allowed value(4096) of the ADC.
The ADC is configured to run in burst mode using its maximum frequency of 200k. Though reducing the frequency even by 90% does not have any healing effect on the issue.
Does anybody have encountered any similar issue or have any idea what might cause this sort of behavior?
Hi, Willem,
I suppose that in power-down mode, the ADC module is power-down also, you have to reinitialize the ADC module.
As you know that the waking-up event can wake-up the LPC1758, this is the process, the waking-up event triggers an interrupt, then it executes ISR and resume to run. So In the waking-up event ISR, you can set a flag, in the main loop, you can poll the flag, if it is set, you know that the LPC has experienced power-down mode and is woke-up, you can reinitialize ADC module,clear the flag, then run normally.
Hope it can help you
BR
XiangJun Rong
Hello XiangJun,
Thank you for your reply. After waking up the GPIO ISR is executed and then the microcontroller is reset initializing all the modules including the ADC again. Except for the issue being encountered sporadically, meaning that most of the times it is not there, which indicates that the ADC is initialized properly as the system is completely functional after that, I have also used some leds available on the board to verify that the microcontroller renters main from the top after waking up.
Hi, Willem,
I think it is a wrong concept that the waking-up event follows up the Reset procedure. As you know that waking-up event from sleep/deep sleep/power-down modes follows up the interrupt process, in other words, assume that the LPC processor is in above low-power mode, when the waking-up event occurs, an interrupt is triggered, the corresponding ISR is executed, after the ISR is finished, the LPC CPU will resume to main loop where it enters the low power mode.
In deep power-down mode, the waking-up event follows up Reset process.
Because the waking-up follows up interrupt process and in power-down mode, maybe the ADC is power-down, so it is necessary to initialize the ADC and clock module in the main or ISR. I suggest you initialize the ADC in the waking-up ISR for simplicity, pls have a try.
Hope it can help you
BR
Xiangjun Rong
Hi Xiangjun,
Thank you again for your reply. As I mentioned in my previous reply I have verified that the Reset ISR is executed by using several LEDs available on the board as indicators for which part of the code is executed and in which order after exiting power down mode. The code indeed renters main but from the Reset ISR and not from the point it entered the power down mode.
In addition to that all the peripherals are de-initialized one by one by the software, meaning they have their clock disabled, before going to power down mode. If the initialization part of main, above the main loop, was not executed it would not be only the ADC module having problems but all the other peripherals used(CAN, SPI, I2C and more).