Skip to content

Fix bug in Nordic SDK 14.2 I2C driver #6721

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 27, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -558,12 +558,10 @@ static ret_code_t twi_tx_start_transfer(twi_control_block_t * p_cb,
p_cb->bytes_transferred = 0;
p_cb->error = false;

// In case TWI is suspended resume its operation.
nrf_twi_task_trigger(p_twi, NRF_TWI_TASK_RESUME);
nrf_twi_task_trigger(p_twi, NRF_TWI_TASK_STARTTX);

(void)twi_send_byte(p_twi, p_data, length, &p_cb->bytes_transferred, no_stop);

/**
* 4/23/2018 Arm Mbed modification to Nordic SDK 14.2.
* Interrupts must be enabled before transmitting the first byte in asynchronous mode.
*/
if (p_cb->handler)
{
p_cb->int_mask = NRF_TWI_INT_STOPPED_MASK |
Expand All @@ -572,7 +570,18 @@ static ret_code_t twi_tx_start_transfer(twi_control_block_t * p_cb,
NRF_TWI_INT_RXDREADY_MASK;
nrf_twi_int_enable(p_twi, p_cb->int_mask);
}
else

// In case TWI is suspended resume its operation.
nrf_twi_task_trigger(p_twi, NRF_TWI_TASK_RESUME);
nrf_twi_task_trigger(p_twi, NRF_TWI_TASK_STARTTX);

(void)twi_send_byte(p_twi, p_data, length, &p_cb->bytes_transferred, no_stop);

/**
* 4/23/2018 Arm Mbed modification to Nordic SDK 14.2.
* Interrupts must be enabled before transmitting the first byte in asynchronous mode.
*/
if (p_cb->handler == NULL)
{
while ((hw_timeout > 0) &&
twi_transfer(p_twi,
Expand Down Expand Up @@ -632,10 +641,11 @@ static ret_code_t twi_rx_start_transfer(twi_control_block_t * p_cb,
{
nrf_twi_shorts_set(p_twi, NRF_TWI_SHORT_BB_SUSPEND_MASK);
}
// In case TWI is suspended resume its operation.
nrf_twi_task_trigger(p_twi, NRF_TWI_TASK_RESUME);
nrf_twi_task_trigger(p_twi, NRF_TWI_TASK_STARTRX);

/**
* 4/23/2018 Arm Mbed modification to Nordic SDK 14.2.
* Interrupts must be enabled before transmitting the first byte in asynchronous mode.
*/
if (p_cb->handler)
{
p_cb->int_mask = NRF_TWI_INT_STOPPED_MASK |
Expand All @@ -644,7 +654,16 @@ static ret_code_t twi_rx_start_transfer(twi_control_block_t * p_cb,
NRF_TWI_INT_RXDREADY_MASK;
nrf_twi_int_enable(p_twi, p_cb->int_mask);
}
else

// In case TWI is suspended resume its operation.
nrf_twi_task_trigger(p_twi, NRF_TWI_TASK_RESUME);
nrf_twi_task_trigger(p_twi, NRF_TWI_TASK_STARTRX);

/**
* 4/23/2018 Arm Mbed modification to Nordic SDK 14.2.
* Interrupts must be enabled before transmitting the first byte in asynchronous mode.
*/
if (p_cb->handler == NULL)
{
while ((hw_timeout > 0) &&
twi_transfer(p_twi,
Expand Down