Other Parts Discussed in Thread: HALCOGEN
I'm using ADC triggered from PWM SOCA, not in Continuous Conversion mode.
I got HALCoGen setup here
generated code like this
uint32 adcGetData(adcBASE_t *adc, uint32 group, adcData_t * data) { uint32 i; uint32 buf; uint32 mode; uint32 index = (adc == adcREG1) ? 0U : 1U; uint32 intcr_reg = adc->GxINTCR[group]; uint32 count = (intcr_reg >= 256U) ? s_adcFiFoSize[index][group] : (s_adcFiFoSize[index][group] - (uint32)(intcr_reg & 0xFFU)); adcData_t *ptr = data; /* USER CODE BEGIN (16) */ /* USER CODE END */
During code execution, I got somewhere count is actual negative results:
So why is this? is it a bug or I should just access ADC results directly from ADC buffer instead?
thanks