You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2018/03/21 07:22:23 UTC

[GitHub] ncasaril opened a new pull request #940: nrf52xxx_i2c: Fix to allow hal_i2c_clear_bus to read from input-buffer

ncasaril opened a new pull request #940: nrf52xxx_i2c: Fix to allow hal_i2c_clear_bus to read from input-buffer 
URL: https://github.com/apache/mynewt-core/pull/940
 
 
   I'm working on a board on which I read a lot of data from the i2c bus. Resets in the middle of one of these transfers can cause a slave on the bus to hold the sda pin low - i.e. hang the i2c bus. Even though the hal_i2c_init runs the hal_i2c_clear_bus() function at boot, which should be able to clear the i2c bus at startup, the system does not recover from a hanged i2c bus without a power cycle. 
   
   hal_i2c_clear_bus clears the bus by checking if it's held low and outputs clock cycles on scl until the slave lets go. However, because of the weird mode the sda pin was in - output but still with the input_buffer enabled input buffer, the actual value from outside was never read. This because hal_gpio_read(sda_pin) only reads the input buffer if the port-DIR was set to input. 
   
   Not sure this is the cleanest solution, but it corresponds better with what's in the NRF SDK's nrf_drv_twi.c and it works well on my board. 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services