ASSERT failure in USB HID


Yannis Damigos
 

Hi Joe,

I try USB HID sample on my 96b_carbon with ASSERTs enabled and it fails with a different error.

***** USAGE FAULT *****
Executing thread ID (thread): 0x20000938
Faulting instruction address: 0x8001e82
Division by zero
Fatal fault in essential thread! Spinning...

I added developers mailing list to give greater visibility to the problem.

Yannis

On 03/29/2018 05:27 PM, Johannes Hutter wrote:
Hey Yannis,

first of all, thanks for the support on the Zephyr Mailing List the last weeks. I don't want to spam the list too much, that's why I'm writing you directly. If you prefer to keep the questions on the mailing list, I am happy to do that.


Now my question: The USB HID configuration works perfectly fine (I basically simulate a keyboard). But if I enable ASSERTs my program (and also the USB HID sample) fails during boot with following log:


[general] [DBG] HAL_PCD_ResetCallback:
[usb/hid] [DBG] hid_status_cb: USB device reset detected
[general] [DBG] HAL_PCD_SetupStageCallback:
[general] [DBG] usb_handle_control_transfer: usb_handle_control_transfer ep 0, status 0
[general] [DBG] usb_dc_ep_read_wait: ep 0x00, 8 bytes, 0+8, 0x20009bb4
[general] [DBG] usb_handle_request: ** 0 **
[usb/hid] [DBG] hid_custom_handle_req: Standard request: bRequest 0x6 bmRequestType 0x80 len 64
[general] [DBG] usb_handle_std_device_req: REQ_GET_DESCRIPTOR
[general] [DBG] usb_dc_ep_write: ep 0x80, len 18
[general] [DBG] usb_dc_ep_transfer: ep 0x80, len=18, in=1, sync=no
ASSERTION FAIL [!_IsInIsr()] @ /home/joe/code/proglove/embed/mark_one_s_firmware/lib/zephyr/kernel/sched.c:328:


Would you be so kind and try to run the sample on your boards with ASSERTs enabled? Just to find out whether the problem is on my custom board side or not.

Thanks a lot and best regards,

Joe


--

Johannes Hutter | Embedded Software Engineer
Mail: johannes@proglove.de <mailto:johannes@proglove.de>




Workaround GmbH (ProGlove)
Friedenstr. 4 | 81671 München

Managing Director: Thomas Kirchner
HRB: 216605 | AG München
USt.-IdNr.: DE298859320


Johannes Hutter
 

I got hands on a nucleo-f411re and actually encounter the same issue. I also observed that the callback is set for the endpoints 0x00, 0x80 and 0x81 (the last one being the configured HID endpoint), but the enable function is only called for the first two. Does anyone have an idea what the issue is there?


On 29.03.2018 20:53, Yannis Damigos wrote:
Hi Joe,

I try USB HID sample on my 96b_carbon with ASSERTs enabled and it fails with a different error.

***** USAGE FAULT *****
  Executing thread ID (thread): 0x20000938
  Faulting instruction address:  0x8001e82
  Division by zero
Fatal fault in essential thread! Spinning...

I added developers mailing list to give greater visibility to the problem.

Yannis

On 03/29/2018 05:27 PM, Johannes Hutter wrote:
Hey Yannis,

first of all, thanks for the support on the Zephyr Mailing List the last weeks. I don't want to spam the list too much, that's why I'm writing you directly. If you prefer to keep the questions on the mailing list, I am happy to do that.


Now my question: The USB HID configuration works perfectly fine (I basically simulate a keyboard). But if I enable ASSERTs my program (and also the USB HID sample) fails during boot with following log:


[general] [DBG] HAL_PCD_ResetCallback:
[usb/hid] [DBG] hid_status_cb: USB device reset detected
[general] [DBG] HAL_PCD_SetupStageCallback:
[general] [DBG] usb_handle_control_transfer: usb_handle_control_transfer ep 0, status 0
[general] [DBG] usb_dc_ep_read_wait: ep 0x00, 8 bytes, 0+8, 0x20009bb4
[general] [DBG] usb_handle_request: ** 0 **
[usb/hid] [DBG] hid_custom_handle_req: Standard request: bRequest 0x6 bmRequestType 0x80 len 64
[general] [DBG] usb_handle_std_device_req: REQ_GET_DESCRIPTOR
[general] [DBG] usb_dc_ep_write: ep 0x80, len 18
[general] [DBG] usb_dc_ep_transfer: ep 0x80, len=18, in=1, sync=no
ASSERTION FAIL [!_IsInIsr()] @ /home/joe/code/proglove/embed/mark_one_s_firmware/lib/zephyr/kernel/sched.c:328:


