Closed akaiserUS closed 8 months ago
Hi @akaiserUS! We appreciate you submitting your first issue for our open-source project. š
Even though I'm a bot, I can assure you that the whole community is genuinely grateful for your time and effort. š¤š
@akaiserUS I confirme the issue you found but it is not a STM32 driver issue because even with a frdm_k64f it is a crash.
when you add :
k_sleep(K_SECONDS(1));
usb_disable();
k_sleep(K_SECONDS(1));
usb_enable(NULL);
and complile like that: west build -p always -b frdm_k64f samples/subsys/usb/console/ after the message Hello World! arm is not display on the console
Thank you for confirming that it is cross-platform
@akaiserUS and @jfischer-no
I confirm that with the modifications proposed by jfischer-no ( #63333)
next this solves the problem:
@Desvauxm-st Thank you for letting me know, I will use that locally until I can pull in the change through Zephyr
Describe the bug
System resets due to a divide by zero in in stm32f4xx_II_usb.c at the line:ktcnt = (uint16_t)((ep->xfer_len + ep->maxpacket - 1U) / ep->maxpacket);System resets due to a divide by zero in in modules/hal/stm32/stm32cube/stm32f4xx/drivers/src/stm32f4xx_ll_usb.c at the line pktcnt = (uint16_t)((ep->xfer_len + ep->maxpacket - 1U) / ep->maxpacket);
due to ep->maxpacket being 0. It appears that the reason is due a canceled usb transfer (receive) invoking a callback still. See usb_transfer.c in function usb_transfer_work();
To Reproduce
modify the function to:
Expected behavior
When the usb is enabled and disabled and enabled again, the usb connection should be re-established without causing the system to reset (due to the divide by zero).
Impact Impact is annoyance, currently have a patch that reverts the commit that is causing the issue.
Environment (please complete the following information):
Additional context Reverting commit: 81e4934ebd37a5d134ebd02e689bab622e582ff1 with a patch resolves my issue