This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

My application stopped running properly after I edited the nrf_drv_twi.c file

Hi,

So I was having an error which caused my application to stall in the "do_stop_check" part of the nrf_drv_twi.c file, so I added a bit of code to check if I could figure out the issue. This code caused the stall to happen immediatley instead of it happening after a good amount of time (which was new). So I removed the code I put and now my application is stalling before it even starts the main loop. When I put back the code it goes back to stalling at nrf_drv_twi.c immediately but I can't get it back to what it was before. Please someone help.

Here is the code I added:

// In the top
uint8_t do_stop_check_count = 0;

// At the end of the static bool twi_transfer function before the last statement (return true;)
		if(do_stop_check_count >= 5){
			do_stop_check_count = 0;
			return false;
		} else {
			do_stop_check_count++;
		}

Thank you in advance,

Robert

Parents Reply
  • Can you explain a bit more about the "stall" that you are experiencing? Do you get the NRF_TWI_EVENT_ERROR event that causes the stop_check? Otherwise, this check should only happen at the end of a transfer. As far as I can understand, the code you added will cause a fault after transfer of 5 bytes on every transfer, regardless of any errors or end of the transfer.

    If you made modifications to the file, and it is not working after reverting the changes, I would recommend that you try to copy back the file from the SDK zip-file, to make sure you reverted all changes.

Children
Related