Would you be so kind and try to run the sample on your boards with ASSERTs enabled? Just to find out whether the problem is on my custom board side or not.

Thanks a lot and best regards,

Joe


-- 

Johannes Hutter | Embedded Software Engineer
Mail: johannes@... <mailto:johannes@...>


	

Workaround GmbH (ProGlove)
Friedenstr. 4 | 81671 München

Managing Director: Thomas Kirchner
HRB: 216605 | AG München
USt.-IdNr.: DE298859320


    

--

Johannes Hutter | Embedded Software Engineer
Mail: johannes@...


Workaround GmbH (ProGlove)
Friedenstr. 4 | 81671 München

Managing Director: Thomas Kirchner
HRB: 216605 | AG München
USt.-IdNr.: DE298859320


Pushpal Sidhu
 

Resending my last message since zephyr-devel@lists.zephyrproject.org
doesn't exist anymore, but it's now devel@lists.zephyrproject.org.

I'll repeat my last message here:
Just wanted to add that adding a debugger, I see that in the
USB_EPStartXfer() function in the HAL layer (for me, it's the
stm32l4xx_ll_usb.c), ep->maxpacket is set to 0. This causes the divide
by 0 error on this line:

USBx_INEP(ep->num)->DIEPTSIZ |= (USB_OTG_DIEPTSIZ_PKTCNT & (((ep->xfer_len + ep->maxpacket -1)/ ep->maxpacket) << 19)) ;
I haven't delved further than this, however.

- Pushpal

On Fri, Apr 13, 2018 at 12:56 PM, Pushpal Sidhu <psidhu.devel@gmail.com> wrote:
Hi,

On Tue, Apr 3, 2018 at 8:03 AM, Johannes Hutter <johannes@proglove.de> wrote:
I got hands on a nucleo-f411re and actually encounter the same issue. I also
observed that the callback is set for the endpoints 0x00, 0x80 and 0x81 (the
last one being the configured HID endpoint), but the enable function is only
called for the first two. Does anyone have an idea what the issue is there?


On 29.03.2018 20:53, Yannis Damigos wrote:

Hi Joe,

I try USB HID sample on my 96b_carbon with ASSERTs enabled and it fails with
a different error.

***** USAGE FAULT *****
Executing thread ID (thread): 0x20000938
Faulting instruction address: 0x8001e82
Division by zero
Fatal fault in essential thread! Spinning...
Just wanted to add that adding a debugger, I see that in the
USB_EPStartXfer() function in the HAL layer (for me, it's the
stm32l4xx_ll_usb.c), ep->maxpacket is set to 0. This causes the divide
by 0 error on this line:
USBx_INEP(ep->num)->DIEPTSIZ |= (USB_OTG_DIEPTSIZ_PKTCNT & (((ep->xfer_len + ep->maxpacket -1)/ ep->maxpacket) << 19)) ;
I haven't delved further than this, however.

- Pushpal

I added developers mailing list to give greater visibility to the problem.

Yannis

On 03/29/2018 05:27 PM, Johannes Hutter wrote:

Hey Yannis,

first of all, thanks for the support on the Zephyr Mailing List the last
weeks. I don't want to spam the list too much, that's why I'm writing you
directly. If you prefer to keep the questions on the mailing list, I am
happy to do that.


Now my question: The USB HID configuration works perfectly fine (I basically
simulate a keyboard). But if I enable ASSERTs my program (and also the USB
HID sample) fails during boot with following log:


[general] [DBG] HAL_PCD_ResetCallback:
[usb/hid] [DBG] hid_status_cb: USB device reset detected
[general] [DBG] HAL_PCD_SetupStageCallback:
[general] [DBG] usb_handle_control_transfer: usb_handle_control_transfer ep
0, status 0
[general] [DBG] usb_dc_ep_read_wait: ep 0x00, 8 bytes, 0+8, 0x20009bb4
[general] [DBG] usb_handle_request: ** 0 **
[usb/hid] [DBG] hid_custom_handle_req: Standard request: bRequest 0x6
bmRequestType 0x80 len 64
[general] [DBG] usb_handle_std_device_req: REQ_GET_DESCRIPTOR
[general] [DBG] usb_dc_ep_write: ep 0x80, len 18
[general] [DBG] usb_dc_ep_transfer: ep 0x80, len=18, in=1, sync=no
ASSERTION FAIL [!_IsInIsr()] @
/home/joe/code/proglove/embed/mark_one_s_firmware/lib/zephyr/kernel/sched.c:328:


Would you be so kind and try to run the sample on your boards with ASSERTs
enabled? Just to find out whether the problem is on my custom board side or
not.

Thanks a lot and best regards,

Joe


--

Johannes Hutter | Embedded Software Engineer
Mail: johannes@proglove.de <mailto:johannes@proglove.de>




Workaround GmbH (ProGlove)
Friedenstr. 4 | 81671 München

Managing Director: Thomas Kirchner
HRB: 216605 | AG München
USt.-IdNr.: DE298859320


--

Johannes Hutter | Embedded Software Engineer
Mail: johannes@proglove.de


Workaround GmbH (ProGlove)
Friedenstr. 4 | 81671 München

Managing Director: Thomas Kirchner
HRB: 216605 | AG München
USt.-IdNr.: DE298859320


_______________________________________________
Zephyr-devel mailing list
Zephyr-devel@lists.zephyrproject.org
https://lists.zephyrproject.org/mailman/listinfo/zephyr-devel
On Fri, Apr 13, 2018 at 12:56 PM, Pushpal Sidhu <psidhu.devel@gmail.com> wrote:
Hi,

On Tue, Apr 3, 2018 at 8:03 AM, Johannes Hutter <johannes@proglove.de> wrote:
I got hands on a nucleo-f411re and actually encounter the same issue. I also
observed that the callback is set for the endpoints 0x00, 0x80 and 0x81 (the
last one being the configured HID endpoint), but the enable function is only
called for the first two. Does anyone have an idea what the issue is there?


On 29.03.2018 20:53, Yannis Damigos wrote:

Hi Joe,

I try USB HID sample on my 96b_carbon with ASSERTs enabled and it fails with
a different error.

***** USAGE FAULT *****
Executing thread ID (thread): 0x20000938
Faulting instruction address: 0x8001e82
Division by zero
Fatal fault in essential thread! Spinning...
Just wanted to add that adding a debugger, I see that in the
USB_EPStartXfer() function in the HAL layer (for me, it's the
stm32l4xx_ll_usb.c), ep->maxpacket is set to 0. This causes the divide
by 0 error on this line:
USBx_INEP(ep->num)->DIEPTSIZ |= (USB_OTG_DIEPTSIZ_PKTCNT & (((ep->xfer_len + ep->maxpacket -1)/ ep->maxpacket) << 19)) ;
I haven't delved further than this, however.

- Pushpal

I added developers mailing list to give greater visibility to the problem.

Yannis

On 03/29/2018 05:27 PM, Johannes Hutter wrote:

Hey Yannis,

first of all, thanks for the support on the Zephyr Mailing List the last
weeks. I don't want to spam the list too much, that's why I'm writing you
directly. If you prefer to keep the questions on the mailing list, I am
happy to do that.


Now my question: The USB HID configuration works perfectly fine (I basically
simulate a keyboard). But if I enable ASSERTs my program (and also the USB
HID sample) fails during boot with following log:


[general] [DBG] HAL_PCD_ResetCallback:
[usb/hid] [DBG] hid_status_cb: USB device reset detected
[general] [DBG] HAL_PCD_SetupStageCallback:
[general] [DBG] usb_handle_control_transfer: usb_handle_control_transfer ep
0, status 0
[general] [DBG] usb_dc_ep_read_wait: ep 0x00, 8 bytes, 0+8, 0x20009bb4
[general] [DBG] usb_handle_request: ** 0 **
[usb/hid] [DBG] hid_custom_handle_req: Standard request: bRequest 0x6
bmRequestType 0x80 len 64
[general] [DBG] usb_handle_std_device_req: REQ_GET_DESCRIPTOR
[general] [DBG] usb_dc_ep_write: ep 0x80, len 18
[general] [DBG] usb_dc_ep_transfer: ep 0x80, len=18, in=1, sync=no
ASSERTION FAIL [!_IsInIsr()] @
/home/joe/code/proglove/embed/mark_one_s_firmware/lib/zephyr/kernel/sched.c:328:


Would you be so kind and try to run the sample on your boards with ASSERTs
enabled? Just to find out whether the problem is on my custom board side or
not.

