Hello hope to find some solution to my problem. Namely, I use the HAL, cubeMX and STM Studio libraries (I tried to cover the registers, but I would like to leave it for the future). I measure on two ADC channels and use DMA to save 256 elements in two arrays. When I write data to a table from a single channel, everything works as it should, and when I use two, in STM studio I see that the measurements are taking place normally, but when I look at the values in the tables, they are not updated.
My question is, is it possible that STM Studio is not comfortable with displaying data, or whether the reason is in the operation of the program itself, the whole thing is very simple and looks like this.
Declared variables:
Starting ADC measurements by DMA:
And the same interrupt where I would like to rewrite the values
I am adding the ADC and DMA configuration generated by Cuba, but I do not know if the program itself has a chance to work
I've read a lot about it, but it's a bit overwhelming for me to quit HAL and Cuba at the moment, so I'd be grateful for any information that might help me understand why it's not working as it should.
I can add that I plan to take audio signals from two microphones and perform a cross-correlation algorithm to determine the direction from which the sound comes. Ultimately, after crossing the trigger threshold, I would like to make a few more measurements and then determine for which shift the correlation is the greatest. If it turned out that I overestimated my abilities, I would not despise some alternative way of achieving it.
My question is, is it possible that STM Studio is not comfortable with displaying data, or whether the reason is in the operation of the program itself, the whole thing is very simple and looks like this.
Declared variables:
uint32_t PomiarADC[2];
uint32_t sygnalL[200], sygnalR[200];
int i = 0;
Starting ADC measurements by DMA:
HAL_ADC_Start_DMA(&hadc1, PomiarADC, 2);
And the same interrupt where I would like to rewrite the values
void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef* hadc) {
sygnalL[i] = PomiarADC[0];
sygnalR[i] = PomiarADC[1];
if (i >= 200)
i = 0;
else
i++;
}
I am adding the ADC and DMA configuration generated by Cuba, but I do not know if the program itself has a chance to work
static void MX_ADC1_Init(void)
{
ADC_ChannelConfTypeDef sConfig;
/**Configure the global features of the ADC (Clock, Resolution, Data Alignment and number of conversion)
*/
hadc1.Instance = ADC1;
hadc1.Init.ClockPrescaler = ADC_CLOCK_SYNC_PCLK_DIV2;
hadc1.Init.Resolution = ADC_RESOLUTION_12B;
hadc1.Init.ScanConvMode = ENABLE;
hadc1.Init.ContinuousConvMode = ENABLE;
hadc1.Init.DiscontinuousConvMode = DISABLE;
hadc1.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_NONE;
hadc1.Init.ExternalTrigConv = ADC_SOFTWARE_START;
hadc1.Init.DataAlign = ADC_DATAALIGN_RIGHT;
hadc1.Init.NbrOfConversion = 2;
hadc1.Init.DMAContinuousRequests = ENABLE;
hadc1.Init.EOCSelection = ADC_EOC_SEQ_CONV;
if (HAL_ADC_Init(&hadc1) != HAL_OK)
{
_Error_Handler(__FILE__, __LINE__);
}
/**Configure for the selected ADC regular channel its corresponding rank in the sequencer and its sample time.
*/
sConfig.Channel = ADC_CHANNEL_1;
sConfig.Rank = 1;
sConfig.SamplingTime = ADC_SAMPLETIME_15CYCLES;
if (HAL_ADC_ConfigChannel(&hadc1, &sConfig) != HAL_OK)
{
_Error_Handler(__FILE__, __LINE__);
}
/**Configure for the selected ADC regular channel its corresponding rank in the sequencer and its sample time.
*/
sConfig.Channel = ADC_CHANNEL_2;
sConfig.Rank = 2;
if (HAL_ADC_ConfigChannel(&hadc1, &sConfig) != HAL_OK)
{
_Error_Handler(__FILE__, __LINE__);
}
}
/**
* Enable DMA controller clock
*/
static void MX_DMA_Init(void)
{
/* DMA controller clock enable */
__HAL_RCC_DMA2_CLK_ENABLE();
/* DMA interrupt init */
/* DMA2_Stream0_IRQn interrupt configuration */
HAL_NVIC_SetPriority(DMA2_Stream0_IRQn, 0, 0);
HAL_NVIC_EnableIRQ(DMA2_Stream0_IRQn);
}
I've read a lot about it, but it's a bit overwhelming for me to quit HAL and Cuba at the moment, so I'd be grateful for any information that might help me understand why it's not working as it should.
I can add that I plan to take audio signals from two microphones and perform a cross-correlation algorithm to determine the direction from which the sound comes. Ultimately, after crossing the trigger threshold, I would like to make a few more measurements and then determine for which shift the correlation is the greatest. If it turned out that I overestimated my abilities, I would not despise some alternative way of achieving it.