usb_event called not within interrupt handler Topic is solved

Report here problems in any of ChibiOS components. This forum is NOT for support.
User avatar
HDKLog
Posts: 37
Joined: Thu Aug 18, 2016 12:36 am
Been thanked: 2 times

usb_event called not within interrupt handler  Topic is solved

Postby HDKLog » Tue Nov 06, 2018 11:44 am

Hello!
I'm using USB driver with CDC on board with STM32F103 MCU and it works fine but when I turn on debug checks system halts on chSysLockFromISR() within usb_event() callback function at start when I call usbStart() in main. Is there something wrong?

I use ChibiOS version 182 and here is my call stack:
Untitled.png

User avatar
Giovanni
Site Admin
Posts: 11651
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 488 times
Been thanked: 409 times
Contact:

Re: usb_event called not within interrupt handler

Postby Giovanni » Tue Nov 06, 2018 2:40 pm

Hi,

Moved in "bug reports", I need to verify this.

Giovanni

User avatar
HDKLog
Posts: 37
Joined: Thu Aug 18, 2016 12:36 am
Been thanked: 2 times

Re: usb_event called not within interrupt handler

Postby HDKLog » Tue Nov 06, 2018 4:04 pm

I think _usb_reset() in hal_usb.c is the place to look in. It calls _usb_isr_invoke_event_cb(usbp, USB_EVENT_RESET) which then calls usb_event().

User avatar
HDKLog
Posts: 37
Joined: Thu Aug 18, 2016 12:36 am
Been thanked: 2 times

Re: usb_event called not within interrupt handler

Postby HDKLog » Wed Nov 21, 2018 9:26 pm

Giovanni wrote:Hi,

Moved in "bug reports", I need to verify this.

Giovanni


Hello Giovanni. Did you check this bug? I don't see any tickets related to it on sourceforge in section bugs.

User avatar
Giovanni
Site Admin
Posts: 11651
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 488 times
Been thanked: 409 times
Contact:

Re: usb_event called not within interrupt handler

Postby Giovanni » Wed Nov 21, 2018 9:28 pm

Hi,

When a problem is reported via forum I usually create the ticket when I start working on it. Probably next weekend, immediately after the current thing (RTC driver revamp).

Giovanni

User avatar
Giovanni
Site Admin
Posts: 11651
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 488 times
Been thanked: 409 times
Contact:

Re: usb_event called not within interrupt handler

Postby Giovanni » Sun Dec 02, 2018 6:56 am

Hi,

I have been unable to reproduce the problem in 17.6, 18.1 and trunk, which ChibiOS version are you using?

Giovanni

User avatar
Giovanni
Site Admin
Posts: 11651
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 488 times
Been thanked: 409 times
Contact:

Re: usb_event called not within interrupt handler

Postby Giovanni » Wed Dec 05, 2018 8:05 pm

Ah, it is 18.2, you specified it and I missed it...

I tested the usual USB_CDC demo and it does not trigger the problem. From usb_lld_start() there is no explicit path to usb_event(), very strange, I don't see how it can get there. The only place where _usb_reset() is called is the ISR...

What compiler are you using? if GCC, which one? using ChibiOS startups?

More questions, do you have custom interrupt handlers in your code? or a custom NVIC initialization? it looks like the USB IRQ is able to preempt within critical sections.

Giovanni

User avatar
HDKLog
Posts: 37
Joined: Thu Aug 18, 2016 12:36 am
Been thanked: 2 times

Re: usb_event called not within interrupt handler

Postby HDKLog » Thu Jan 10, 2019 11:31 pm

Hello Giovanni, Sorry for late response, I was busy with projects and don't have notifications enabled.
I have installed ChibiStudio preview on Windows 7 and correct me if I'm wrong, it uses GCC, OpenOCD and GDB fro debuging. there was available GCC 5.4 and 7.0, I don't remember exactly but I think I tried both compilers and also I used ChibiOS 182. I changed my computer OS and now I'm running Linux(Ubuntu) and not able to reproduce this assertion with GCC 5.4 and 7.4 using ChibiOS 182. I have ChibiStudio Installed on the computer at workspace and will try to reproduce it there in few days. I use PAL driver events and callback to capture some radio module events and wake up some some suspended threads from callback to process reception.

User avatar
HDKLog
Posts: 37
Joined: Thu Aug 18, 2016 12:36 am
Been thanked: 2 times

Re: usb_event called not within interrupt handler

Postby HDKLog » Wed Jan 16, 2019 3:02 pm

Hello Giovanni, I tested my code on the workspace computer and wasn't able to reproduce error. I don't remember all details of my test where I have catched this error and everything seems to work fine. If I will catch this error again I will let you know with all details and conditions.


Return to “Bug Reports”

Who is online

Users browsing this forum: Google [Bot] and 5 guests