Thanks a lot and best regards,

Joe


--

Johannes Hutter | Embedded Software Engineer
Mail: johannes@proglove.de <mailto:johannes@proglove.de>




Workaround GmbH (ProGlove)
Friedenstr. 4 | 81671 München

Managing Director: Thomas Kirchner
HRB: 216605 | AG München
USt.-IdNr.: DE298859320


--

Johannes Hutter | Embedded Software Engineer
Mail: johannes@proglove.de


Workaround GmbH (ProGlove)
Friedenstr. 4 | 81671 München

Managing Director: Thomas Kirchner
HRB: 216605 | AG München
USt.-IdNr.: DE298859320


_______________________________________________
Zephyr-devel mailing list
Zephyr-devel@lists.zephyrproject.org
https://lists.zephyrproject.org/mailman/listinfo/zephyr-devel


Brendan OSullivan <bosullivan@...>
 

Greetings!

"Resending my last message since zephyr-devel@...rproject.org doesn't exist anymore, but it's now devel@....org."

This is due to the prefix change as part of the migration. However, subgroup aliases should have been set up to accommodate this change, and the aliases not being configured correctly is something the LF Helpdesk is already aware of. We have reached out to Groups.io for assistance in getting this resolved as quickly as possible.

Cheers!
Brendan OSullivan


Cheers!
Brendan OSullivan

Helpdesk Analyst

On Fri, Apr 13, 2018 at 4:05 PM, Pushpal Sidhu <psidhu.devel@...> wrote:
Resending my last message since zephyr-devel@lists.zephyrproject.org
doesn't exist anymore, but it's now devel@....

I'll repeat my last message here:
Just wanted to add that adding a debugger, I see that in the
USB_EPStartXfer() function in the HAL layer (for me, it's the
stm32l4xx_ll_usb.c), ep->maxpacket is set to 0. This causes the divide
by 0 error on this line:

> USBx_INEP(ep->num)->DIEPTSIZ |= (USB_OTG_DIEPTSIZ_PKTCNT & (((ep->xfer_len + ep->maxpacket -1)/ ep->maxpacket) << 19)) ;

I haven't delved further than this, however.

- Pushpal

