-
Notifications
You must be signed in to change notification settings - Fork 3k
Update of can_api.c fixing #2987 #2988
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
Conversation
LGTM |
Should I fix the typos and make a new pull request? Or should I just keep calm and wait for someone to merge it and fix the typos? |
@bcostm Could you be more specifc on the typos so @martinjaeger can fix them? Thanks! |
It's ok you can merge. |
/morph test |
Result: SUCCESSYour command has finished executing! Here's what you wrote!
Outputmbed Build Number: 960 All builds and test passed! |
sFilterConfig.FilterMaskIdHigh = mask << 5; | ||
sFilterConfig.FilterMaskIdLow = 0x0; // allows both remote and data frames | ||
} | ||
else if(format == CANExtended){ |
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.
Please fix the formatting, look at the other functions, for instance void can_init(can_t *obj, PinName rd, PinName td)
@martinjaeger Can you please sign https://developer.mbed.org/contributor_agreement/ ? |
Just the mentioned example Hope now all typos are fine. If not please explain in a bit more detail what I'm doing wrong. Thanks. Contributor agreement is signed (mbed user martinj). |
@mbed-bot: TEST HOST_OSES=ALL |
[Build 1074] |
@mbed-bot: TEST HOST_OSES=ALL |
[Build 1075] |
Seems that problem is in test infra/framework |
Release mbed OS 5.2.2 and mbed lib v129 Known issues in this release There is currently a DNS resolution failure in Thread mode with this release. This causes a failure in the mbed-os-example-client. This will be fixed in a subsequent release. This can be worked around by reverting to mbed-os-5.2.0 Ports for Upcoming Targets 3011: Add u-blox Sara-N target. ARMmbed#3011 3099: MAX32625 ARMmbed#3099 3151: Add support for FRDM-K82F ARMmbed#3151 3177: New mcu k22512 fixing pr 3136 ARMmbed#3177 Fixes and Changes 2990: [tools] Parallel building of tests ARMmbed#2990 3008: NUCLEO_F072RB: Fix wrong timer channel number on pwm PB_5 pin ARMmbed#3008 3013: STM32xx - Change how the ADC internal pins are checked before pinmap_ ARMmbed#3013 3023: digital_loop tests update for STM32 ARMmbed#3023 3041: [nRF5] - added implementation of API of serial port flow control configuration. ARMmbed#3041 3092: [tools + tests] Adding parallelized build option for iar and uvision exporters ARMmbed#3092 3084: [nrf5] fix in Digital I/O : a gpioe pin was uninitialized badly ARMmbed#3084 3009: TRNG enabled. TRNG APIs implemented. REV A/B/C/D flags removed. Warnings removed ARMmbed#3009 3139: Handle [NOT_SUPPORTED] exception in make.py ARMmbed#3139 3074: Target stm init gcc alignement ARMmbed#3074 3140: [tests] Replacing getchar with RawSerial getc in greentea-client ARMmbed#3140 3158: Added support for 6lowpan PAN ID filter to mbed mesh api configuration ARMmbed#3158 2988: Update of can_api.c fixing ARMmbed#2987 ARMmbed#2988 3175: Updating IAR definition for the NCS36510 for IAR EW v7.8 ARMmbed#3175 3170: [tests] Preventing test from printing before Greentea __sync ARMmbed#3170 3169: [Update of ARMmbed#3014] Usb updates ARMmbed#3169 3143: CFStore fix needed for the Cloud Client ARMmbed#3143 3135: lwip - Fix memory leak in k64f cyclic-buffer overflow ARMmbed#3135 3048: Make update.py test compile examples prior to updating mbed-os version. ARMmbed#3048 3162: lwip/nsapi - Clean up warnings in network code ARMmbed#3162 3161: nsapi - Add better heuristic for the default record of DNS queries ARMmbed#3161 3173: [Exporters] Add a device_name to microbit entry in targets.json ARMmbed#3173 3072: i2c_loop tests update for STM32 ARMmbed#3072 2958: Allowing mbed_app.json files to be discovered for tests. ARMmbed#2958 2969: [nRF52] - switch irq priorities of driver handlers to the lowest level ARMmbed#2969 3078: lwip: Allow several configuration macros to be set externally (bis) ARMmbed#3078 3165: Add address type checks to NanostackInterface ARMmbed#3165 3166: nsapi_dns: Provide 2 IPv6-hosted default servers ARMmbed#3166 3171: [tools] Fixing project.py -S printing problem ARMmbed#3171 3172: [Exporters] New export-build tests ARMmbed#3172 3184: ARMmbed#3183 Compiler warning in trng_api.c with K64F ARMmbed#3184 3185: Update tests to fix build failures. Also make the code similar to oth ARMmbed#3185 3104: [NuMaker] Support CAN and fix PWM CLK error ARMmbed#3104 3182: Exporter documentation ARMmbed#3182 3186: MultiTech mDot - add back SPI3 pins ARMmbed#3186 3187: [Export-Make] Use internal class variable for resolving templates in makefiles ARMmbed#3187 3195: [Exporters - Make-based] Quote the shell call in mkdir and rmdir ARMmbed#3195 3204: [Export build-test] Directory traversal error ARMmbed#3204 3189: [Exporters - Make-based] Force make exporter to search PATH for compilers ARMmbed#3189 3200: Using Popen for uVision and unifying the structure of the build function ARMmbed#3200 3075: nsapi - Add standardized return types for size and errors ARMmbed#3075 3221: u-blox odin w2 drivers update ARMmbed#3221
Hello, So if this is a bug for STM32F0 i think there is also a problem for the other STM32 targets because the bxCAN is the almost the same on every STMF as I know. |
Hi @mgiaco, Are you using CAN on other ST families? If so, can you confirm that your seeing the original issue? |
Hello, no I have not used mbed-os till now. But I will made some tests in the next days with an STM32F4. I will report but first I need a solution for debugging on mbed-os. I tried to export a simple test project with GCC_ARM or with the ST Toolchain everything is broken as i found out. I have no keil toolchain so I have to wait for a fix. After that i will try it. But I report this because I use STM32F4 am STM32F1 bare metal with CAN and the bxCAN is almost the same so the filter mechanism is also the same as you can see in the hal also. |
Sounds good, looking forward to your results! |
Hello, So the RX pins for CAN should be mode input not mode alternate function push pull. I do not test PA_11 but I think that should be also mode input. so go with this const PinMap PinMap_CAN_RD[] = {
{PA_11, CAN_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, 0)},
{PB_8 , CAN_1, STM_PIN_DATA(STM_MODE_INPUT, GPIO_NOPULL, 10)}, // Remap CAN_RX to PB_8
{NC, NC, 0}
}; or this const PinMap PinMap_CAN_RD[] = {
{PA_11, CAN_1, STM_PIN_DATA(STM_MODE_INPUT, GPIO_NOPULL, 0)},
{PB_8 , CAN_1, STM_PIN_DATA(STM_MODE_INPUT, GPIO_NOPULL, 10)}, // Remap CAN_RX to PB_8
{NC, NC, 0}
}; But I can test PA11 in the next days also. I will also made some filter tests later. |
@mgiaco thanks for looking into this, and we look forward to your coming pull request! I believe most stm32F4 boards are already supported by mbed OS, so I don't think you should have any trouble running tests! |
Yes I know, but till now I use the online compiler - there I add a project. Publish it and after that I am able to clone it with mbed-cli. And now I cannot use STM32F4 discovery so I have to modify something by hand I think - I am right? By the way is there any other way go get projects from mbed? Is it possible to use git instead of mercurial? cheers |
If you haven't used any device specific code, you should be able to just recompile the project for the F4 board. Please see the mbed CLI documentation here: https://docs.mbed.com/docs/mbed-os-handbook/en/5.2/getting_started/blinky_cli/ |
I just checked the reference manuals of STM32F0, STM32F1, STM32F2, STM32F3, STM32F4 and STM32F7. All have the same filter configuration, so the bug should be present for all of them. My pull request fixed only STM32F0. Apart from that, I realized that returning the handle in the fixed function can cause some problems, as the handle number could be 0. This would be interpreted as "not successful" according to CAN.h mbed OS 5 API documentation. So this should be fixed aswell and return 1 in case of successfully set filter. (BTW: There seem to be some issues with the doxygen output in above page...) How do we proceed? Should I fix the function for all STM32 versions and make a new pull request or do we need to test it in hardware with all different Nucleo boards? I have only the STM32F072 available. |
What handle do you mean exactly? |
Definitely create a bug report, and if fixed, it should be tested on various platforms if the fix applies to them. ST team that I tagged above might be able to help. |
Hi, @martinjaeger did you start already to modify the can file for other stm32 ? If not I can start to do it. And we can help for sure to test on different stm32 boards. By the way, did you develop a test to check the CAN filter ? If yes can you share it ? Thanks. |
@bcostm That is a great idea. Last week I tried mbed can on a nucleo f103rb after the changes I commented above it works for me. But as you can read in this issue #3505 there is really some stuf which is missing in this api. So maybe with this refactoring also some api issues can be fixed. At work I use this general can api https://github.com/canpie/CANpie for an in house canstack. I also made an example for a stm32f4 discovery board https://github.com/liebherrnenzing/stm32f4_canpie-fd which shows the basic usage of the api. Here https://github.com/liebherrnenzing/canpie-fd_device/blob/bded4dd846454f174104c261ef9534782d089782/stm32/f4/hal/stm32f4xx_canpie-fd.c#L929 you can find the filter implementation which works for me. The nice thing about canpie is that you get the information which buffer send or receive the message. That is what I am missing most in the mbed can implementation. |
@bcostm no, didn't start coding. A single can_api.c sounds like a great idea. I had some very simple test code and an additional separate USB2CAN device to inject and read messages to/from the bus. Code snippet:
|
Ports for Upcoming Targets 3011: Add u-blox Sara-N target. ARMmbed/mbed-os#3011 3099: MAX32625 ARMmbed/mbed-os#3099 3151: Add support for FRDM-K82F ARMmbed/mbed-os#3151 3177: New mcu k22512 fixing pr 3136 ARMmbed/mbed-os#3177 Fixes and Changes 3008: NUCLEO_F072RB: Fix wrong timer channel number on pwm PB_5 pin ARMmbed/mbed-os#3008 3013: STM32xx - Change how the ADC internal pins are checked before pinmap_ ARMmbed/mbed-os#3013 3041: [nRF5] - added implementation of API of serial port flow control configuration. ARMmbed/mbed-os#3041 3084: [nrf5] fix in Digital I/O : a gpioe pin was uninitialized badly ARMmbed/mbed-os#3084 3009: TRNG enabled. TRNG APIs implemented. REV A/B/C/D flags removed. Warnings removed ARMmbed/mbed-os#3009 3074: Target stm init gcc alignement ARMmbed/mbed-os#3074 2988: Update of can_api.c fixing #2987 ARMmbed/mbed-os#2988 3173: [Exporters] Add a device_name to microbit entry in targets.json ARMmbed/mbed-os#3173 2969: [nRF52] - switch irq priorities of driver handlers to the lowest level ARMmbed/mbed-os#2969 3184: #3183 Compiler warning in trng_api.c with K64F ARMmbed/mbed-os#3184 3104: [NuMaker] Support CAN and fix PWM CLK error ARMmbed/mbed-os#3104 3186: MultiTech mDot - add back SPI3 pins ARMmbed/mbed-os#3186 3075: nsapi - Add standardized return types for size and errors ARMmbed/mbed-os#3075 3221: u-blox odin w2 drivers update ARMmbed/mbed-os#3221
Description
Fix issue #2987
Status
Bug fix is completely implemented for STM32F0 and has been tested on STM32F072 Nucleo board.
Migrations
No APIs are changed, but the behavior of the STM32F0 CAN filter API behaves now as it would be expected.
Todos
Deploy notes
No changes in build environment.
Steps to test or reproduce
Try to set a CAN message filter with the previous version and wonder why it filters random message IDs, just not the ones you want to be filtered.