-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
iMXRT: changes to FlexCAN driver support #2929
Conversation
Signed-off-by: Michal Lenc <michallenc@seznam.cz>
…D frames at once Signed-off-by: Michal Lenc <michallenc@seznam.cz>
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.
LGTM.
@michallenc - Please check the order of of operation in the Adding imxrt_initialize(priv) here https://github.com/michallenc/incubator-nuttx/blob/4b65e3647124e935264725d014310a3e9ae4a7cf/arch/arm/src/imxrt/imxrt_flexcan.c#L1941 will fix it |
That´s weird. What configuration are you running? I don´t seem to be getting the same problem:
I can´t test the fix as the problem for some reason doesn´t occur in my board, but if you can fix it and test it then please make the PR. |
@michallenc - It is most likely state related. I was testing on the S32K. (But these drivers are all descendant of the original I wrote for UAVCAN in PX4) But with a CAN bootloader. So from power on the the state is reset in your test case. I will do the PR. |
Doesn´t S32K have different clock settings? In iMXRT the clocks should be set by those two lines https://github.com/michallenc/incubator-nuttx/blob/4b65e3647124e935264725d014310a3e9ae4a7cf/arch/arm/src/imxrt/imxrt_flexcan.c#L1822, which appears before calling imxrt_ifdown();. But if the fix works I think there is no problem to add imxrt_initialize(priv). |
In my case. The state it is that MDIS being set. So the device is in HALT/FRZ and will not to the soft reset. |
Summary
These changes brings some bigger updates to imxrt FlexCAN driver. The biggest one is added capability to run CAN_FD (on CAN3) together with classical CAN (on CAN1 and CAN2). Furthemore, the workaround of chip errata ERR005829 has also been added as well as insurance against mixing packages on RX. The older version also seemed to have problems while the board received message during transmiting (erroframes were generated), this PR seems to addres that.
The configuration for Teensy has been changed to UART as communication over CDC-ACM seems to have several bugs. Configuration for imxrt1060-evk remains the same as this board has CAN2 and CAN3 on same transceiver and therefore it cannot operate both CANs at once.
Impact
While previous version of FlexCAN driver was (more or less) functional, this one should be able to be used in real life production applications (although there still is some work to do).
Testing
The new functions were stress tested on Teensy 4.1. The board was connected on multiple transiveres CAN bus and tested with sending/receiving hundreds/thousands of packages.