On Fri, Apr 13, 2018 at 12:56 PM, Pushpal Sidhu <psidhu.devel@...> wrote:
> Hi,
>
> On Tue, Apr 3, 2018 at 8:03 AM, Johannes Hutter <johannes@...> wrote:
>> I got hands on a nucleo-f411re and actually encounter the same issue. I also
>> observed that the callback is set for the endpoints 0x00, 0x80 and 0x81 (the
>> last one being the configured HID endpoint), but the enable function is only
>> called for the first two. Does anyone have an idea what the issue is there?
>>
>>
>> On 29.03.2018 20:53, Yannis Damigos wrote:
>>
>> Hi Joe,
>>
>> I try USB HID sample on my 96b_carbon with ASSERTs enabled and it fails with
>> a different error.
>>
>> ***** USAGE FAULT *****
>>   Executing thread ID (thread): 0x20000938
>>   Faulting instruction address:  0x8001e82
>>   Division by zero
>> Fatal fault in essential thread! Spinning...
>
> Just wanted to add that adding a debugger, I see that in the
> USB_EPStartXfer() function in the HAL layer (for me, it's the
> stm32l4xx_ll_usb.c), ep->maxpacket is set to 0. This causes the divide
> by 0 error on this line:
>> USBx_INEP(ep->num)->DIEPTSIZ |= (USB_OTG_DIEPTSIZ_PKTCNT & (((ep->xfer_len + ep->maxpacket -1)/ ep->maxpacket) << 19)) ;
>
> I haven't delved further than this, however.
>
> - Pushpal
>
>> I added developers mailing list to give greater visibility to the problem.
>>
>> Yannis
>>
>> On 03/29/2018 05:27 PM, Johannes Hutter wrote:
>>
>> Hey Yannis,
>>
>> first of all, thanks for the support on the Zephyr Mailing List the last
>> weeks. I don't want to spam the list too much, that's why I'm writing you
>> directly. If you prefer to keep the questions on the mailing list, I am
>> happy to do that.
>>
>>
>> Now my question: The USB HID configuration works perfectly fine (I basically
>> simulate a keyboard). But if I enable ASSERTs my program (and also the USB
>> HID sample) fails during boot with following log:
>>
>>
>> [general] [DBG] HAL_PCD_ResetCallback:
>> [usb/hid] [DBG] hid_status_cb: USB device reset detected
>> [general] [DBG] HAL_PCD_SetupStageCallback:
>> [general] [DBG] usb_handle_control_transfer: usb_handle_control_transfer ep
>> 0, status 0
>> [general] [DBG] usb_dc_ep_read_wait: ep 0x00, 8 bytes, 0+8, 0x20009bb4
>> [general] [DBG] usb_handle_request: ** 0 **
>> [usb/hid] [DBG] hid_custom_handle_req: Standard request: bRequest 0x6
>> bmRequestType 0x80 len 64
>> [general] [DBG] usb_handle_std_device_req: REQ_GET_DESCRIPTOR
>> [general] [DBG] usb_dc_ep_write: ep 0x80, len 18
>> [general] [DBG] usb_dc_ep_transfer: ep 0x80, len=18, in=1, sync=no
>> ASSERTION FAIL [!_IsInIsr()] @
>> /home/joe/code/proglove/embed/mark_one_s_firmware/lib/zephyr/kernel/sched.c:328:
>>
>>
>> Would you be so kind and try to run the sample on your boards with ASSERTs
>> enabled? Just to find out whether the problem is on my custom board side or
>> not.
>>
>> Thanks a lot and best regards,
>>
>> Joe
>>
>>
>> --
>>
>> Johannes Hutter | Embedded Software Engineer
>> Mail: johannes@... <mailto:johannes@...>
>>
>>
>>
>>
>> Workaround GmbH (ProGlove)
>> Friedenstr. 4 | 81671 München
>>
>> Managing Director: Thomas Kirchner
>> HRB: 216605 | AG München
>> USt.-IdNr.: DE298859320
>>
>>
>> --
>>
>> Johannes Hutter | Embedded Software Engineer
>> Mail: johannes@...
>>
>>
>> Workaround GmbH (ProGlove)
>> Friedenstr. 4 | 81671 München
>>
>> Managing Director: Thomas Kirchner
>> HRB: 216605 | AG München
>> USt.-IdNr.: DE298859320
>>
>>
>> _______________________________________________
>> Zephyr-devel mailing list
>> Zephyr-devel@lists.zephyrproject.org
>> https://lists.zephyrproject.org/mailman/listinfo/zephyr-devel
>>

