Hello All,
I am experiencing strange results when using the TWIM peripheral with and without using the debugger.
Setup:
- Keil IDE for development and debugging - V5.26.2.0
- DK - pca10040 (nRF52832)
- Softdevice - s132 V7.2.0
- SDK - V17.1.0
Scenario:
pca10040 is connected via SCL & SDA to an Arduino which is printing the incoming I2C buffer out onto the Serial Monitor. Running at 400k.
Sending 3 data bytes over I2C line every 2 seconds: 0x04, 0x33, 0x22
Issue:
I have confirmed buffer integrity all the way to the "nrf_twim_task_trigger(p_twim, start_task)" call within the nrfx_twim.c file.
Without placing any break points, I receive this on the Serial Monitor: 0x04 - 0x33 - 0x00 (The "-" is just a delimiter being printed on the Arduino side)
If I place a breakpoint at the conditional check that triggers the TWIM send:
if (!(flags & NRFX_TWIM_FLAG_HOLD_XFER) && (p_xfer_desc->type != NRFX_TWIM_XFER_TXTX))
{
nrf_twim_task_trigger(p_twim, start_task);
}
I can step through the code and the expected 0x04 - 0x33 - 0x22 comes through on the Serial Monitor, every single time.
My question is what is the difference between simply executing the code and stepping through each line, and why would that result in different outcomes on the I2C line? Another important note is that any buffer length less than three bytes comes through correct. Any buffer length greater than or equal to three results in this issue where the 3rd byte of data, and every byte afterwards, is a zero. I am receiving no error codes to indicated a problem.
I have enabled the workaround within the TWIM xfer function (Anomaly 109) as well as attempting some of the other solutions detailed in the Anomaly 109 documentation with no luck.
I've also attempted delays and timers to hold code execution just above the nrf_twim_task_trigger call to simulate the pause that would occur when setting a breakpoint.
If I've missed any important information to help solve the issue, please let me know. Any help is appreciated.
Thank you,
-Cody
