cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F102 Has anyone got USB working?

dan10
Associate II
Posted on June 22, 2009 at 23:30

STM32F102 Has anyone got USB working?

5 REPLIES 5
dan10
Associate II
Posted on May 17, 2011 at 13:14

I am using the stm32f102c8 processor. Iv got all the hardware I am using apart from the USB, which I had running fine on the stm32f103.

If I look at the USB d+ pin it is constantly held high, and I don't see any data what so ever appear. The d- pin remains low.

Iv checked the clock speed is running at 48MHz by outputing it the the PA8 pin. (I have 8 MHz xtal, PLL x6 = 48. and USB RCC is set to DIV1.

All that happens is the code gets stuck in while ( pInformation->Current_Configuration == 0 )

and UNKNOWN device appears in the windows device manager. I have tried everything, iv altered the stack and heap sizes, I am using the USB dev kit library v1.00. The USB interrupt does fire when first powering on.

When i use the debugger on the stm32f103 the USB_Istr() routine runs correctly and i can reach breakpoints at this point in the code (where *** = breakpoint)

if (wIstr & ISTR_SOF & wInterrupt_Mask)

{

*** _SetISTR((u16)CLR_SOF);

*** bIntPackSOF++;

#ifdef SOF_CALLBACK

SOF_Callback();

#endif

}

on the STM32f103 this occurs when WINST = 0x1b00 && int mask = 8600

on the STM32f102 these breakpoints never occur.

In my HW_Config.c file on the stm32f103 I have not had to configure the gpio pins to alternate function or anything like that. Should I be configuring the USB pins at all?

I would be very appreciative to hear of any suggestions you may have.

Regards

Dan

dan10
Associate II
Posted on May 17, 2011 at 13:14

Actually I can see the lines being toggled during the initialisation, probably by the PC this happens for about a second and then the PC reports unrecognised device. The same code works perfectly on the STM32F103, but not the 102?? any ideas?

16-32micros
Associate III
Posted on May 17, 2011 at 13:14

Hi dan,

Great idea for the checklist :-}, I will add it in the things to do for you. in the meantime you can have look on our FAQs regarding USB, click in the right side of the page and browse.

Thanks again

Cheers

STOne-32.

dan10
Associate II
Posted on May 17, 2011 at 13:14

Update: I have managed to resolve the issue. Embarrassingly it was not a software fault, but an error on our PCB. D+ and D- were the wrong way around.

I think however maybe a USB checklist would be a good idea in this forum to help people troubleshoot the USB issues.

bbowling
Associate II
Posted on May 17, 2011 at 13:14

Quote:

On 10-06-2009 at 13:05, Anonymous wrote:

Update: I have managed to resolve the issue. Embarrassingly it was not a software fault, but an error on our PCB. D+ and D- were the wrong way around.

I think however maybe a USB checklist would be a good idea in this forum to help people troubleshoot the USB issues.

I did a very similar thing, my mistake was to tie the wrong D signal with the pullup resistor for enumeration. Kept on getting windows errors this way - took 2 weeks to figure out. So, yes, checking the USB signal lines for proper placement is a good idea...

- Bruce