On Fri, Apr 13, 2018 at 12:56 PM, Pushpal Sidhu <psidhu.devel@...> wrote:
> Hi,
>
> On Tue, Apr 3, 2018 at 8:03 AM, Johannes Hutter <johannes@...> wrote:
>> I got hands on a nucleo-f411re and actually encounter the same issue. I also
>> observed that the callback is set for the endpoints 0x00, 0x80 and 0x81 (the
>> last one being the configured HID endpoint), but the enable function is only
>> called for the first two. Does anyone have an idea what the issue is there?
>>
>>
>> On 29.03.2018 20:53, Yannis Damigos wrote:
>>
>> Hi Joe,
>>
>> I try USB HID sample on my 96b_carbon with ASSERTs enabled and it fails with
>> a different error.
>>
>> ***** USAGE FAULT *****
>>   Executing thread ID (thread): 0x20000938
>>   Faulting instruction address:  0x8001e82
>>   Division by zero
>> Fatal fault in essential thread! Spinning...
>
> Just wanted to add that adding a debugger, I see that in the
> USB_EPStartXfer() function in the HAL layer (for me, it's the
> stm32l4xx_ll_usb.c), ep->maxpacket is set to 0. This causes the divide
> by 0 error on this line:
>> USBx_INEP(ep->num)->DIEPTSIZ |= (USB_OTG_DIEPTSIZ_PKTCNT & (((ep->xfer_len + ep->maxpacket -1)/ ep->maxpacket) << 19)) ;
>
> I haven't delved further than this, however.
>
> - Pushpal
>
>> I added developers mailing list to give greater visibility to the problem.
>>
>> Yannis
>>
>> On 03/29/2018 05:27 PM, Johannes Hutter wrote:
>>
>> Hey Yannis,
>>
>> first of all, thanks for the support on the Zephyr Mailing List the last
>> weeks. I don't want to spam the list too much, that's why I'm writing you
>> directly. If you prefer to keep the questions on the mailing list, I am
>> happy to do that.
>>
>>
>> Now my question: The USB HID configuration works perfectly fine (I basically
>> simulate a keyboard). But if I enable ASSERTs my program (and also the USB
>> HID sample) fails during boot with following log:
>>
>>
>> [general] [DBG] HAL_PCD_ResetCallback:
>> [usb/hid] [DBG] hid_status_cb: USB device reset detected
>> [general] [DBG] HAL_PCD_SetupStageCallback:
>> [general] [DBG] usb_handle_control_transfer: usb_handle_control_transfer ep
>> 0, status 0
>> [general] [DBG] usb_dc_ep_read_wait: ep 0x00, 8 bytes, 0+8, 0x20009bb4
>> [general] [DBG] usb_handle_request: ** 0 **
>> [usb/hid] [DBG] hid_custom_handle_req: Standard request: bRequest 0x6
>> bmRequestType 0x80 len 64
>> [general] [DBG] usb_handle_std_device_req: REQ_GET_DESCRIPTOR
>> [general] [DBG] usb_dc_ep_write: ep 0x80, len 18
>> [general] [DBG] usb_dc_ep_transfer: ep 0x80, len=18, in=1, sync=no
>> ASSERTION FAIL [!_IsInIsr()] @
>> /home/joe/code/proglove/embed/mark_one_s_firmware/lib/zephyr/kernel/sched.c:328:
>>
>>
>> Would you be so kind and try to run the sample on your boards with ASSERTs
>> enabled? Just to find out whether the problem is on my custom board side or
>> not.
>>
>> Thanks a lot and best regards,
>>
>> Joe
>>
>>
>> --
>>
>> Johannes Hutter | Embedded Software Engineer
>> Mail: johannes@... <mailto:johannes@...>
>>
>>
>>
>>
>> Workaround GmbH (ProGlove)
>> Friedenstr. 4 | 81671 München
>>
>> Managing Director: Thomas Kirchner
>> HRB: 216605 | AG München
>> USt.-IdNr.: DE298859320
>>
>>
>> --
>>
>> Johannes Hutter | Embedded Software Engineer
>> Mail: johannes@...
>>
>>
>> Workaround GmbH (ProGlove)
>> Friedenstr. 4 | 81671 München
>>
>> Managing Director: Thomas Kirchner
>> HRB: 216605 | AG München
>> USt.-IdNr.: DE298859320
>>
>>
>> _______________________________________________
>> Zephyr-devel mailing list
>> Zephyr-devel@lists.zephyrproject.org
>> https://lists.zephyrproject.org/mailman/listinfo/zephyr-devel
>>


Brendan OSullivan <bosullivan@...>
 

Greetings!

I've just heard back from Groups.io stating this issue should now be resolved. If there's any further trouble with trying to email involving the older list names / prefixes, please let us know.

Cheers!
Brendan OSullivan

Helpdesk Analyst

On Fri, Apr 13, 2018 at 4:29 PM, Brendan OSullivan <bosullivan@...> wrote:
Greetings!

"Resending my last message since zephyr-devel@...rproject.org doesn't exist anymore, but it's now devel@....org."

This is due to the prefix change as part of the migration. However, subgroup aliases should have been set up to accommodate this change, and the aliases not being configured correctly is something the LF Helpdesk is already aware of. We have reached out to Groups.io for assistance in getting this resolved as quickly as possible.

Cheers!
Brendan OSullivan


Cheers!
Brendan OSullivan

Helpdesk Analyst

On Fri, Apr 13, 2018 at 4:05 PM, Pushpal Sidhu <psidhu.devel@...> wrote:
Resending my last message since zephyr-devel@...ct.org
doesn't exist anymore, but it's now devel@....

I'll repeat my last message here:
Just wanted to add that adding a debugger, I see that in the
USB_EPStartXfer() function in the HAL layer (for me, it's the
stm32l4xx_ll_usb.c), ep->maxpacket is set to 0. This causes the divide
by 0 error on this line:

> USBx_INEP(ep->num)->DIEPTSIZ |= (USB_OTG_DIEPTSIZ_PKTCNT & (((ep->xfer_len + ep->maxpacket -1)/ ep->maxpacket) << 19)) ;

I haven't delved further than this, however.

- Pushpal

