Skip to main content
KSOdin2
Associate III
April 8, 2021
Question

ADC data is transferred by DMA but no values in memory, just 0 (Nucleo-H734ZI2)

  • April 8, 2021
  • 5 replies
  • 1018 views

I am taking the values from adc1 and sending them via DMA1 to a memory location. I had followed a tutorial for the STM32F series, but I have also looked at the example code in the STMCube IDE. But it still does not work. 

I got the ADC_DMA example to work and give me values. But I want to get it to work when I can configure the chip pins via the.IOC file.

 I feel like setting up a project with the ability to set pins this way is better, but am I right?

On my Nucleo board, LD8 at the bottom of the board next to the label VBUS lights up when running the program. I can't find anything which tells me why this is. But could this be an indication of my problem?

I have attached some of my code, as hopefully, it may answer some questions. I can't attach it all as it is "too large."

Sorry if my post is confusing. Thank you in advance for any help.

 
#define ADC_CONVERTED_DATA_BUFFER_SIZE ((uint32_t) 32) /* Size of array aADCxConvertedData[] */
 
 
ALIGN_32BYTES (static uint16_t aADCxConvertedData[ADC_CONVERTED_DATA_BUFFER_SIZE]);
 
 
 
 if (HAL_ADC_Start_DMA(&hadc1,
 (uint32_t *)aADCxConvertedData,
 ADC_CONVERTED_DATA_BUFFER_SIZE
 ) != HAL_OK)
 {
 Error_Handler();
 }

This topic has been closed for replies.

5 replies

Tesla DeLorean
Guru
April 8, 2021

What memory is it going into? What are MPU settings for that?

Cache coherency?

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
KSOdin2
KSOdin2Author
Associate III
April 9, 2021

I Currently I have the D-Cache and I-Cache enabled.

When I add "aADCxConvertedData" to memory it seems the address is 0x20000100. This is SRAM

I'm a bit unsure where I should look for MPU setting and Cache coherency. Any link you suggest for me to look at?

Sorry for not being helpful

Piranha
Principal III
April 9, 2021

STM32H7 is one of the most complex MCUs out there and it's a very bad choice for beginners.

And D-cache is definitely not for beginners. Disable it until you learn how it works.

The related information can be found in AN4838 and AN4839.

KSOdin2
KSOdin2Author
Associate III
April 9, 2021

@Piranha (Community Member)​ I have to use the STMH7 unfortunately for it's high sampling ADC. Thank you for those links I'll work my way through them.

Do I have to use D-cache for DMA ADC transfer?

Thanks again!

KSOdin2
KSOdin2Author
Associate III
April 9, 2021

@Piranha​ I have to use the STMH7 unfortunately for it's high sampling ADC. Thank you for those links I'll work my way through them.

Do I have to use D-cache for DMA ADC transfer?

Thanks again!