2023-12-02 08:38 AM
pNodeConfig.SrcAddress = &(ADC1->DR); pNodeConfig.DstAddress = (uint32_t) adc_values_1; pNodeConfig.DataSize = 4*64;
In reference to the above based on an excellent tutorial (STM32U5 Workshop) which I use for nucleo STM32U5A5
https://www.youtube.com/watch?v=_hX6pN2jgYM&list=PLnMKNibPkDnFAy60ZY03q0IK8WztqQKs0&index=8
I struggled to understand what determines the DataSize. How it calculated based on 8 channel ADC12 capture (instead of 4 channels in the tutorial). I looked into the reference manual and it has too many details to narrow down and determine how to set the value correctly.
Solved! Go to Solution.
2023-12-02 09:25 AM
The DataSize parameter you mentioned (pNodeConfig.DataSize) is used in Direct Memory Access (DMA) configurations on STM32 microcontrollers. It specifies the size of the data to be transferred by the DMA controller in terms of bytes.
In your case, you mentioned you're dealing with an 8-channel ADC12 capture. If you're reading 8 channels simultaneously, and each channel provides 4 bytes (assuming 32-bit data for each channel), the calculation for DataSize can be done as follows:
Each conversion of a single channel produces a 32-bit (4-byte) result. So for 8 channels captured simultaneously, the total data size for one complete capture would be:
Total data size = 8 channels * 4 bytes/channel = 32 bytes
Therefore, for 8 channels of ADC12 capture (assuming each channel's conversion result is 32 bits), the DataSize would be 32 bytes.
2023-12-02 09:25 AM
The DataSize parameter you mentioned (pNodeConfig.DataSize) is used in Direct Memory Access (DMA) configurations on STM32 microcontrollers. It specifies the size of the data to be transferred by the DMA controller in terms of bytes.
In your case, you mentioned you're dealing with an 8-channel ADC12 capture. If you're reading 8 channels simultaneously, and each channel provides 4 bytes (assuming 32-bit data for each channel), the calculation for DataSize can be done as follows:
Each conversion of a single channel produces a 32-bit (4-byte) result. So for 8 channels captured simultaneously, the total data size for one complete capture would be:
Total data size = 8 channels * 4 bytes/channel = 32 bytes
Therefore, for 8 channels of ADC12 capture (assuming each channel's conversion result is 32 bits), the DataSize would be 32 bytes.
2023-12-02 05:20 PM
Thank it now makes sense. I wondered why this tutorial uses Datasize = 64 x 2 number for 4 ADC12 channels, which should be 4 channels * 4 bytes = 16.