On Fri, Apr 13, 2018 at 12:56 PM, Pushpal Sidhu <psidhu.devel@...> wrote:
> Hi,
>
> On Tue, Apr 3, 2018 at 8:03 AM, Johannes Hutter <johannes@...> wrote:
>> I got hands on a nucleo-f411re and actually encounter the same issue. I also
>> observed that the callback is set for the endpoints 0x00, 0x80 and 0x81 (the
>> last one being the configured HID endpoint), but the enable function is only
>> called for the first two. Does anyone have an idea what the issue is there?
>>
>>
>> On 29.03.2018 20:53, Yannis Damigos wrote:
>>
>> Hi Joe,
>>
>> I try USB HID sample on my 96b_carbon with ASSERTs enabled and it fails with
>> a different error.
>>
>> ***** USAGE FAULT *****
>>   Executing thread ID (thread): 0x20000938
>>   Faulting instruction address:  0x8001e82
>>   Division by zero
>> Fatal fault in essential thread! Spinning...
>
> Just wanted to add that adding a debugger, I see that in the
> USB_EPStartXfer() function in the HAL layer (for me, it's the
> stm32l4xx_ll_usb.c), ep->maxpacket is set to 0. This causes the divide
> by 0 error on this line:
>> USBx_INEP(ep->num)->DIEPTSIZ |= (USB_OTG_DIEPTSIZ_PKTCNT & (((ep->xfer_len + ep->maxpacket -1)/ ep->maxpacket) << 19)) ;
>
> I haven't delved further than this, however.
>
> - Pushpal
>
>> I added developers mailing list to give greater visibility to the problem.
>>
>> Yannis
>>
>> On 03/29/2018 05:27 PM, Johannes Hutter wrote:
>>
>> Hey Yannis,
>>
>> first of all, thanks for the support on the Zephyr Mailing List the last
>> weeks. I don't want to spam the list too much, that's why I'm writing you
>> directly. If you prefer to keep the questions on the mailing list, I am
>> happy to do that.
>>
>>
>> Now my question: The USB HID configuration works perfectly fine (I basically
>> simulate a keyboard). But if I enable ASSERTs my program (and also the USB
>> HID sample) fails during boot with following log:
>>
>>
>> [general] [DBG] HAL_PCD_ResetCallback:
>> [usb/hid] [DBG] hid_status_cb: USB device reset detected
>> [general] [DBG] HAL_PCD_SetupStageCallback:
>> [general] [DBG] usb_handle_control_transfer: usb_handle_control_transfer ep
>> 0, status 0
>> [general] [DBG] usb_dc_ep_read_wait: ep 0x00, 8 bytes, 0+8, 0x20009bb4
>> [general] [DBG] usb_handle_request: ** 0 **
>> [usb/hid] [DBG] hid_custom_handle_req: Standard request: bRequest 0x6
>> bmRequestType 0x80 len 64
>> [general] [DBG] usb_handle_std_device_req: REQ_GET_DESCRIPTOR
>> [general] [DBG] usb_dc_ep_write: ep 0x80, len 18
>> [general] [DBG] usb_dc_ep_transfer: ep 0x80, len=18, in=1, sync=no
>> ASSERTION FAIL [!_IsInIsr()] @
>> /home/joe/code/proglove/embed/mark_one_s_firmware/lib/zephyr/kernel/sched.c:328:
>>
>>
>> Would you be so kind and try to run the sample on your boards with ASSERTs
>> enabled? Just to find out whether the problem is on my custom board side or
>> not.
>>
>> Thanks a lot and best regards,
>>
>> Joe
>>
>>
>> --
>>
>> Johannes Hutter | Embedded Software Engineer
>> Mail: johannes@... <mailto:johannes@...>
>>
>>
>>
>>
>> Workaround GmbH (ProGlove)
>> Friedenstr. 4 | 81671 München
>>
>> Managing Director: Thomas Kirchner
>> HRB: 216605 | AG München
>> USt.-IdNr.: DE298859320
>>
>>
>> --
>>
>> Johannes Hutter | Embedded Software Engineer
>> Mail: johannes@...
>>
>>
>> Workaround GmbH (ProGlove)
>> Friedenstr. 4 | 81671 München
>>
>> Managing Director: Thomas Kirchner
>> HRB: 216605 | AG München
>> USt.-IdNr.: DE298859320
>>
>>
>> _______________________________________________
>> Zephyr-devel mailing list
>> Zephyr-devel@...ct.org
>> https://lists.zephyrproject.org/mailman/listinfo/zephyr-devel
>>

