I am ussing cc2640 MCU along with SDK 3_40_00_10. My firmware is based on the simple_peripheral example, with some changes listed below:
- 6 Characteristics with read ans notify permissions.
- 2 Characteristics with write permission.
- 1 Charcteristic that sends the battery level that has read permissions.
I am trying to monitor the battery voltage of my system. However, when I read the value od the analog input using the adc Driver, the code eventually hangs caaling a default HAL_ASSERT and stucks in the HAL_ASSERT_SPINLOCK fuction that is included in the main.c file.
I need to monitor the battery voltage of the system reading the value of the battery from the adc each certain amount of time. Event handlers related to BLE should keep working as well.
This the code I use to read the battery voltage from the ADC:
ADC_Handle adc;
ADC_Params adcParams;
uint16_t adcRawValue;
uint32_t adcValueMicroVolts;
ADC_init();
ADC_Params_init(&adcParams);
adc = ADC_open(Board_ADC0, &adcParams);
ADC_convert(adc , &adcRawValue);
adcValueMicroVolts = ADC_convertRawToMicroVolts(adc, adcRawValue );
ADC_close(adc);
And here is where it gets stuck:
default:
#if !defined(Display_DISABLE_ALL)
Display_print0(dispHandle, 0, 0, "***ERROR***");
Display_print0(dispHandle, 2, 0, ">> DEFAULT SPINLOCK!");
#endif // ! Display_DISABLE_ALL
HAL_ASSERT_SPINLOCK;
It happens to me either using LAUNCHXL - CC2640, and using analog input DIO23, or using the MCU of my system that includes the 4x4 CC2640 so the analog input used is DIO14.