Skip to main content
embedelektrik
Associate
July 6, 2017
Question

stm32f373 SDADC doesnt work when USB starts

  • July 6, 2017
  • 4 replies
  • 1223 views
Posted on July 06, 2017 at 09:43

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.

    This topic has been closed for replies.

    4 replies

    Zt Liu
    Senior III
    July 8, 2017
    Posted on July 08, 2017 at 16:59

    It's a custom board? Can you show your schematic? Looks not like F373 EVAL board.

    Do you consider to refresh your library to CubeF3 1.8.0?

    embedelektrik
    Associate
    July 8, 2017
    Posted on July 08, 2017 at 17:28

    Yes, this is my own board. I didnt make sch file because of simplicity. I draw pcb looking at CubeMX pinout.0690X00000607SVQAY.png0690X00000607REQAY.png

    Zt Liu
    Senior III
    July 8, 2017
    Posted on July 08, 2017 at 17:52

    Товарищ,

    It's difficult for me to understand you.

    You can layout without a schematic?

    You are using CubeMX without generating a HAL/LL project, and still using StdLibrary?

    In your project, you are still have stm32373c_eval.c without using it.