Does ncs 2.5.0 implement the suggested workaround for https://docs.nordicsemi.com/bundle/errata_nRF52840_Rev3/page/ERR/nRF52840/Rev3/latest/anomaly_840_219.html ?
If not, will it be implemeted later?
Does ncs 2.5.0 implement the suggested workaround for https://docs.nordicsemi.com/bundle/errata_nRF52840_Rev3/page/ERR/nRF52840/Rev3/latest/anomaly_840_219.html ?
If not, will it be implemeted later?
So far so good, but will test the external sensor a bit more before concluding.
Sounds good. Let me know if anything out of the ordinary happens.
Kind regards,
Håkon
For ncs, I managed to fix it like this, so that this code runs before main but after driver init:
static int fix_i2c_anomaly(void)
{
const struct device *i2c_dev = DEVICE_DT_GET(DT_NODELABEL(i2c0));
if (i2c_dev)
{
NRF_TWIM_Type *twim = NRF_TWIM0; // Use TWIM instance 0
if (twim->FREQUENCY == NRF_TWIM_FREQ_400K)
{
// Set the I2C frequency to 370 kHz
// https://docs.nordicsemi.com/bundle/errata_nRF52840_Rev3/page/ERR/nRF52840/Rev3/latest/anomaly_840_219.html
twim->FREQUENCY = 0x05EB8000UL;
}
}
return 0;
}
SYS_INIT(fix_i2c_anomaly, APPLICATION, 0);
Hi,
Thanks for updating.
Your code is good for specifically i2c0, but if you use other instances, you also need to remember to update the "twim" pointer.
One option can be to do something like in the driver:
https://github.com/nrfconnect/sdk-zephyr/blob/v3.4.99-ncs1-1/drivers/i2c/i2c_nrfx_twim.c#L226
Then you can access the register similar to this:
https://github.com/nrfconnect/sdk-zephyr/blob/v3.4.99-ncs1-1/drivers/i2c/i2c_nrfx_twim.c#L234
Not strictly needed to this scenario, but just something to consider if you're using other i2c instances.
Kind regards,
Håkon
Thank you
My only comment is that one cannot use nrf_twim_frequency_set as it only accepts enums of type nrf_twim_frequency_t