2023-11-13 02:11 AM
Hello every body,
It is my first post and I´m newvy with this tecnology. I'm trying to read from adc 1, 2 and 3 values from the DMA (in case of use adc 1 and 2) and the BDMA (case adc3). In the two first cases, the interrupts are generated correctly and I detect the fill of the half and full DMA using the callbacks HAL_ADC_ConvHalfCpltCallback and HAL_ADC_ConvCpltCallback.
The problem comes when I try to reproduce the same behaviour with the adc 3. I've configured the adc3 in the same way of the others one. Besides, I've initialized the bdma in the same way but the callbacks never are called.
I've created a new project only to test the adc3+bdma and the configuration of the adc is described in the following picture:
and the source code is the following (is very basic):
int main(void) {
HAL_Init();
SystemClock_Config();
MX_GPIO_Init();
MX_BDMA_Init();
MX_USB_OTG_FS_PCD_Init();
MX_ADC3_Init();
/* USER CODE BEGIN 2 */
HAL_ADC_MspInit(&hadc3);
HAL_ADC_Start_DMA(&hadc3, adc3_data, 10);
while (1)
{
}
}
void HAL_ADC_ConvHalfCpltCallback(ADC_HandleTypeDef *hadc)
{
if (hadc == &hadc3)
{
// Operaciones adicionales después de que se complete la conversión de ADC3
}
}
void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef *hadc)
{
if (hadc == &hadc3)
{
// Operaciones adicionales después de que se complete la conversión de ADC3
}
}
void HAL_ADC_ErrorCallback(ADC_HandleTypeDef *hadc)
{
if (hadc == &hadc3)
{
// Manejar el error de ADC3
}
}
Any ideas?? Some thing wrong?
Thank in advance
2023-11-13 04:06 AM
In order to provide more information, I can read ADC3 values perfectly. The main problem is the connection with the BDMA.
2023-11-14 02:26 AM - edited 2023-11-14 02:31 AM
Hello @ddelafuente,
Please note that the BDMA controller is located in the D3 domain and can access only SRAM4 and backup SRAM in the D3 domain, so you need to declare the destination buffer in SRAM4 for the ADC DMA transfer (Please check RM to know where SRAM4 is mapped)
and then you can either use the linker script to declare the buffer in SRAM4 or you can insert the SRAM4 addresses manually in the stm32h743xx_flash.icf file generated by CubeMX.
Also check this knowledge article : DMA is not working on STM32H7 devices
Hope that helps!
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.