-
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
Fix STM32 CAN reset to not lose context #4932
Conversation
@0xc0170 Thanks for the heads up. Looking into it. |
@0xc0170 The RaaS had become unresponsive. Moved to a different instance and builds are running again. I restarted the affected jobs. |
@@ -137,8 +137,9 @@ struct pwmout_s { | |||
}; | |||
|
|||
struct can_s { |
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.
Hello Laurent,
Could you add #if DEVICE_CAN (in case of future STM32F2 device that does not support CAN) ?
Hello Laurent, Don't you want to commit the modified MBED_A28 test ? Kind regards |
Thanks @adustm
This makes the test a different one. So that would mean adding a new test in the unsupported folder. |
retest uvisor |
Does this require more work then ? |
@adbridge The PR does fix the reported bug, so I think it is ready for merge |
/morph test |
@0xc0170 thx ! |
Result: SUCCESSYour command has finished executing! Here's what you wrote!
OutputAll builds and test passed! |
@LMESTM Can you please resolve the conflict caused by one of the integrations yesterday? |
This will ease up further changes to the structure.
Instead of a static object, this will make driver instantiation more robust and allow to re-use init configuration on a need basis. The CANName struct member is actually the CAN registers base address, which is now available in the CanHandle.Instance field, so we don't need CANName anymore.
BTR register has other bits than the ones calculated and set through the can_speed function, so let's take care to only write to the right registers.
In order to apply the same mode in case of reset, we store the current requested mode in the HAL structure. To make storage in a single place, we also change can_monitor to call can_mode function as they actually acting on same registers.
After reset the MCR register content needs to be restored so we're introducing the can_registers_init function to be called at the first init stage, but also after reset. We also store the can frequency to go through the initialisation phase again.
In case of F2 devices without CAN support.
@0xc0170 rebased now |
Ping @0xc0170, CI is successfull, I think you can merge :) |
/morph test |
Result: SUCCESSYour command has finished executing! Here's what you wrote!
OutputAll builds and test passed! |
Description
This pull request is a FIX to #4396
Resolves #4396
Up to now, can_reset for STM32 was not restoring the registers state as they were before reset,
which seems to be expected from application side.
Status
READY
Tests
Tessted by adding a call to can_reset() in the for loop of MBED_A28 CAN loopback test