-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
dts: stm32f3: Remap USB IRQ to avoid conflict with CAN #22373
dts: stm32f3: Remap USB IRQ to avoid conflict with CAN #22373
Conversation
@giellamoswhard can you test and confirm this helps you enabling CAN_1 and USB at the same time? |
@erwang I've tried you pull request: now it builds without errors but I have runtime troubles: when I run it USB is not recognized anymore by linux.
|
dts/arm/st/f3/stm32f302.dtsi
Outdated
@@ -8,6 +8,11 @@ | |||
|
|||
/ { | |||
soc { | |||
usb: usb@40005c00 { | |||
/* Remap USB_LB IRQ to enable use with CAN_1 */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't it USB_LP?
dts/arm/st/f3/stm32f303.dtsi
Outdated
@@ -8,6 +8,11 @@ | |||
|
|||
/ { | |||
soc { | |||
usb: usb@40005c00 { | |||
/* Remap USB_LB IRQ to enable use with CAN_1 */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't it USB_LP?
@giellamoswhard Thanks for quick feedback.
Do you mean this was working fine previously with USB only? |
@erwango Thank you for the PR. Yes if I build it with master it works (both usb and can)
|
@giellamoswhard ok. It is likely that something is missing in IRQ remap operation. I'll need to test and debug. I don't have hw with me, so it will have to wait next week. |
@erwango Ok, thanks for the support. Don't know if it can be useful but datasheet says that setting USB_IT_RMP all three USB interrupts are remapped (to 74, 75, 76) but new DTS only has a configuration for USB_LP. |
@erwango I tried it on
SYSCFG clock is not enabled. The following patch (I opened a PR in your repository), fixed the USB issue:
Then, I enabled CAN. USB device is not recognized anymore and I don't get an error in logs. I don't have a external CAN bus transceiver to test CAN. |
Ok, I got my mistake. SYSCONFIG is indeed enabled in |
@ydamigos , I'm seeing issue on
And nothing in dmesg. Do you see the same? |
a4edd30
to
d8d41d5
Compare
All checks passed. Tip: The bot edits this comment instead of posting a new one, so you can check the comment's history to see earlier messages. |
d8d41d5
to
7e2c332
Compare
It works fine with master for me. A common mistake I do with |
Yes I did, but this is a fair question :-)! |
@giellamoswhard, @ydamigos can you have a new try ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@erwango Something is wrong with the commits. I see 2 commits with similar message.
drivers/usb/device/usb_dc_stm32.c
Outdated
@@ -303,6 +303,18 @@ static int usb_dc_stm32_init(void) | |||
HAL_StatusTypeDef status; | |||
unsigned int i; | |||
|
|||
#ifdef SYSCFG_CFGR1_USB_IT_RMP |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we move it to usb_dc_attach()
where we do also the pin remapping?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
6f23410
to
3bdbebd
Compare
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]>
3bdbebd
to
b86fba8
Compare
@erwango HI, I'm testing on my custom board (stm32f303rc) with both can and usb configured:
|
@giellamoswhard can you try to boot and then plug/unplug ? |
@erwango |
@erwango It seems something I have something hw broken on the USB side, but my build and can test works. |
@erwango It works now ! Sorry but doing doing the test I deleted the pinmuxes of USB. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test on stm32f3_disco with samples/subsys/usb/cdc_acm
enabling CAN and it works fine.
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 #22343
Signed-off-by: Erwan Gouriou [email protected]