Bluenet is the in-house firmware on Crownstone hardware. Functions: switching, dimming, energy monitoring, presence detection, indoor localization, switchcraft.
Nordic's comments about the ADC driver can be found online. Documentation on the SAADC driver can be found here.
The ADC driver has a low power mode in SDK 12. Does this disable EasyDMA when possible? (EasyDMA requires around 1.5mA).
The function nrf_drv_saadc_buffer_convert is called twice, once for each buffer. The first time nrf_saadc_buffer_init(p_buffer, size) is called. It sets the m_cb.adc_state state to NRF_SAADC_STATE_BUSY and m_cb.p_secondary_buffer to NULL (note that the latter variable is not set before, e.g. in nrf_drv_saadc_init, minor bug I think). The second time m_cb.p_secondary_buffer is NULL so nrf_saadc_buffer_init(p_buffer, size) is called again.
Apparently just calling that function twice is enough to use double buffering.
Two differences:
In the second call nrf_saadc_event_check(NRF_SAADC_EVENT_STARTED) == 0 is checked before nrf_saadc_event_clear.
In the second call nrf_saadc_int_enable is done after nrf_saadc_buffer_init, not before.
It seems very suspect that the order of the channels switches in the buffers. This might happen if we have an odd number of channels, but that is not the case. Is there a timing issue with EasyDMA?
Tests:
Enable 8 channels to see what happens with scan mode in that situation.
Remove all code that handles the buffer so that nrf_drv_saadc_buffer_convert can be called as quickly as possible.
Nordic's comments about the ADC driver can be found online. Documentation on the SAADC driver can be found here.
The ADC driver has a low power mode in SDK 12. Does this disable EasyDMA when possible? (EasyDMA requires around 1.5mA).
The function
nrf_drv_saadc_buffer_convert
is called twice, once for each buffer. The first timenrf_saadc_buffer_init(p_buffer, size)
is called. It sets them_cb.adc_state
state toNRF_SAADC_STATE_BUSY
andm_cb.p_secondary_buffer
toNULL
(note that the latter variable is not set before, e.g. innrf_drv_saadc_init
, minor bug I think). The second timem_cb.p_secondary_buffer
isNULL
sonrf_saadc_buffer_init(p_buffer, size)
is called again.Apparently just calling that function twice is enough to use double buffering.
Two differences:
nrf_saadc_event_check(NRF_SAADC_EVENT_STARTED) == 0
is checked beforenrf_saadc_event_clear
.nrf_saadc_int_enable
is done afternrf_saadc_buffer_init
, not before.It seems very suspect that the order of the channels switches in the buffers. This might happen if we have an odd number of channels, but that is not the case. Is there a timing issue with EasyDMA?
Tests:
nrf_drv_saadc_buffer_convert
can be called as quickly as possible.