cancel
Showing results for 
Search instead for 
Did you mean: 

USB OTG device mode problem

mats239955
Associate
Posted on May 28, 2012 at 09:00

We have a problem with the STM32F105 USB endpoint interrupts.

The code is basically the VCP sample (V3.3.0) but with the UART removed and instead the USB code reads/writes fifos connected to the rest of the STM code.

From start everything works well, we get the ''INTR_SOFINTR_Callback'' and fills transmit buffer, then we get the ''EP1_IN_Callback'' where we can add more data to send. We also get ''EP3_OUT_Callback'' when PC sends data.

The problem arises when we increase the traffic in either direction.

If we start to send more data from PC then suddenly the ''EP3_OUT_Callback'' stops coming.

If we on the other hand start to send more data to PC then suddenly the ''EP1_IN_Callback'' stops coming.

The ''INTR_SOFINTR_Callback'' works all the time.

Closing and reopening the COM-port on the PC does not help.

Removing and replugging the �SB cable does not help either.

Rebooting the STM32 does help so it seems that the fault are in the STM32 end.

Anyone that have seen the same behaviour?

Any ideas where to start looking when debugging?

Thankful for any help!

#usb-otg-vcp-interrupt
1 REPLY 1
mats239955
Associate
Posted on May 28, 2012 at 11:58

Update:

We found that the reason for the problem was that we called ''OTGD_FS_DisableGlobalInt'' and ''OTGD_FS_EnableGlobalInt'' to protect our queues.

According to manual this register should not be updated more than at initialization so this was clearly a bug.

By using the NVIC instead disabling/enabling ''OTG_FS_IRQn'' the problem was solved.