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

spindle_get_caps() hardfault after NVS reset #472

Closed
dresco opened this issue Mar 26, 2024 · 3 comments
Closed

spindle_get_caps() hardfault after NVS reset #472

dresco opened this issue Mar 26, 2024 · 3 comments

Comments

@dresco
Copy link
Contributor

dresco commented Mar 26, 2024

While chasing down a crash, I've noticed spindle_get_caps() being called while n_spindle is set to 0. This only seems to happen after NVS reset, and the call chain is nvs_buffer_init() -> settings_restore() -> spindle_get_caps(). Not sure whether that is expected, or means there is something wrong with my board map etc..?

Anyway, this ends up in the hard fault handler, as idx is decremented from zero before spindles[idx] is referenced, and points at an invalid memory address around 4GB (seems the uint_fast8_t type is actually an unsigned 32 bit integer on STM32 platform).

@dresco
Copy link
Contributor Author

dresco commented Mar 27, 2024

Thanks for the quick fix Terje..

I've noticed that the spindle pins must be configured via AUXOUTPUT ports now (else the PWM timer doesn't get set up and spindle initialisation fails).

Is that the intent going forwards? Just wanting to check before updating my map files..

@terjeio
Copy link
Contributor

terjeio commented Mar 27, 2024

I've noticed that the spindle pins must be configured via AUXOUTPUT port

Yes, it is a change I am making to free up the PWM spindle pin(s) as aux pin(s) when PWM spindle is not configured or only PWM and on/off is output required. The coolant pins will likely be configured in the same way later.

@dresco
Copy link
Contributor Author

dresco commented Mar 27, 2024

Cool, thanks..

@dresco dresco closed this as completed Mar 27, 2024
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

2 participants