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

Porting nrf52840gmouse_nrf52840 to nRF52810

I want to create mouse&keyboard set based on nRF52810's. Keyboard that will be used is from broken laptop with 24-pin connector. Does nRF52810 have enough pins for that?

I don't need LEDs and USB functionality (only charging, separate IC will be used for that), but 1000Hz sampling rate is interesting. Is it also possible to use higher sample rate? Will I am still be able to use keyboard and mouse with some Android device?

How dongle will find the correct BLE device? I need some application on PC to configure that?

There are some board definitions, but I could not find any kind of reference schematic. Is it available somewhere (i.e. which battery charging, voltage converter and other ICs were used)?

I am also curious if I could use PMW3389 sensor (and will it be enough to just replace all "PMW3360" occurrences with "PMW3389" (and lowercase versions too) and replace firmware for chip).

In general, what I have to do to have working firmware that supports high (>=1000Hz) polling rate, DFU, setting CPI (receive some data and set sensor's register according to it) and DFU (to mouse and keyboard itself) via app on PC (using nRF52840 dongle or some USB Bluetooth 5 dongle)?

I assume that I will have to copy config, replace all "PMW3360" occurrences to "PMW3389", set "CONFIG_USB=n", remove other USB-related lines, set BLE report rate to 1ms (how?), add HID report processing.

Is it enough or something more is required?

For dongle I will only need to add support reporting to mouse about change of CPI and (if possible) firmware upgrade of mouse and keyboard? Or it will be simpler to use USB Bluetooth 5 dongle for second thing?

Is it possible to configure J-link (from nRF5340 DK) to use 1.8V as I want to use only one DC-DC buck converter for both nRF52810 and PMW3389, and to not fry it when programming I will need 1.8V?

Can I also redistribute modified code under another license (i.e. GPLv3 or later)?

  • Hello,

    I want to create mouse&keyboard set based on nRF52810's. Keyboard that will be used is from broken laptop with 24-pin connector. Does nRF52810 have enough pins for that?

    Please see the nRF52810 product specification found in our infocenter.

    If you are new to BLE development, please read our documentation of nRF Connect SDK, and the nRF Desktop application 

    In general, what I have to do to have working firmware that supports high (>=1000Hz) polling rate, DFU, setting CPI (receive some data and set sensor's register according to it) and DFU (to mouse and keyboard itself) via app on PC (using nRF52840 dongle or some USB Bluetooth 5 dongle)?

     The nRF52810 does not support DFU, and 1000Hz is maximum. 

    I assume that I will have to copy config, replace all "PMW3360" occurrences to "PMW3389", set "CONFIG_USB=n", remove other USB-related lines, set BLE report rate to 1ms (how?), add HID report processing.

     To add your own sensor, please see the Sensors API and the Devicetree documentation

     

    Can I also redistribute modified code under another license (i.e. GPLv3 or later)?

     From nrf\LICENSE

    LicenseID:  LicenseRef-Nordic-5-Clause
    
    ExtractedText: <text>
    Copyright (c) 2018, Nordic Semiconductor ASA
    
    All rights reserved.
    
    Redistribution and use in source and binary forms, with or without modification,
    are permitted provided that the following conditions are met:
    
    1. Redistributions of source code must retain the above copyright notice, this
       list of conditions and the following disclaimer.
    
    2. Redistributions in binary form, except as embedded into a Nordic
       Semiconductor ASA integrated circuit in a product or a software update for
       such product, must reproduce the above copyright notice, this list of
       conditions and the following disclaimer in the documentation and/or other
       materials provided with the distribution.
    
    3. Neither the name of Nordic Semiconductor ASA nor the names of its
       contributors may be used to endorse or promote products derived from this
       software without specific prior written permission.
    
    4. This software, with or without modification, must only be used with a
       Nordic Semiconductor ASA integrated circuit.
    
    5. Any software provided in binary form under this license must not be reverse
       engineered, decompiled, modified and/or disassembled.
    
    THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
    OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
    OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
    DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
    LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
    CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
    GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
    OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    </text>
    

    Kind regards,
    Øyvind

  • Thanks for answer.

    I'm looking into PCA20041 schematic. Mouse wheel (mechanical one) has common pin which is connected to pin 30. Can I connect nothing to this pin as I'd like to use magnetic encoder (Allegro A1230)? I see only one problem: nRF52840 is powered from 1.8V and A1230 require 3.3V. Should I use some transistors or simple resistor divider would be enough?

    I'm also experiencing stability problems with nrf24 based wireless mouse. It does not move cursor when USB 3 devices are connected. Will it be the same for LLPM/BLE mode?

  • Hi 

    Øyvind is currently on vacation, and I will help out with your case in the mean time. 

    O11111 said:
    I'm looking into PCA20041 schematic. Mouse wheel (mechanical one) has common pin which is connected to pin 30. Can I connect nothing to this pin as I'd like to use magnetic encoder (Allegro A1230)? I see only one problem: nRF52840 is powered from 1.8V and A1230 require 3.3V. Should I use some transistors or simple resistor divider would be enough?

    If you are using a different encoder that doesn't need the common pin it should be fine to leave this pin unconnected, but keep in mind that you need to change the code running in the nRF52840 to use a different sensor, and to remove any references to pin 30. 

    If the signals from the A1230 are one way signals you might get away with a simple resistor divider, but this has the drawback of added current consumption when the signal is high through the two resistors. 

    Have you considered also running the nRF52840 at 3.3V, so that you don't need any conversion between the devices?

    O11111 said:
    I'm also experiencing stability problems with nrf24 based wireless mouse. It does not move cursor when USB 3 devices are connected. Will it be the same for LLPM/BLE mode?

    Yes, this is an unfortunate side effect of the USB3 standard, since it uses a clock frequency that makes it emit a lot of noise in the 2.4GHz band. There is no good solution for this problem other than try to move the dongle as far away from the USB3 connectors as possible. 
    Ideally it should be enough to use a different port on the machine, or you can use an extender cable. 

    Best regards
    Torbjørn

  • A1230 is quadrature encoder, so the only thing I need should be removal of all pin 30 usages.

    	int err = gpio_pin_configure(gpio_dev,
    				     DT_PROP(DT_NODELABEL(qdec), enable_pin),
    				     GPIO_OUTPUT);
    	if (err) {
    		LOG_ERR("Cannot configure enable pin");
    		return err;
    	}
    
    	err = gpio_pin_set_raw(gpio_dev,
    			       DT_PROP(DT_NODELABEL(qdec), enable_pin), 0);
    	if (err) {
    		LOG_ERR("Failed to set enable pin");
    		return err;
    	}

    (From src/hw_interface/wheel.c, setup_wakeup) And `enable-pin = <30>;` from nrf52840gmouse_nrf52840.dts. Looks like that's all, right?

    Running at 3.3V is a good option, will this affect component values in PCA20041 schematic (it's clear that I'll need to power optical mouse sensor with 1.8V except for it's VDDIO, but not about other parts of schematic)

    Can we use bigger (0603) SMD elements instead of 0201 and 0402 which are really hard to hand solder? Or size actually maters in this case? Do some guidelines exist?

    We're also experiencing some problems with component availability: i.e. AAT3693 became obsolete, DMC2400UV, TSM250N02DCQ RFG, NCP114AMX330TBG are not available. Do some recommended alternatives exist?

  • Hi

    O11111 said:
    (From src/hw_interface/wheel.c, setup_wakeup) And `enable-pin = <30>;` from nrf52840gmouse_nrf52840.dts. Looks like that's all, right?

    That should be sufficient, yes. 

    O11111 said:
    Running at 3.3V is a good option, will this affect component values in PCA20041 schematic (it's clear that I'll need to power optical mouse sensor with 1.8V except for it's VDDIO, but not about other parts of schematic)

    It should be OK to run the rest of the board at 3.3V, without making other changes to the schematic. 

    O11111 said:
    Can we use bigger (0603) SMD elements instead of 0201 and 0402 which are really hard to hand solder? Or size actually maters in this case? Do some guidelines exist?

    It's recommended to not change the size. At least not in the RF section. For the large caps, see this https://infocenter.nordicsemi.com/topic/nwp_030/WP/nwp_030/intro.html
    O11111 said:
    We're also experiencing some problems with component availability: i.e. AAT3693 became obsolete, DMC2400UV, TSM250N02DCQ RFG, NCP114AMX330TBG are not available. Do some recommended alternatives exist?

    The components used on the reference design where chosen based on availability at the time when the design was made. We don't have a list of recommended replacement parts unfortunately. 
    Best regards
    Torbjørn
Related