Please, give me an advice. I need to measure the supply voltage and trigger an interrupt after the measurement. An END interrupt is triggered only once. It must be without libraries, just by writing to NRF_SAADC->....
Please, give me an advice. I need to measure the supply voltage and trigger an interrupt after the measurement. An END interrupt is triggered only once. It must be without libraries, just by writing to NRF_SAADC->....
An END interrupt is triggered only once.
Have you remembered to clear it after it has fired?
An END interrupt is triggered only once.
Have you remembered to clear it after it has fired?
I start the measurement by software.
In interrupt the flag is cleared.:
void SAADC_IRQHandler(void)
{
if(NRF_SAADC->EVENTS_END > 0)
{
NRF_SAADC->EVENTS_END = 0;
Try to use nrf_saadc_event_clear instead of NRF_SAADC->EVENTS_END = 0;
It doesn't work. I have a project where bluetooth is used and due to the size of the softdevice, all logs must be turned off and libraries must not be used.
jca said:libraries must not be used
You need to use the HAL in order to operate the nRF52 safely, for instance:
__STATIC_INLINE void nrf_saadc_event_clear(nrf_saadc_event_t event) { *((volatile uint32_t *)((uint8_t *)NRF_SAADC + (uint32_t)event)) = 0x0UL; #if __CORTEX_M == 0x04 volatile uint32_t dummy = *((volatile uint32_t *)((uint8_t *)NRF_SAADC + (uint32_t)event)); (void)dummy; #endif }
That dummy read is necessary, see Migrating from the nRF51 Series to the nRF52 Series -> Functional changes.