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

How to raise mouse frequency(or report rate) with nrf51822

It's only 90hz now with my nrf6310 and hid_mouse_app

  • 
    
    /**@brief Function for the Power manager.
     */
    static void power_manage(void)
    {
        uint32_t err_code = sd_app_event_wait();
        APP_ERROR_CHECK(err_code);
    } 
    
    
    /**@brief Function for application main entry.
     */
    int main(void)
    {
        timers_init();
        gpiote_init();
        buttons_init();
    	sensor_init();
        bond_manager_init();
        ble_stack_init();
        scheduler_init();
        gap_params_init();
        advertising_init(BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE);
        services_init();
        sensor_sim_init();
        conn_params_init();
        sec_params_init();
        radio_notification_init();
        
    	//NRF_POWER->TASKS_CONSTLAT = 1; //try to get in to CONSTLAT mode
    
        timers_start();
        advertising_start();
        
        // Enter main loop.
        for (;;)
        {	
    
    		if(button_pressed == true)
    			button_check();		
    
    		mouse_sensor_send();
            app_sched_execute();
            power_manage();
        }
    }
    

    It test that it will report 64 data bag from hid mouse to pc, It should be up to 125/s as USB hid protocol.

  • win7 seems OK . When test my ble mouse (nrf51822, OS: win8.1), the mouse Report Rate can only up to about 110 HZ, ( when browser opened) even if I set the period to 1ms (it should be about 1000 HZ). And if set the sleep time to 8ms (want to make mouse report rate 125HZ like USB mouse), the test result is olny 70HZ.

    
    int main(void)
    {
        timers_init();
        gpiote_init();
        buttons_init();
        sensor_init();
        bond_manager_init();
        ble_stack_init();
        scheduler_init();
        gap_params_init();
        advertising_init(BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE);
        services_init();
        sensor_sim_init();
        conn_params_init();
        sec_params_init();
        radio_notification_init();
        
        timers_start();
        advertising_start();
        
        for (;;)
        {
    		wheel_check();
    		if(button_pressed == true)
    			button_check();
    		
    		mouse_sensor_send();
                    app_sched_execute();
    //              power_manage();
    		nrf_delay_ms(1);
        }
    }
    

    http://img1.ph.126.net/-OR8I5fPb3DQtP8nckOSRQ==/6599296277702865604.jpg

    but USB mouse and other 2.4G mouse can up to 125 HZ (with browser opened)

    http://img2.ph.126.net/8VlQGoBj5nnz4p7dLPTeTA==/6599296277702865608.jpg

    And I test it with logic analyzer when move the mouse

    http://img2.ph.126.net/sPpSibcdeRnh4iU4KFYhbw==/1396397359562108804.jpg

    I found that every 10ms it cost 5ms break:

    http://img2.ph.126.net/y-jdPe67laojC1UzIdVX5A==/6608425522747817891.jpg

    And it is every diffcult between BLE mouse and USB mouse at win8.1 , test by MouseMovementRecorder

    BLE mouse : http://img1.ph.126.net/YdC76bPsGmwFP5dWAWCGvQ==/2876111312129683237.jpg

    USB mouse: http://img2.ph.126.net/izhzoP-ZqZy7maW2m2D2BQ==/865817028462069245.jpg

    Get the test soft in the attachment

    I want to know

    1. Why it wil cost 5ms every 10ms, when I set sleep 1ms in the loop.How can I reduce it?
    2. Why BLE mouse Report Rate is unstable. How can I make stable like USB mouse(125HZ or higher) ?

    Thank you all !

Related