nRF52840: Errata HAL header defines ignored by HAL drivers

At least one of the errata defines in the HAL headers is ignored by the driver implementing the device.

e.g. the following line claims to control whether the workaround for errata 195 is enabled (Through NRF52_ERRATA_195_ENABLE_WORKAROUND).

https://github.com/zephyrproject-rtos/hal_nordic/blob/2c0fd06a98bb9b89ac234b75b2c217742f0df1ba/nrfx/mdk/nrf52_erratas.h#L9880-L9880

Searching through the nrfx codebase shows that the define is used nowhere else, giving the impression that the errata is not actually being handled.

However dig into the drivers and you find a completely separate set of defines controlling the behaviour (USE_WORKAROUND_FOR_ANOMALY_195):

https://github.com/zephyrproject-rtos/hal_nordic/blob/2c0fd06a98bb9b89ac234b75b2c217742f0df1ba/nrfx/drivers/src/nrfx_spim.c#L146-L146

https://github.com/zephyrproject-rtos/hal_nordic/blob/2c0fd06a98bb9b89ac234b75b2c217742f0df1ba/nrfx/drivers/src/nrfx_spim.c#L731-L736

Based on a quick search in the HAL module, it appears to be a common pattern that `USE_WORKAROUND_FOR_ANOMALY_` is defined and used in the drivers, ignoring any values from the headers.

  • Hi JordanYates,

    Thank you for pointing this out. I did some search over the entire SDK and have these observations:

    The NRF.*_ERRATA_.*_ENABLE_WORKAROUND macros are defined in a header, can be used, and are used in some places outside of the driver module.

    The USE_WORKAROUND_FOR_ANOMALY_.* macros are defined in the nrfx driver source file only and are therefore only used there.

    From that, it's pretty clear the USE_WORKAROUND_FOR_ANOMALY_.* are only meant for internal nrfx driver use.

    As for the NRF.*_ERRATA_.*_ENABLE_WORKAROUND macros, my guess is that it is meant for external uses.

    Hieu

Related