Tool/software:
Hi everyone,
I'm designing an OEM airflow meter based on the EVM430-FR6043. The firmware works and measures just fine, but I've discovered that it always takes around 400ms to start up, which is a fairly long time for a "simple" sensor. Using some debug pin outputs and a scope, I was able to nail it to the `USS_initAlgorithms()` function, which is executed right before my code starts and takes most of this initialization time.
Given that it only takes the configuration structure and is named initAlgorithms(), I'd assume that it really only precalculates some values, which could certainly be cached in the FRAM to get this delay only during the very first power-on of the MCU after it has been programmed. The `_USS_SW_Library_configuration_` structure indeed already contains a `validationKey` field and is located in persistent memory (FRAM), so it looks like the library was designed with this in mind.
What I tried is to run the initialization function only once when there is no valid key and skip the initialization in all subsequent boots:
if (gUssSWConfig.validationKey != CONFIG_VALIDATION_KEY) { code = USS_initAlgorithms(&gUssSWConfig); checkCode(code, USS_message_code_no_error); gUssSWConfig.validationKey = CONFIG_VALIDATION_KEY; }
This succeeds in skipping the initialization (and the delay) in every but the first boot, but it also breaks the application. As soon as `USS_runAlgorithms()` is called in this case, the MCU crashes and restarts.
I've already checked the __no_init memory buffers using the debugger before and after the run of `USS_initAlgorithms()` to check if it initializes some data there, but did not discover a change.
So my questions:
- What does `USS_initAlgorithms()` do that takes so long?
- What data does it modify that is not persisted in FRAM?
- Is there a way to get rid of this delay using the described caching approach or anything else?
Thanks!
Best regards,
Philipp