-
Notifications
You must be signed in to change notification settings - Fork 3k
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
NUCLEO_H743ZI2 CAN-FD Rx Interrupt not triggering but polling via thread works #15144
Comments
@mynameismichael thank you for raising this issue.Please take a look at the following comments: Could you add some more detail to the description? A good description should be at least 25 words. NOTE: If there are fields which are not applicable then please just add 'n/a' or 'None'. This indicates to us that at least all the fields have been considered. |
Hi STM32F7 is using CAN, so is using code from STM32H7 is the first STM32 family with FDCAN, so with code before previous line. |
Indeed, I had glanced over this module, but it would appear now that the master has changed, and I should update mbed-os, perhaps. I think, based on a quick glance of some commit history of that file, that somebody is working on a fix, but I cannot be sure if this includes H7. What is in the file you linked:
What I have:
I will be going through the commit history. It is strange that all IRQ's are enabled. |
Any update on this issue ? I can reproduce the behavior (No CAN Rx Irq) |
Any updates on this? Same problem still with NUCLEO_H743ZI2 |
Hello, Yes we found that it works with the following modification in the diff --git a/targets/TARGET_STM/can_api.c b/targets/TARGET_STM/can_api.c
index e1468abfd8..65b1342204 100644
--- a/targets/TARGET_STM/can_api.c
+++ b/targets/TARGET_STM/can_api.c
@@ -520,17 +520,17 @@ static void can_irq(CANName name, int id)
irq_handler(can_irq_ids[id], IRQ_TX);
}
}
-#ifndef TARGET_STM32G4
- if (__HAL_FDCAN_GET_IT_SOURCE(&CanHandle, FDCAN_IT_RX_BUFFER_NEW_MESSAGE)) {
- if (__HAL_FDCAN_GET_FLAG(&CanHandle, FDCAN_IT_RX_BUFFER_NEW_MESSAGE)) {
- __HAL_FDCAN_CLEAR_FLAG(&CanHandle, FDCAN_IT_RX_BUFFER_NEW_MESSAGE);
+#if defined(TARGET_STM32G4) || defined(TARGET_STM32H7)
+ if (__HAL_FDCAN_GET_IT_SOURCE(&CanHandle, FDCAN_IT_RX_FIFO0_NEW_MESSAGE)) {
+ if (__HAL_FDCAN_GET_FLAG(&CanHandle, FDCAN_IT_RX_FIFO0_NEW_MESSAGE)) {
+ __HAL_FDCAN_CLEAR_FLAG(&CanHandle, FDCAN_IT_RX_FIFO0_NEW_MESSAGE);
irq_handler(can_irq_ids[id], IRQ_RX);
}
}
#else
- if (__HAL_FDCAN_GET_IT_SOURCE(&CanHandle, FDCAN_IT_RX_FIFO0_NEW_MESSAGE)) {
- if (__HAL_FDCAN_GET_FLAG(&CanHandle, FDCAN_IT_RX_FIFO0_NEW_MESSAGE)) {
- __HAL_FDCAN_CLEAR_FLAG(&CanHandle, FDCAN_IT_RX_FIFO0_NEW_MESSAGE);
+ if (__HAL_FDCAN_GET_IT_SOURCE(&CanHandle, FDCAN_IT_RX_BUFFER_NEW_MESSAGE)) {
+ if (__HAL_FDCAN_GET_FLAG(&CanHandle, FDCAN_IT_RX_BUFFER_NEW_MESSAGE)) {
+ __HAL_FDCAN_CLEAR_FLAG(&CanHandle, FDCAN_IT_RX_BUFFER_NEW_MESSAGE);
irq_handler(can_irq_ids[id], IRQ_RX);
}
}
@@ -602,10 +602,10 @@ void can_irq_set(can_t *obj, CanIrqType type, uint32_t enable)
interrupts = FDCAN_IT_TX_COMPLETE;
break;
case IRQ_RX:
-#ifndef TARGET_STM32G4
- interrupts = FDCAN_IT_RX_BUFFER_NEW_MESSAGE;
-#else
+#if defined(TARGET_STM32G4) || defined(TARGET_STM32H7)
interrupts = FDCAN_IT_RX_FIFO0_NEW_MESSAGE;
+#else
+ interrupts = FDCAN_IT_RX_BUFFER_NEW_MESSAGE;
#endif
break;
case IRQ_ERROR:
|
Hi So in current can_irq function, we have:
which is currently equivalent to: So you mean this has to be corrected ? |
Hello @jeromecoutant, The master has been modified since our last message. I don't know how to patch it properly but yes, it seems that when using the STM32H7, the |
Thanks pmancele! After taking the FIFO in use (instead of BUFFER) H7 CAN interrupt started to work. So please fix this in the official mbed release. |
Hi @veppikeppi |
Any update on this issue? After I change all FDCAN_IT_RX_BUFFER_NEW_MESSAGE to FDCAN_IT_RX_FIFO0_NEW_MESSAGE. CAN interrupt works. But it can only receive signal for 4 times. |
Could you please propose a patch? |
|
It looks like what is happening is that the can filters are being configured to load new messages into the FIFO https://github.com/ARMmbed/mbed-os/blob/master/targets/TARGET_STM/can_api.c#L375
Such that messages aren't loaded into the buffer but the RX Fifo so only the
|
Description of defect
STM32H7 / NUCLEO_H743ZI2 CAN-FD rx interrupt is never triggered, despite using same code base as STM32 F7 target, which does trigger. Target has been changed and project setup (i.e. Makefile) to use H7 libraries.
Target(s) affected by this defect ?
STM32H7 variants with CAN-FD.
Toolchain(s) (name and version) displaying this defect ?
GNU MCU Eclipse Windows Build Tools 2.12.1-1
GNU Arm Embedded Toolchain 9 2020 Q2 Update but also 2019 Q4 Major
What version of Mbed-os are you using (tag or sha) ?
mbed-os-6.15.0, but also: 6.10.0 and 6.13.0
What version(s) of tools are you using. List all that apply (E.g. mbed-cli)
mbed-cli (purely for exporting projects, this works fine on F7 variants)
Eclipse IDE (probably not relevant)
OpenOCD for debugging (also probably irrelevant)
How is this defect reproduced ?
I can attempt to light an LED (which otherwise works in standard blinky program) upon CAN message rx interrupt. This does not work. However, when using threads, the CAN rx and constantly polling for a message, we will receive the message, and the LED will light.
The text was updated successfully, but these errors were encountered: