Closed dwalkes closed 10 months ago
Hello @dwalkes,
Following your request, we have tried to reproduce the issue. the HAL_ADCEx_MultiModeStart_DMA
call aADCDualConvertedValues
as the pData Destination Buffer address parameter and not aADCxConvertedValues
/* Start ADCx and ADCy multimode conversion on regular group with transfer by DMA */
if (HAL_ADCEx_MultiModeStart_DMA(&AdcHandle_master,
(uint32_t *)aADCDualConvertedValues,
ADCCONVERTEDVALUES_BUFFER_SIZE
) != HAL_OK)
Before callbacks functions aADCxConvertedValues and aADCyConvertedValues both tables are set to zero
and aADCDualConvertedValues
it is fully stocked.
but if I implement the solution, that you have proposed, the aADCDualConvertedValues table is half filled.
Can you clarify more your problem because the callbacks functions write in aADCxConvertedValues and aADCyConvertedValues through(uint16_t) COMPUTATION_DUALMODEINTERLEAVED_ADCMASTER_RESULT(aADCDualConvertedValues[tmp_index]);
and
(uint16_t) COMPUTATION_DUALMODEINTERLEAVED_ADCSLAVE_RESULT(aADCDualConvertedValues[tmp_index]);
which are implement like the description of the reference manual.
First 16 bits ->Master (LSB) next 16 bits -> slave (MSB)
/**
* @brief Computation of ADC master conversion result
* from ADC dual mode conversion result (ADC master and ADC slave
* results concatenated on data register of ADC master).
* @param DATA: ADC dual mode conversion result
* @retval None
*/
#define COMPUTATION_DUALMODEINTERLEAVED_ADCMASTER_RESULT(DATA) \
((DATA) & 0x0000FFFF)
/**
* @brief Computation of ADC slave conversion result
* from ADC dual mode conversion result (ADC master and ADC slave
* results concatenated on data register of ADC master).
* @param DATA: ADC dual mode conversion result
* @retval None
*/
#define COMPUTATION_DUALMODEINTERLEAVED_ADCSLAVE_RESULT(DATA) \
((DATA) >> 16)
With regards, Rania
HAL_ADCEx_MultiModeStart_DMA call
aADCDualConvertedValues
as the pData Destination Buffer address parameter and notaADCxConvertedValues
Sorry, my mistake, I missed that the aADCDualConvertedValues
was uint32_t
With
DMA_MDATAALIGN_WORD
theHAL_ADCEx_MultiModeStart_DMA
call expects the length parameter to be in words, not half words.Without this change, the DMA interrupt overwrites the
aADCxConvertedValues
buffer located immediately behind the, DMA buffer, which isn't a problem for this example since it's immediately overwritten with the correct values in theHAL_ADC_ConvCpltCallback
.However, for those using this reference example this bug is likely to cause memory corruption in their application.
I have signed the CLA.