On Fri, Apr 13, 2018 at 12:56 PM, Pushpal Sidhu <psidhu.devel@...> wrote:
> Hi,
>
> On Tue, Apr 3, 2018 at 8:03 AM, Johannes Hutter <johannes@...> wrote:
>> I got hands on a nucleo-f411re and actually encounter the same issue. I also
>> observed that the callback is set for the endpoints 0x00, 0x80 and 0x81 (the
>> last one being the configured HID endpoint), but the enable function is only
>> called for the first two. Does anyone have an idea what the issue is there?
>>
>>
>> On 29.03.2018 20:53, Yannis Damigos wrote:
>>
>> Hi Joe,
>>
>> I try USB HID sample on my 96b_carbon with ASSERTs enabled and it fails with
>> a different error.
>>
>> ***** USAGE FAULT *****
>>   Executing thread ID (thread): 0x20000938
>>   Faulting instruction address:  0x8001e82
>>   Division by zero
>> Fatal fault in essential thread! Spinning...
>
> Just wanted to add that adding a debugger, I see that in the
> USB_EPStartXfer() function in the HAL layer (for me, it's the
> stm32l4xx_ll_usb.c), ep->maxpacket is set to 0. This causes the divide
> by 0 error on this line:
>> USBx_INEP(ep->num)->DIEPTSIZ |= (USB_OTG_DIEPTSIZ_PKTCNT & (((ep->xfer_len + ep->maxpacket -1)/ ep->maxpacket) << 19)) ;
>
> I haven't delved further than this, however.
>
> - Pushpal
>
>> I added developers mailing list to give greater visibility to the problem.
>>
>> Yannis
>>
>> On 03/29/2018 05:27 PM, Johannes Hutter wrote:
>>
>> Hey Yannis,
>>
>> first of all, thanks for the support on the Zephyr Mailing List the last
>> weeks. I don't want to spam the list too much, that's why I'm writing you
>> directly. If you prefer to keep the questions on the mailing list, I am
>> happy to do that.
>>
>>
>> Now my question: The USB HID configuration works perfectly fine (I basically
>> simulate a keyboard). But if I enable ASSERTs my program (and also the USB
>> HID sample) fails during boot with following log:
>>
>>
>> [general] [DBG] HAL_PCD_ResetCallback:
>> [usb/hid] [DBG] hid_status_cb: USB device reset detected
>> [general] [DBG] HAL_PCD_SetupStageCallback:
>> [general] [DBG] usb_handle_control_transfer: usb_handle_control_transfer ep
>> 0, status 0
>> [general] [DBG] usb_dc_ep_read_wait: ep 0x00, 8 bytes, 0+8, 0x20009bb4
>> [general] [DBG] usb_handle_request: ** 0 **
>> [usb/hid] [DBG] hid_custom_handle_req: Standard request: bRequest 0x6
>> bmRequestType 0x80 len 64
>> [general] [DBG] usb_handle_std_device_req: REQ_GET_DESCRIPTOR
>> [general] [DBG] usb_dc_ep_write: ep 0x80, len 18
>> [general] [DBG] usb_dc_ep_transfer: ep 0x80, len=18, in=1, sync=no
>> ASSERTION FAIL [!_IsInIsr()] @
>> /home/joe/code/proglove/embed/mark_one_s_firmware/lib/zephyr/kernel/sched.c:328:
>>
>>
>> Would you be so kind and try to run the sample on your boards with ASSERTs
>> enabled? Just to find out whether the problem is on my custom board side or
>> not.
>>
>> Thanks a lot and best regards,
>>
>> Joe
>>
>>
>> --
>>
>> Johannes Hutter | Embedded Software Engineer
>> Mail: johannes@... <mailto:johannes@...>
>>
>>
>>
>>
>> Workaround GmbH (ProGlove)
>> Friedenstr. 4 | 81671 München
>>
>> Managing Director: Thomas Kirchner
>> HRB: 216605 | AG München
>> USt.-IdNr.: DE298859320
>>
>>
>> --
>>
>> Johannes Hutter | Embedded Software Engineer
>> Mail: johannes@...
>>
>>
>> Workaround GmbH (ProGlove)
>> Friedenstr. 4 | 81671 München
>>
>> Managing Director: Thomas Kirchner
>> HRB: 216605 | AG München
>> USt.-IdNr.: DE298859320
>>
>>
>> _______________________________________________
>> Zephyr-devel mailing list
>> Zephyr-devel@...ct.org
>> https://lists.zephyrproject.org/mailman/listinfo/zephyr-devel
>>