nRF52840 Support on MySensors

  • Re: Everything nRF52840

    Just wanting to find out if anyone @d00616 has the nRF52840 fully working with MySensors? I've been able to only get the radio part working, but the peripherals on the board (e.g. Adafruit Bluefruit Sense) don't seem to be exposed/working. I see adafruit have their own bootloader and way of programming this device, but it requires the upload of the softdevice, so we can't use it with Mysensors? Anyone got any workarounds to get it working?

    I created a new section for the nRF52840 in the \AppData\Local\Arduino15\packages\MySensors\hardware\nRF5\0.3.0\boards.txt.

    # MyBoardNRF5 nRF52840
    # Board definition is expected in
    # MyBoard.cpp and MyBoard.h as part
    # of the sketch
    ################################### nRF52840
    # -I{build.path} and -DMYBOARDNRF5 is only required by MyBoardNRF5 -DMYBOARDNRF5 -I{build.path} -mfpu=fpv4-sp-d16 Oscillator Oscillator't enable

    When compiling, it didn't like the reference to 250kbps speed, so I had to comment out references. Using current Dev branch...

    in \AppData\Local\Arduino15\packages\MySensors\hal\transport\NRF5_ESB\driver\Radio.h

    // Radio mode (Data rate)
    typedef enum {
    	NRF5_1MBPS = RADIO_MODE_MODE_Nrf_1Mbit,
    	NRF5_2MBPS = RADIO_MODE_MODE_Nrf_2Mbit,
    	//NRF5_250KBPS = RADIO_MODE_MODE_Nrf_250Kbit, // Deprecated!!!
    } nrf5_mode_e;

    in \AppData\Local\Arduino15\packages\MySensors\hal\transport\NRF5_ESB\driver\Radio_ESB.cpp

    // Calculate time to transmit an byte in µs as bit shift -> 2^X
    static inline uint8_t NRF5_ESB_byte_time()
    	if ((MY_NRF5_ESB_MODE == NRF5_1MBPS) or
    	        (MY_NRF5_ESB_MODE == NRF5_BLE_1MBPS)) {
    		return (3);
    	} else if (MY_NRF5_ESB_MODE == NRF5_2MBPS) {
    		return (2);
    	} //else if (MY_NRF5_ESB_MODE == NRF5_250KBPS) {
    		//return (5);

    I'm wondering if the memory definitions in sandeepmistry\hardware\nRF5\0.7.0\cores\nRF5\SDK\components\toolchain\gcc\nrf52840_xxaa.ld are correct/complete, and if they should be linking to nrf52_common.ld or what changes need made there? The memory map seems more complicated than the nRF52832, and difficult to read across, so I'm not sure if anything needs changed/updated there?

    For the pins, I see the standard MyBoard defintiion is for 32 pins on p0, but I see in the adafruit definitions they reference p1 pins, it seems that p0 covers pins 0 to 31 and p1 continues with references 32-63. To support referencing p1 pins, do we then just need to extend the pin definitions to 64 pins in \AppData\Local\Arduino15\packages\MySensors\hardware\nRF5\0.3.0\variants\MyBoardNRF5\compat_pin_mapping.h and add to the list in MyBoardNRF5.cpp and reference in MyBoard NRF5.h alongside the sketch?

    Would welcome any other insights or steer if anyone has got it working with MySensors?

  • @phil2020 look here:
    You may find that useful.

Log in to reply

Suggested Topics

  • 4
  • 16
  • 7
  • 26
  • 2
  • 2
  • 12
  • 10