cancel
Showing results for 
Search instead for 
Did you mean: 

ADC triple mode and sending via usb problem

NGrb.1
Associate

Hi everyone ! I have a problem . I started a triple mode ADC and I wanna send ADC data via usb (CDC) FS .

But my problem is , when my input length of HAL_ADCEx_MultiModeStart_DMA() is more than 256 , my sent_bytes[] numbers won,t be correct . but for numbers below 256 , sent_bytes[] are correctly added by 10 ; Please help me to send my Triple ADC data via USB .

/* USER CODE BEGIN PV */

uint16_t adc_data[512];

uint8_t sent_bytes[1408];

extern uint8_t sendFlag ;

uint8_t first_time_start = 1 ;

/* USER CODE END PV */

------------------------------------------------------------------------------------------------------------------------------

/* USER CODE BEGIN PFP */

extern void Send_Via_USB(uint8_t* Buf, uint32_t Len) ;

/* USER CODE END PFP */

---------------------------------------------------------------------------------------------------------------------------------

 /* USER CODE BEGIN 2 */

HAL_TIM_Base_Start_IT(&htim6);

 /* USER CODE END 2 */

-------------------------------------------------------------------------------------------------------------------------------

void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)

{

 /* USER CODE BEGIN Callback 0 */

 /* USER CODE END Callback 0 */

 if (htim->Instance == TIM1) {

  HAL_IncTick();

 }

 /* USER CODE BEGIN Callback 1 */

if(htim ->Instance == TIM6)

{

Timer6_Interrupt_Handler ();

}

 /* USER CODE END Callback 1 */

}

-----------------------------------------------------------------------------------------------------------------------------------

/* USER CODE BEGIN 4 */

void Timer7_Interrupt_Handler (void)

{

if(sendFlag == 1)

{

if( first_time_start == 1 )

{

HAL_ADC_Start(&hadc3);

HAL_ADC_Start(&hadc2);

HAL_ADCEx_MultiModeStart_DMA(&hadc1,(uint32_t *)adc_data,256);

first_time_start = 0 ;

}

sent_bytes [1] = sent_bytes[1] + 10 ;

sent_bytes [2] = sent_bytes[2] + 10 ;

sent_bytes [3] = sent_bytes[3] + 10 ;

Send_Via_USB( sent_bytes , 1408 ) ;

}

}

/* USER CODE END 4 */

-----------------------------------------------------------------------------------------------------------------------------------

0 REPLIES 0