This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2640R2F: No service found on mobile when using continuous adcbuf on project_zero

Part Number: CC2640R2F
Other Parts Discussed in Thread: BLE-STACK

I just added new task to perform ADCBuf converting on project_zero.

I did't do anything more on the original project.

While new task working fine, GAP-Role or projectZero task seems not working correctly.

During ADC converting starts and showing log well, I cannot find BLE-Service list in mobile APP (TI-SensorTag) anymore.

It shows just name of main service ('Project Zero'). 

I cannot step into service item to see button-service, led-service and so on.

I found that GAP-Role enters connection state but never get 'ATT_MTU_UPDATED_EVENT'.

Can't I use ADC Buffer with BLE Service?

Please anyone give me a piece of advice!

Here is my code of new task.

-----------------------------------------------------------------------------------------------------------

#define ADC_SAMPLE_COUNT	8

// My own data block
typedef struct {
    uint16_t buff1[ADC_SAMPLE_COUNT];
    uint16_t buff2[ADC_SAMPLE_COUNT];
    uint32_t mvolt[ADC_SAMPLE_COUNT]; // micro volts
    ADCBuf_Handle handle;
    ADCBuf_Conversion conversion; // continuous conversion
} MY_ADC_t;


static MY_ADC_t my_adc = {0,};

static void initMyADC(void);

static void ADC_callback(   ADCBuf_Handle handle,
                            ADCBuf_Conversion *conversion,
                            void *buff,
                            uint32_t channel);

static void tmpTaskFunc(UArg arg0, UArg arg1)
{

	initMyADC();
	
	while(1){
	
            Log_Info0("TmpTaskFunc is Running");
	    taskSleepMilisec(1000); // macro function. sleep for 1 sec
	}
}


static void initMyADC(void)
{

    ADCBuf_Params params;
    ADCBuf_Handle handle;
    ADCBuf_Conversion *conversion;

    ADCBuf_init();


    // Configure the conversion struct
    conversion = &my_adc.conversion;
    conversion->arg = NULL;
    conversion->adcChannel = Board_ADCBUF0CHANNEL0;
    conversion->sampleBuffer = my_adc.buff1;
    conversion->sampleBufferTwo = my_adc.buff2;
    conversion->samplesRequestedCount = ADC_SAMPLE_COUNT;

	// ADC Buffer Open
    ADCBuf_Params_init(&params);
    params.callbackFxn = ADC_callback;
    params.recurrenceMode = ADCBuf_RECURRENCE_MODE_CONTINUOUS;
    params.returnMode = ADCBuf_RETURN_MODE_CALLBACK;
    params.samplingFrequency = 20; // 20 hz
    handle = ADCBuf_open(Board_ADCBUF0, &params);

    assert(handle);

    my_adc.handle = handle; // keep it for later use

    {
        // Start converting
        int_fast16_t res = ADCBuf_convert(handle, conversion, 1);
        
        assert(res == ADCBuf_STATUS_SUCCESS);
    }
}

static void ADC_callback(   ADCBuf_Handle handle,
                            ADCBuf_Conversion *conversion,
                            void *buff,
                            uint32_t channel)
{


	int_fast16_t status;


    // Adjust raw ADC values
	status = ADCBuf_adjustRawValues(handle, buff, ADC_SAMPLE_COUNT, channel);

	if (status NEQ ADCBuf_STATUS_SUCCESS){
		Log_warn1("ADC adjust Raw failed. status=0x%02x", status);
		goto exit;
	}

    // Convert adjusted ADC-values to microVolts
	status = ADCBuf_convertAdjustedToMicroVolts(handle,
												channel,
												buff,
												my_adc.mvolt,
												ADC_SAMPLE_COUNT);

	if (status NEQ ADCBuf_STATUS_SUCCESS) {
		Log_warn1("ADC converting to microVolts failed. status=0x%02x", status);
		goto exit;
	}

    // OK, just print log
    Log_Info0("ADC_callback() - OK");

exit:
	return;
}