Skip to content
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

Hard fault handler error #66

Open
chrismolony opened this issue Aug 7, 2024 · 3 comments
Open

Hard fault handler error #66

chrismolony opened this issue Aug 7, 2024 · 3 comments

Comments

@chrismolony
Copy link

Hello David
I use the latest firmware to run at F405 , but I found that it occasionally or frequently enters : hard fault error. This error is difficult to locate. Do you have a solution for this part?
And another question, how to use HFI or how to use HFI in low speed and switch to observer in high speed?
When I turn on HFI, the motor can spin, but sometimes it rotated in CW, sometimes CCW, and the current is very high, the motor is very hot. I set hfi type 2, SL_sensor 3 .
The above two questions:
1 : hard fault error, when start motor fast rotation potentiometer or RCPWM , and When put some load .
2: current is very high when use HFI function and the motor is very hot.
Than you .

@Vavat
Copy link
Collaborator

Vavat commented Aug 7, 2024

99% of the time hardfault is caused by uninitialised pointer or an error in pointer maths. I'd guess somewhere in the code the branching of the condition tree bypasses pointer calculations under certain conditions and this causes the error.

@davidmolony
Copy link
Owner

The easiest way to find this is to replicate it with the debugger plugged in under CUBEIDE, and then you can see the chain that led to the hardfault in the left hand debug menu.

This is not something that happens normally, there are a few places it can happen that I have experienced - if you are using different peripherals for communication without them set up totally correctly is one, and there is also possibility that your settings result in divide by zero if you have not initialised variables properly. Another may be that you have implemented field weakening current higher than the allowed current. Again, recreate it on CUBEIDE and look at the function call stack to find what caused it.

The F405 can be run without the RTOS but you would then need to ensure the defaults and parameters are all set as #defines. I think this is acheivable by just putting a while(1) ahead of the RTOS init.

The HFI should swap to observer at higher speeds. I think it is hard coded as being 4V of back EMF. I could parametise this, the intended use case was ebike where the typical battery is 40-80V so it swaps at ~5-10% speed.

The current use during HFI will always be higher, since the current is being injected... the heat may well be due to higher iron losses from the 10kHz AC current injected. If you intend long term operation in the near zero speed region, HFI is probably not a good option regardless of the implementation.... get an encoder...

@Elump
Copy link

Elump commented Aug 26, 2024

I have similar issue with F411 device. I always get hard fault error right on startup. I think, it's caused by find_last_active_header().
Hard_fault_detected

I also tested older version for F411 from mid of 2023, but it shows same issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants