Page 3 of 4
Re: Serial over USB driver on STM32, cable unplug detecting
Posted: Mon Nov 26, 2012 7:03 pm
by Giovanni
Usually a backport is allowed if the updated is localized in a single module and does not break compatibility too much. The USB driver is very different now so I have to make some verifications first.
For new projects I recommend using 2.5.x for development, it is stable enough, and wait 2.6.x for deployment. 2.4.x and 2.2.x are legacy.
Giovanni
Re: Serial over USB driver on STM32, cable unplug detecting
Posted: Tue Nov 27, 2012 12:31 am
by Prof. Dr. YoMan
Ok. Trunk or 2.5.x for development?
Re: Serial over USB driver on STM32, cable unplug detecting
Posted: Tue Nov 27, 2012 8:33 am
by Giovanni
Trunk is good enough most of time, if I am going to break something usually I post it in the development forum.
Giovanni
Re: Serial over USB driver on STM32, cable unplug detecting
Posted: Tue Nov 27, 2012 9:31 am
by Prof. Dr. YoMan

I switch the question around: Do I miss a lot, if I am on 2.5.x and not trunk?
And then: Back on topic. Thanks for the break.
Re: Serial over USB driver on STM32, cable unplug detecting
Posted: Tue Nov 27, 2012 9:34 am
by Giovanni
You do miss a lot, just read the readme in the trunk version, all differences are listed there. The trunk is always the most up to date and includes all fixes for known bugs.
Giovanni
Re: Serial over USB driver on STM32, cable unplug detecting
Posted: Tue Nov 27, 2012 5:08 pm
by Prof. Dr. YoMan
Which git mirror should I use?
Homepage:
https://github.com/mabl/ChibiOSThis?
https://github.com/ChibiOS-Upstream/ChibiOS-RTThat?
https://github.com/ChibiOS/ChibiOS-RT-CommunityIs made sure that the git-hashes do not change in the feature, because I want to use one of them as module in my projects.
Re: Serial over USB driver on STM32, cable unplug detecting
Posted: Tue Nov 27, 2012 5:18 pm
by Giovanni
Hi,
The official repository is the subversion one on the SourceForge page. The GIT mirror listed in the homepage is the mirror.
The other two... I simply didn't understand what are they for.
Giovanni
Re: Serial over USB driver on STM32, cable unplug detecting
Posted: Sat Apr 26, 2014 7:34 pm
by alexblack
Hi.
I tested new STM32F429 MCU and found that in usb driver there is no USB_EVENT_SUSPEND detection which I used for usb cable unplug detectiong. Is there any reason fo this?
I pathed the driver and all works now:
Code: Select all
Index: usb_lld.c
===================================================================
--- usb_lld.c (revision 6883)
+++ usb_lld.c (working copy)
@@ -616,6 +616,11 @@
_usb_isr_invoke_event_cb(usbp, USB_EVENT_RESET);
}
+ /* USB bus SUSPEND condition handling.*/
+ if (sts & GINTSTS_USBSUSP) {
+ _usb_isr_invoke_event_cb(usbp, USB_EVENT_SUSPEND);
+ }
+
/* Enumeration done.*/
if (sts & GINTSTS_ENUMDNE) {
(void)otgp->DSTS;
@@ -915,10 +920,10 @@
otgp->DOEPMSK = 0;
otgp->DAINTMSK = 0;
if (usbp->config->sof_cb == NULL)
- otgp->GINTMSK = GINTMSK_ENUMDNEM | GINTMSK_USBRSTM /*| GINTMSK_USBSUSPM |
+ otgp->GINTMSK = GINTMSK_ENUMDNEM | GINTMSK_USBRSTM | GINTMSK_USBSUSPM /*|
GINTMSK_ESUSPM |*/;
else
- otgp->GINTMSK = GINTMSK_ENUMDNEM | GINTMSK_USBRSTM /*| GINTMSK_USBSUSPM |
+ otgp->GINTMSK = GINTMSK_ENUMDNEM | GINTMSK_USBRSTM | GINTMSK_USBSUSPM /*|
GINTMSK_ESUSPM */ | GINTMSK_SOFM;
otgp->GINTSTS = 0xFFFFFFFF; /* Clears all pending IRQs, if any. */
Re: Serial over USB driver on STM32, cable unplug detecting
Posted: Sat Apr 26, 2014 8:02 pm
by Giovanni
Hi,
The problem is the other way, 2.4.x is unable to detect that #SV10 error, 2.6.x has a state checker.
The lock is required because an higher priority interrupt could preempt chVTSetI() in the middle corrupting the timers list.
The lock-unlock protocol ensures that there cannot be race conditions related to kernel calls.
Giovanni
Re: Serial over USB driver on STM32, cable unplug detecting
Posted: Fri May 29, 2015 10:16 am
by GSE
In current version of 2.6.x, STM32 usb_lld.c usb event USB_EVENT_SUSPEND no handling more. How to realize USB cable unplug event in this case? 5V monitoring not so clean way. Why this event handling removed?