cancel
Showing results for 
Search instead for 
Did you mean: 

stm32f373 SDADC doesnt work when USB starts

embedelektrik
Associate II
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.

4 REPLIES 4
Zt Liu
Senior III
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?

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

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.

Posted on July 09, 2017 at 23:05

Yes, I can.

I'm using CubeMX just to generate pinout. I don't use HAL.

stm32373c_eval.c is in VirtualComport_Loopback project from

UM0424 

ST library. It is in project, but no functions was used, so it can be deleted from project.

I downloaded most recent 

STSW-STM32121 v4.1.0. No changes - the bug still exist.

Do you have  such evalboard?