Page 1 of 2
Issue using OTGv1 with CORTEX_ENABLE_WFI_IDLE
Posted: Wed Mar 26, 2014 5:33 pm
by lilvinz
As far as i understand, i should still be able to use USB while having CORTEX_ENABLE_WFI_IDLE enabled.
When i enable WFI, the usb connection becomes unstable and finally fails after some io.
Any ideas?
Cheers,
Vinz
Re: Issue using OTGv1 with CORTEX_ENABLE_WFI_IDLE
Posted: Wed Mar 26, 2014 5:47 pm
by Giovanni
Does this happen on an existing demo? It is hard to imagine why it should fail.
Giovanni
Re: Issue using OTGv1 with CORTEX_ENABLE_WFI_IDLE
Posted: Wed Mar 26, 2014 6:40 pm
by lilvinz
I can reproduce it easily:
Add this to the compiler flags: -DCORTEX_ENABLE_WFI_IDLE=TRUE
Build and flash ChibiOS_2.6.3/demos/ARMCM4-STM32F429-DISCOVERY
Then looking at the linux kernel messages i get:
Code: Select all
[1546067.627257] usb 2-1.7.1: new full-speed USB device number 14 using ehci-pci
[1546067.699349] usb 2-1.7.1: device descriptor read/64, error -32
[1546067.875175] usb 2-1.7.1: device descriptor read/64, error -32
[1546068.051068] usb 2-1.7.1: new full-speed USB device number 15 using ehci-pci
[1546068.122977] usb 2-1.7.1: device descriptor read/64, error -32
[1546068.298802] usb 2-1.7.1: device descriptor read/64, error -32
[1546068.474703] usb 2-1.7.1: new full-speed USB device number 16 using ehci-pci
[1546068.882022] usb 2-1.7.1: device not accepting address 16, error -32
[1546068.954308] usb 2-1.7.1: new full-speed USB device number 17 using ehci-pci
[1546069.361631] usb 2-1.7.1: device not accepting address 17, error -32
[1546069.361958] hub 2-1.7:1.0: unable to enumerate USB device on port 1
Without WFI it looks like this (and actually works):
Code: Select all
[1546203.802844] usb 2-1.7.1: New USB device found, idVendor=0483, idProduct=5740
[1546203.802848] usb 2-1.7.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[1546203.802851] usb 2-1.7.1: Product: ChibiOS/RT Virtual COM Port
[1546203.802854] usb 2-1.7.1: Manufacturer: STMicroelectronics
[1546203.802856] usb 2-1.7.1: SerialNumber: 263
[1546203.803233] cdc_acm 2-1.7.1:1.0: This device cannot do calls on its own. It is not a modem.
[1546203.803252] cdc_acm 2-1.7.1:1.0: ttyACM0: USB ACM device
Cheers,
Vinz
Re: Issue using OTGv1 with CORTEX_ENABLE_WFI_IDLE
Posted: Wed Mar 26, 2014 7:16 pm
by Giovanni
I will give a try over the weekend. The only thing I can think is that executing WFI triggers some low power mode affecting the clock somehow.
Giovanni
Re: Issue using OTGv1 with CORTEX_ENABLE_WFI_IDLE
Posted: Wed Mar 26, 2014 7:31 pm
by lilvinz
Giovanni wrote:I will give a try over the weekend. The only thing I can think is that executing WFI triggers some low power mode affecting the clock somehow.
Thanks. It shouldn't affect the usb clock as in the usb driver the lp enable is not set.
Cheers,
Vinz
Re: Issue using OTGv1 with CORTEX_ENABLE_WFI_IDLE
Posted: Sun Mar 30, 2014 9:49 am
by Giovanni
Hi,
I am unable to reproduce the problem using my setup. When I enable WFI OpenOCD stops operating correctly (I expected this) but the application runs fine, it is enumerated and the shell accepts commands as usual.
I am testing on WinXP, the demo is ARMCMx-STM32F407-DISCOVERY-MEMS, current 2.7.0 trunk.
Is it possible that your Linux host tries to send commands unsupported by the VCom port? it supports only a small subset currently.
Giovanni
Re: Issue using OTGv1 with CORTEX_ENABLE_WFI_IDLE
Posted: Fri Apr 04, 2014 9:24 pm
by lilvinz
Hi,
thanks for trying to reproduce it.
My environment is:
linux 3.8.0-35-generic x86_64
ChibiOS_2.6.3/demos/ARMCM4-STM32F429-DISCOVERY
gcc-arm-none-eabi-4_8-2013q4
I will try to reproduce it using the F407 demo, retry using Windows and try to look at whats going on at the usb level.
Cheers,
Vinz
Re: Issue using OTGv1 with CORTEX_ENABLE_WFI_IDLE
Posted: Fri Apr 04, 2014 9:37 pm
by lilvinz
When doing the test on
ChibiOS_2.6.3/demos/ARMCM4-STM32F407-DISCOVERY-MEMS
i can't reproduce the issue.
On
ChibiOS_2.6.3/demos/ARMCM4-STM32F429-DISCOVERY
i can.
I will try to figure out, whats the difference of these two demos on the usb side.
differences so far:
Re: Issue using OTGv1 with CORTEX_ENABLE_WFI_IDLE
Posted: Sun Apr 06, 2014 10:09 am
by lilvinz
Ok this was a tough one, it only happens for the OTG HS without external PHY.
After fiddeling around a long time i finally found the solution:
It seems that OTGHSULPILPEN and OTGHSLPEN are mutually exclusive (not that this was mentioned anywhere in any datasheet...) and thus the OTG HS was being clock halted in WFI when using it in FS mode without external PHY.
reference:
https://my.st.com/public/STe2ecommuniti ... tviews=469Cheers,
Vinz
Re: Issue using OTGv1 with CORTEX_ENABLE_WFI_IDLE
Posted: Sun Apr 06, 2014 11:27 am
by Giovanni
Hi,
Thanks for findings, that was giving me trouble. I will commit a fix in the afternoon.
Giovanni