Error when building saadc example in NCS V2.6.0

I have recently upgraded my SDK from NCS V2.2.0 to V2.6.0, and have come back to some firmware I had working under 2.2.0 as I need to progress that.  The firmware is based on the advanced non-blocking nrf_saadc example (../2.6.0\modules\hal\nordic\nrfx\samples\src\nrfx_saadc\advanced_non_blocking_internal_timer).  I've made a bunch of modifications to this as I'm trying to get firmware that continuously monitors an ADC pin and then calls the callback whenever the value exceeds an upper or lower limit.

But I am getting some unusual build errors.  Seems to be related to the definition of hte nrf_saadc_value_t buffers:

/** @brief Samples buffer to store values from a single channel ( @ref m_single_channel). */
static nrf_saadc_value_t m_sample_buffers[BUFFER_COUNT][BUFFER_SIZE];
static nrf_saadc_value_t event_limit_buffer[EVENT_BUFFER_COUNT][BUFFER_SIZE] = {0};

When I attempt to do a build, I get these errors:

C:/Nordic/Development/saadc/src/main.c:116:26: error: declaration of 'm_sample_buffers' as array of voids
  116 | static nrf_saadc_value_t m_sample_buffers[BUFFER_COUNT][BUFFER_SIZE];
      |                          ^~~~~~~~~~~~~~~~
C:/Nordic/Development/saadc/src/main.c:117:26: error: declaration of 'event_limit_buffer' as array of voids
  117 | static nrf_saadc_value_t event_limit_buffer[EVENT_BUFFER_COUNT][BUFFER_SIZE] = {0};
      |                          ^~~~~~~~~~~~~~~~~~

Its also flagging up a warning that those two buffers are defined, but not used, despite the fact that they in fact are.  This is the warning:

C:/Nordic/Development/saadc/src/main.c:117:26: warning: 'event_limit_buffer' defined but not used [-Wunused-variable]
  117 | static nrf_saadc_value_t event_limit_buffer[EVENT_BUFFER_COUNT][BUFFER_SIZE] = {0};
      |                          ^~~~~~~~~~~~~~~~~~
C:/Nordic/Development/saadc/src/main.c:116:26: warning: 'm_sample_buffers' defined but not used [-Wunused-variable]
  116 | static nrf_saadc_value_t m_sample_buffers[BUFFER_COUNT][BUFFER_SIZE];
      |                          ^~~~~~~~~~~~~~~~

But here those two buffers are in fact being used in my saadc handler function:

case NRFX_SAADC_EVT_BUF_REQ:
            status = nrfx_saadc_buffer_set(m_sample_buffers[buffer_index++], BUFFER_SIZE);
            if (status != NRFX_SUCCESS) {
                LOG_ERR("nrfx_saadc_buffer_set failed");
            }
            buffer_index = buffer_index % BUFFER_COUNT;
            break;

case NRFX_SAADC_EVT_DONE:

            if (limit_event_detected) {
                if (event_limit_buffer_count < EVENT_BUFFER_COUNT) {
                    memcpy(event_limit_buffer[event_limit_buffer_count],p_event->data.done.p_buffer,sizeof(int16_t)*BUFFER_SIZE);
                    buffer_to_print = true;
                    event_limit_buffer_count++;
                }
            }
            limit_event_detected = false;
            break;

Is there some CONFIG setting I am supposed to be using in v2.6.0 that wasn't needed in v2.2.0?  I can't see any differences between this example in v2.2.0 and v2.6.0, with the exception that CONFIG_NRFX_GPIOTE in the v2.2.0 example is replaced with CONFIG_NRFX_GPIOTE0 in the v2.6.0 example.

I can get the v2.2.0 version of my firmware to build without errors (i.e. I just make the above changes to the proj.conf file)

Thanks and regards,

Mike

Related