Hello,
I'm using: nRF51422-QFAA E00 and SDK - nRF51 5.2.0
My problem with ADC is that I stucked when waiting for event - end of conversion. I used the code from Nordic examples called "simultaneous-adc-sampling-from-two-inputs".
Firts strange thing in this code is configuration. Unlike the other examples here they are not using IRQ handler at all and config is:
NRF_ADC->INTENSET = (ADC_INTENSET_END_Disabled << ADC_INTENSET_END_Pos);
Later they force conversion and wait for event (even when it's disabled by config - or event will appear even if interupt for this is disabled?):
// enable ADC
NRF_ADC->ENABLE = ADC_ENABLE_ENABLE_Enabled; /* Bit 0 : ADC enable. */
// start ADC conversion
NRF_ADC->TASKS_START = 1;
// wait for conversion to end
while (!NRF_ADC->EVENTS_END)
{}
NRF_ADC->EVENTS_END = 0;
I always stucked waiting for EVENTS_END. I changed the config to use IRQ and defined IRQ handler but that doesn't help. Finally I found a trick: put 1ms delay between NRF_ADC->ENABLE and TASK_START. But it's not described in Ref. manual or PAN so I don't know if this will help always (I'm working on critical app).