@@ -558,12 +558,10 @@ static ret_code_t twi_tx_start_transfer(twi_control_block_t * p_cb,
558
558
p_cb -> bytes_transferred = 0 ;
559
559
p_cb -> error = false;
560
560
561
- // In case TWI is suspended resume its operation.
562
- nrf_twi_task_trigger (p_twi , NRF_TWI_TASK_RESUME );
563
- nrf_twi_task_trigger (p_twi , NRF_TWI_TASK_STARTTX );
564
-
565
- (void )twi_send_byte (p_twi , p_data , length , & p_cb -> bytes_transferred , no_stop );
566
-
561
+ /**
562
+ * 4/23/2018 Arm Mbed modification to Nordic SDK 14.2.
563
+ * Interrupts must be enabled before transmitting the first byte in asynchronous mode.
564
+ */
567
565
if (p_cb -> handler )
568
566
{
569
567
p_cb -> int_mask = NRF_TWI_INT_STOPPED_MASK |
@@ -572,7 +570,18 @@ static ret_code_t twi_tx_start_transfer(twi_control_block_t * p_cb,
572
570
NRF_TWI_INT_RXDREADY_MASK ;
573
571
nrf_twi_int_enable (p_twi , p_cb -> int_mask );
574
572
}
575
- else
573
+
574
+ // In case TWI is suspended resume its operation.
575
+ nrf_twi_task_trigger (p_twi , NRF_TWI_TASK_RESUME );
576
+ nrf_twi_task_trigger (p_twi , NRF_TWI_TASK_STARTTX );
577
+
578
+ (void )twi_send_byte (p_twi , p_data , length , & p_cb -> bytes_transferred , no_stop );
579
+
580
+ /**
581
+ * 4/23/2018 Arm Mbed modification to Nordic SDK 14.2.
582
+ * Interrupts must be enabled before transmitting the first byte in asynchronous mode.
583
+ */
584
+ if (p_cb -> handler == NULL )
576
585
{
577
586
while ((hw_timeout > 0 ) &&
578
587
twi_transfer (p_twi ,
@@ -632,10 +641,11 @@ static ret_code_t twi_rx_start_transfer(twi_control_block_t * p_cb,
632
641
{
633
642
nrf_twi_shorts_set (p_twi , NRF_TWI_SHORT_BB_SUSPEND_MASK );
634
643
}
635
- // In case TWI is suspended resume its operation.
636
- nrf_twi_task_trigger (p_twi , NRF_TWI_TASK_RESUME );
637
- nrf_twi_task_trigger (p_twi , NRF_TWI_TASK_STARTRX );
638
644
645
+ /**
646
+ * 4/23/2018 Arm Mbed modification to Nordic SDK 14.2.
647
+ * Interrupts must be enabled before transmitting the first byte in asynchronous mode.
648
+ */
639
649
if (p_cb -> handler )
640
650
{
641
651
p_cb -> int_mask = NRF_TWI_INT_STOPPED_MASK |
@@ -644,7 +654,16 @@ static ret_code_t twi_rx_start_transfer(twi_control_block_t * p_cb,
644
654
NRF_TWI_INT_RXDREADY_MASK ;
645
655
nrf_twi_int_enable (p_twi , p_cb -> int_mask );
646
656
}
647
- else
657
+
658
+ // In case TWI is suspended resume its operation.
659
+ nrf_twi_task_trigger (p_twi , NRF_TWI_TASK_RESUME );
660
+ nrf_twi_task_trigger (p_twi , NRF_TWI_TASK_STARTRX );
661
+
662
+ /**
663
+ * 4/23/2018 Arm Mbed modification to Nordic SDK 14.2.
664
+ * Interrupts must be enabled before transmitting the first byte in asynchronous mode.
665
+ */
666
+ if (p_cb -> handler == NULL )
648
667
{
649
668
while ((hw_timeout > 0 ) &&
650
669
twi_transfer (p_twi ,
0 commit comments