Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stm32f303 - irq conflict between CAN and USB #22343

Closed
ghost opened this issue Jan 30, 2020 · 0 comments · Fixed by #22373
Closed

stm32f303 - irq conflict between CAN and USB #22343

ghost opened this issue Jan 30, 2020 · 0 comments · Fixed by #22373
Assignees
Labels
bug The issue is a bug, or the PR is fixing a bug platform: STM32 ST Micro STM32 priority: low Low impact/importance bug

Comments

@ghost
Copy link

ghost commented Jan 30, 2020

I'm porting zephyr over to a custom board based on a stm32f303rc.
I'm trying to use both of CAN and USB.
If you enable both and build you get an error (see later).

Looking at STM32 datasheet - ( en.DM00043574.pdf) at page 286 you can see that both position 19 and 20 are shared between USB and CAN but footnote 1 says

It is possible to remap the USB interrupts (USB_HP, USB_LP and USB_WKUP) on interrupt lines 74, 75 and 76
respectively by setting the USB_IT_RMP bit in the Section 12.1.1: SYSCFG configuration register 1 (SYSCFG_CFGR1) on
page 245.

The error

FAILED: zephyr/isr_tables.c
cd /home/giellamo/projects/swhard/hcb/build/zephyr && /opt/toolchains/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-objcopy --input-target=elf32-littlearm --output-target=binary
--only-section=.intList /home/giellamo/projects/swhard/hcb/build/zephyr/zephyr_prebuilt.elf isrList.bin && /usr/bin/python3 /home/giellamo/projects/zephyrproject/zephyr/arch/com
mon/gen_isr_tables.py --output-source isr_tables.c --kernel /home/giellamo/projects/swhard/hcb/build/zephyr/zephyr_prebuilt.elf --intlist isrList.bin --sw-isr-table --vector-ta
ble
gen_isr_tables.py: multiple registrations at table_index 20 for irq 20 (0x14)
Has IRQ_CONNECT or IRQ_DIRECT_CONNECT accidentally been invoked on the same irq multiple times?
Traceback (most recent call last):
File "/home/giellamo/projects/zephyrproject/zephyr/arch/common/gen_isr_tables.py", line 316, in
main()
File "/home/giellamo/projects/zephyrproject/zephyr/arch/common/gen_isr_tables.py", line 307, in main
+ "\nHas IRQ_CONNECT or IRQ_DIRECT_CONNECT accidentally been invoked on the same irq multiple times?"
File "/home/giellamo/projects/zephyrproject/zephyr/arch/common/gen_isr_tables.py", line 36, in error
raise Exception()
Exception
ninja: build stopped: subcommand failed.

To Reproduce
Steps to reproduce the behavior:

  1. mkdir build; cd build
  2. west build -t menuconfig -> enable both USB and CAN
  3. west build -b hcb -- -DBOARD_ROOT=/home/giellamo/projects/swhard/hcb
  4. make
  5. See error

Expected behavior
It should be possibile to relocate interrupts

Impact
Severe cause I need both of the peripherals

Environment (please complete the following information):

  • OS: Linux
  • Toolchain Zephyr SDK
  • Commit SHA: 05ced0e
@ghost ghost added the bug The issue is a bug, or the PR is fixing a bug label Jan 30, 2020
@alexanderwachter alexanderwachter added Enhancement Changes/Updates/Additions to existing features platform: STM32 ST Micro STM32 labels Jan 30, 2020
erwango added a commit to erwango/zephyr that referenced this issue Jan 31, 2020
On stm32f302/3 series, USB and CAN_1 share same IRQ lines.
To use USB and CAN_1 together, USB IRQ could be remap to other
line numbers, on which there is no conflict.
Remap the USB IRQ lines by default:
-Assign remap number in matching dtsi files
-Perform remap in usb driver init

Additionally, fix compilation issue in usb driver.

Fixes zephyrproject-rtos#22343

Signed-off-by: Erwan Gouriou <[email protected]>
@jhedberg jhedberg removed the bug The issue is a bug, or the PR is fixing a bug label Feb 4, 2020
erwango added a commit to erwango/zephyr that referenced this issue Feb 11, 2020
On stm32f302/3 series, USB and CAN_1 share same IRQ lines.
To use USB and CAN_1 together, USB IRQ could be remap to other
line numbers, on which there is no conflict.
Remap the USB IRQ lines by default:
-Assign remap number in matching dtsi files
-Perform remap before usb driver init

Additionally, fix compilation issue in usb driver.

Fixes zephyrproject-rtos#22343

Signed-off-by: Erwan Gouriou <[email protected]>
Signed-off-by: Yannis Damigos <[email protected]>
Signed-off-by: Erwan Gouriou <[email protected]>
@erwango erwango added bug The issue is a bug, or the PR is fixing a bug has-pr and removed Enhancement Changes/Updates/Additions to existing features labels Feb 11, 2020
@jhedberg jhedberg added the priority: low Low impact/importance bug label Feb 11, 2020
jhedberg pushed a commit that referenced this issue Feb 18, 2020
On stm32f302/3 series, USB and CAN_1 share same IRQ lines.
To use USB and CAN_1 together, USB IRQ could be remap to other
line numbers, on which there is no conflict.
Remap the USB IRQ lines by default:
-Assign remap number in matching dtsi files
-Perform remap before usb driver init

Additionally, fix compilation issue in usb driver.

Fixes #22343

Signed-off-by: Erwan Gouriou <[email protected]>
Signed-off-by: Yannis Damigos <[email protected]>
Signed-off-by: Erwan Gouriou <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue is a bug, or the PR is fixing a bug platform: STM32 ST Micro STM32 priority: low Low impact/importance bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants