Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

UART and Timer conflict

I am using SDK12 with nrf52832.  UART working fine (with FIFO)  and Timer1 also works.

I wanted to set a 1 minute timeout around the UART dialog to handle disconnection etc. 

However, if I enable Timer1 when waiting for a response from the UART the timer responds as expected but the responses from the UART no longer occur.  Specifically, the UART's event handler is no longer called.

This looks like some kind of a conflict but I'm not sure where and why?

Thx.

Parents Reply Children
  • sorry for the delay in replying.  I was away from the lab.  back now but I need to make a much simpler example which does not use special hardware.  Thx to for his which seems to be showing up the same issue.  I will check again to see if anything gets logged.

  • hi, edvin i am also having some issues while merging the uart ,twi and timer , please help me . i am using nrf52382 segger 15version . see my code 

    int main(void)
    
    
    {
    bool erase_bonds;
    
    
    
        // Initialize.
        uart_init();
        log_init();
        timers_init();
        buttons_leds_init(&erase_bonds);
        power_management_init();
        ble_stack_init();
        gap_params_init();
        gatt_init();
        services_init();
        advertising_init();
        conn_params_init();
    
      printf("\r\nUART started.\r\n");
        NRF_LOG_INFO("Debug logging for UART over RTT started.");
        advertising_start();
    
    
         
    
    twi_init();
      LM75B_set_mode();
        
    
    uint32_t time_ms = 50000; //Time(in miliseconds) between consecutive compare events.
        uint32_t time_ticks;
        uint32_t err_code = NRF_SUCCESS;
    
       
                 
    
        //Configure all leds on board.
        bsp_board_init(BSP_INIT_LEDS);
    
        //Configure TIMER_LED for generating simple light effect - leds on board will invert his state one after the other.
        nrf_drv_timer_config_t timer_cfg = NRF_DRV_TIMER_DEFAULT_CONFIG;
       err_code = nrf_drv_timer_init(&TIMER_SENSOR, &timer_cfg, timer_sensor_event_handler);
        APP_ERROR_CHECK(err_code);
    
          nrf_drv_timer_extended_compare(
             &TIMER_SENSOR, NRF_TIMER_CC_CHANNEL0, time_ticks, NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK, true);
    
    
        time_ticks = nrf_drv_timer_ms_to_ticks(&TIMER_SENSOR, time_ms);
    
         NRF_LOG_INFO("SUCCESS1"); 
    
    
    
    
     
    
        // Start execution.
        
        while (true)
        {
            nrf_delay_ms(6000);
    
           while (m_xfer_done == false);
    
             m_xfer_done = false;
                    
    		uint8_t reg[2] = {0x00U};
            err_code = nrf_drv_twi_tx(&m_twi,LM75B_ADDR, reg, sizeof(reg), true);
    		APP_ERROR_CHECK(err_code);
    		while (m_xfer_done == false);
    		nrf_delay_ms(5);
    		
    	        m_xfer_done = false;
    		ret_code_t err_code1 = nrf_drv_twi_rx(&m_twi,LM75B_ADDR, &m_sample, sizeof(m_sample));
    		APP_ERROR_CHECK(err_code1);
                    NRF_LOG_INFO("%d", m_sample);
    
    }
       
     
                   }
    
          
          
                   

  • Hello,

    I would need a better description. I suggest you create a separate ticket describing your issue, if you haven't done this already.

Related