Serial over USB driver on STM32, cable unplug detecting
Moderators: RoccoMarco, lbednarz, tfAteba
- Giovanni
- Site Admin
- Posts: 14891
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: Serial over USB driver on STM32, cable unplug detecting
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
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
- Prof. Dr. YoMan
- Posts: 57
- Joined: Thu May 24, 2012 11:00 am
- Been thanked: 1 time
- Giovanni
- Site Admin
- Posts: 14891
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: Serial over USB driver on STM32, cable unplug detecting
Trunk is good enough most of time, if I am going to break something usually I post it in the development forum.
Giovanni
Giovanni
- Prof. Dr. YoMan
- Posts: 57
- Joined: Thu May 24, 2012 11:00 am
- Been thanked: 1 time
Re: Serial over USB driver on STM32, cable unplug detecting
And then: Back on topic. Thanks for the break.
- Giovanni
- Site Admin
- Posts: 14891
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: Serial over USB driver on STM32, cable unplug detecting
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
Giovanni
- Prof. Dr. YoMan
- Posts: 57
- Joined: Thu May 24, 2012 11:00 am
- Been thanked: 1 time
Re: Serial over USB driver on STM32, cable unplug detecting
Which git mirror should I use?
Homepage: https://github.com/mabl/ChibiOS
This? https://github.com/ChibiOS-Upstream/ChibiOS-RT
That? https://github.com/ChibiOS/ChibiOS-RT-Community
Is 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.
Homepage: https://github.com/mabl/ChibiOS
This? https://github.com/ChibiOS-Upstream/ChibiOS-RT
That? https://github.com/ChibiOS/ChibiOS-RT-Community
Is 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.
- Giovanni
- Site Admin
- Posts: 14891
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: Serial over USB driver on STM32, cable unplug detecting
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
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
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:
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. */
- Giovanni
- Site Admin
- Posts: 14891
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: Serial over USB driver on STM32, cable unplug detecting
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
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
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?