/var/www/restricted/ssh/stm32/www/stm32circle/ STM CircleOS forum / USB disconnect

Username:     
Password:     
             

Forum

# 1   2008-09-09 15:17:50 USB disconnect (project: PrimerVirtualCom 1.1)

jacques
Member
Registered: 2008-09-02
Posts: 10

USB disconnect (project: PrimerVirtualCom 1.1)

Hello,
you have to disconnect and reconnect the usb cable  when the software is running,
good.
but what if the USB supply the board ?? (with no batteries)

Last edited by jacques (2008-09-09 15:19:48)

Offline

 

# 2   2008-09-09 16:22:46 USB disconnect (project: PrimerVirtualCom 1.1)

matloub
Member
Registered: 2008-02-21
Posts: 98

Re: USB disconnect (project: PrimerVirtualCom 1.1)

Hi

When tried this project I had two usb plugged on the primer.
One for the debug and an other one for the data sending.
So the one to supply the board should be the one connected to the debug which must not be disconnected.

Matloub

Offline

 

# 3   2008-09-10 13:24:14 USB disconnect (project: PrimerVirtualCom 1.1)

jacques
Member
Registered: 2008-09-02
Posts: 10

Re: USB disconnect (project: PrimerVirtualCom 1.1)

of course  matloub,that obvious, and you can also leave the battery.
but my question is what to do on a target application that should be usb powered ?
do we need  to create hardware to disconnect usb without loosing the power or can we do that with code ?

Last edited by jacques (2008-09-10 13:24:57)

Offline

 

# 4   2008-09-12 07:45:27 USB disconnect (project: PrimerVirtualCom 1.1)

matloub
Member
Registered: 2008-02-21
Posts: 98

Re: USB disconnect (project: PrimerVirtualCom 1.1)

Hi Jacques

Yes if you want to use in this configuration the problem makes sense.

The ST library have an example that uses software disconection of the usb.
Please refer to this post to see if it is what you would like to try to do:
http://www.stm32circle.com/forum/viewtopic.php?id=252

Please note that a driver from ST was needed.
Matloub

Offline

 

# 5   2008-09-18 15:30:58 USB disconnect (project: PrimerVirtualCom 1.1)

Francis
Administrator
From: France-Grenoble
Registered: 2007-07-09
Posts: 890

Re: USB disconnect (project: PrimerVirtualCom 1.1)

The disconnect hardware has not been implemented in the Primer1. It is on the Primer2.

Offline

 

# 6   2008-09-19 16:06:26 USB disconnect (project: PrimerVirtualCom 1.1)

jacques
Member
Registered: 2008-09-02
Posts: 10

Re: USB disconnect (project: PrimerVirtualCom 1.1)

Ok,
by following the advice of jens8051:  RCC_PLLMul_6 instead of 9 to get the right clock with 12Mhz.
and by turning GPIO_Pin_12 to an output,
and  reverting the original state in Audio_speaker like this:

void USB_Cable_Config (FunctionalState NewState)
{
  if (NewState != DISABLE)
  {    GPIO_SetBits(GPIOB, GPIO_Pin_12);    // was ResetBits
  }
  else
  {    GPIO_ResetBits(GPIOB, GPIO_Pin_12);  // was SetBits
  }
}

i was able to port the Audio_speaker USB examlpe to the Primer.

It runs perfectly well with no need to disconect the cable. (WindowsXP)

If you try this, you will also need to change the timer used for PWM to one wich is on the extension conector
i used Timer3 CH2 on PA7 with a simple RC filter to output audio.

Offline

 

Board footer