Fix FDCAN interrupt configuration in CO_driver_STM32.c#107
Conversation
|
Does this compile for all series or you just tested H5? If only H5, we must verify compilation is OK for the rest, too. |
|
I can only validate H5. |
|
I am almost 100% sure this won't compile for STM32G0, or older STM32s, so I prefer we don't merge this now. My suggestion, if you agree, is that in the same file, we start the #if-else macro logic to set the flags. #if defined(STM32H5xx)
#define MY_VAR ....
#else
/* Keep legacy for now */
#define MY_VAR 0xFFFFFFFF
#endif |
|
Yes I agree this would be a much better approach. |
|
I have a couple G0 based projects, I may be able to check this later today... |
|
I added the check based on STM32H5xx_HAL_CONF_H which is always defined by stm32h5xx_hal_conf.h. |
|
The macros do exist in stm32g0xx_hal_fdcan.h which means it compiles correctly. |
|
Yes, the G0 and H5 use the same FDCAN configuration, you are right. Same will be with C5, G4, C0 and at least U5. Anyway, the 0xFFFFFFFF was used to simplify the usage. For example STM32H7 uses FDCAN with 32 buffers, therefore in this case we want to get interrupts for all of them. Same here. The HAL driver will correctly select bits in the implementation. Therefore, when I think, do we need to do any update? |
|
@MaJerle as @TheCitrusMan verified one of your doubts is clear. |
|
@MaJerle From stm32h5xx_hal_fdcan.h: If assertion is active this is a problem as IS_FDCAN_TX_LOCATION_LIST wont return true in case of 0xFFFFFFFF |
I have a G4 project also -> confirm that this is also fine. |
|
Thanks for your contribution. I checked your changes on two targets [STM32G0 and STM32F0] and both performed ok. |
|
Well what I added was just fine for me with a STM32H5 target but maybe you should only merge the first commit as in the second I introduced a guard that exclusively works on these targets because of @MaJerle s hint:
|
|
In my view, it is fixing the issue for STM32H5xx and defaults to legacy in other cases, because of #if-else marcos. So I don't see any issue with merging this. But as you mentioned this might not work across all series and might need some modifications. On my setup I could test it on F0 and G0 and it worked fine. |
|
Passing We could do the Finally there are products like L4, F1, F4, that do not have FDCAN but only CAN, but that’s outside this driver. |
|
@MaJerle I think your solution would be the best. |
|
Would it then not make more sense to put it like this... |
|
Not being limited to the family name makes it easier in the future with the compatibility. |
Those are not affected as only FDCAN needs to be taken into account. See the snippet: I still think the solution propposed be @MaJerle would be the best way: Maybe we should rename |
|
Please update the proposal as You mentioned and also I propose to rename Then we merge. |
Fix assertion by using realistic values from stm32h5xx_hal_fdcan.h