AnsweredAssumed Answered

stm32f373 SDADC doesnt work when USB starts

Question asked by ra.max on Jul 6, 2017
Latest reply on Jul 9, 2017 by ra.max

I'm using STM32F3xx USB full speed device library (UM0424), it works well. And I need SDADC in my project. So I wrote simple test:

start conversion in SysTick every 100ms

 

void SysTick_Handler(void)
{
if(adc_ready)
   {
   adc_ready=false;
   GPIO_SetBits(GPIOB, GPIO_Pin_7);
   SDADC_SoftwareStartInjectedConv(SDADC1);
   }
};

//**********************************************************

in SDADC interrupt I send data to debug UART port:

 

void SDADC1_IRQHandler(void)
{
if(SDADC_GetFlagStatus(SDADC1, SDADC_FLAG_JEOC) != RESET)

         {
         if(adc_ready==false)
                           {
                           adc1 = SDADC1->JDATAR;
                           send_Uart(USART2,adc1>>8);
                           adc_ready=true;
                           GPIO_ResetBits(GPIOB, GPIO_Pin_7);//led off
                           }
            SDADC_ClearITPendingBit(SDADC1, SDADC_IT_JEOC);
            }
}

//**********************************************************

and right after usb initialisation in main:

Set_USBClock();
USB_Interrupts_Config();
GPIO_SetBits(GPIOA, GPIO_Pin_15);//usb conn
USB_Init();

 

I got garbage in terminal. And I see that conversion time dramatically reduced from about 177 uS to 14 uS.

If I skip USB initialisation ADC works quite well.

 

And it is impossible to debug USB source because you cant pause usb communication  

I'm using Keil IDE.

 

I attached full Keil project.

Attachments

Outcomes