Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Development
  3. Randomness

Randomness

Scheduled Pinned Locked Moved Development
12 Posts 2 Posters 3.4k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • mfalkviddM mfalkvidd

    @d00616 very nice! I can try on a rpi. What do I need to do to test, besides checking out your branch?

    d00616D Offline
    d00616D Offline
    d00616
    Contest Winner
    wrote on last edited by
    #3

    @mfalkvidd

    @mfalkvidd said in Randomness:

    @d00616 very nice! I can try on a rpi. What do I need to do to test, besides checking out your branch?

    @mfalkvidd Thank you. Checkout and build should be enough.

    I have measured the performance with this sketch, but this doesn't work on the Raspberry. By removing the "#define MY_HW_HAS_GETRANDOM", you can switch between old an new mode.

    /*
     * The MySensors Arduino library handles the wireless radio link and protocol
     * between your home built sensors/actuators and HA controller of choice.
     * The sensors forms a self healing radio network with optional repeaters. Each
     * repeater and gateway builds a routing tables in EEPROM which keeps track of the
     * network topology allowing messages to be routed to nodes.
     *
     * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
     * Copyright (C) 2013-2015 Sensnology AB
     * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
     *
     * Documentation: http://www.mysensors.org
     * Support Forum: http://forum.mysensors.org
     *
     * This program is free software; you can redistribute it and/or
     * modify it under the terms of the GNU General Public License
     * version 2 as published by the Free Software Foundation.
     *
     *******************************
     */
    #include <stdint.h>
    #include <pins_arduino.h>
    //#define MY_DEBUG
    //#define MY_DEBUG_VERBOSE_SIGNING
    //#define MY_RADIO_NRF24
    //#define MY_RADIO_NRF5_ESB
    #define MY_SIGNING_SOFT
    //#define MY_SIGNING_ATSHA204
    //#define MY_SIGNING_NODE_WHITELISTING {{.nodeId = GATEWAY_ADDRESS,.serial = {0x09,0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01}}}
    #define MY_SIGNING_REQUEST_SIGNATURES
    #ifndef MY_SIGNING_SOFT_RANDOMSEED_PIN
    #define MY_SIGNING_SOFT_RANDOMSEED_PIN 7
    #endif
    #ifndef MY_SIGNING_ATSHA204_PIN
    #define MY_SIGNING_ATSHA204_PIN 17
    #endif
    // Enable serial gateway
    #define MY_GATEWAY_SERIAL
    
    #include <MySensors.h>
    
    void loop() {
     MyMessage data;
     Serial.print("signerAtsha204SoftGetNonce=");
     unsigned long start = micros();
     signerAtsha204SoftGetNonce(data);
     char *c = (char *)data.getCustom();
     Serial.println(micros()-start);
    
      delay(1000);
    }
    
    mfalkviddM 1 Reply Last reply
    0
    • d00616D d00616

      @mfalkvidd

      @mfalkvidd said in Randomness:

      @d00616 very nice! I can try on a rpi. What do I need to do to test, besides checking out your branch?

      @mfalkvidd Thank you. Checkout and build should be enough.

      I have measured the performance with this sketch, but this doesn't work on the Raspberry. By removing the "#define MY_HW_HAS_GETRANDOM", you can switch between old an new mode.

      /*
       * The MySensors Arduino library handles the wireless radio link and protocol
       * between your home built sensors/actuators and HA controller of choice.
       * The sensors forms a self healing radio network with optional repeaters. Each
       * repeater and gateway builds a routing tables in EEPROM which keeps track of the
       * network topology allowing messages to be routed to nodes.
       *
       * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
       * Copyright (C) 2013-2015 Sensnology AB
       * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
       *
       * Documentation: http://www.mysensors.org
       * Support Forum: http://forum.mysensors.org
       *
       * This program is free software; you can redistribute it and/or
       * modify it under the terms of the GNU General Public License
       * version 2 as published by the Free Software Foundation.
       *
       *******************************
       */
      #include <stdint.h>
      #include <pins_arduino.h>
      //#define MY_DEBUG
      //#define MY_DEBUG_VERBOSE_SIGNING
      //#define MY_RADIO_NRF24
      //#define MY_RADIO_NRF5_ESB
      #define MY_SIGNING_SOFT
      //#define MY_SIGNING_ATSHA204
      //#define MY_SIGNING_NODE_WHITELISTING {{.nodeId = GATEWAY_ADDRESS,.serial = {0x09,0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01}}}
      #define MY_SIGNING_REQUEST_SIGNATURES
      #ifndef MY_SIGNING_SOFT_RANDOMSEED_PIN
      #define MY_SIGNING_SOFT_RANDOMSEED_PIN 7
      #endif
      #ifndef MY_SIGNING_ATSHA204_PIN
      #define MY_SIGNING_ATSHA204_PIN 17
      #endif
      // Enable serial gateway
      #define MY_GATEWAY_SERIAL
      
      #include <MySensors.h>
      
      void loop() {
       MyMessage data;
       Serial.print("signerAtsha204SoftGetNonce=");
       unsigned long start = micros();
       signerAtsha204SoftGetNonce(data);
       char *c = (char *)data.getCustom();
       Serial.println(micros()-start);
      
        delay(1000);
      }
      
      mfalkviddM Offline
      mfalkviddM Offline
      mfalkvidd
      Mod
      wrote on last edited by mfalkvidd
      #4

      @d00616 Sorry, seems like I am in over my head here.

      Do I need to run configure? If so, with which parameters? Then, do I run make? I tried this:

      pi@raspberrypi ~/d00616/MySensors $ ./configure --my-gateway=ethernet --my-transport=nrf24 --my-rf24-irq-pin=15 --my-rf24-channel=119
      [SECTION] Detecting target machine.
        [OK] machine detected: SoC=BCM2836, Type=rpi2, CPU=armv7l.
      [SECTION] Detecting SPI driver.
        [OK] SPI driver detected:BCM.
      [SECTION] Detecting init system.
        [OK] init system detected: sysvinit.
      [SECTION] Saving configuration.
      [SECTION] Cleaning previous builds.
      [OK] Finished.
      pi@raspberrypi ~/d00616/MySensors $ make
      gcc -MT build/drivers/Linux/log.o -MMD -MP -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DRPI_TYPE=\"rpi2\" -DMY_RF24_CHANNEL=119 -DMY_RX_MESSAGE_BUFFER_FEATURE -DMY_RF24_IRQ_PIN=15  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/BCM -c drivers/Linux/log.c -o build/drivers/Linux/log.o
      g++ -MT build/drivers/Linux/IPAddress.o -MMD -MP -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DRPI_TYPE=\"rpi2\" -DMY_RF24_CHANNEL=119 -DMY_RX_MESSAGE_BUFFER_FEATURE -DMY_RF24_IRQ_PIN=15  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/BCM -c drivers/Linux/IPAddress.cpp -o build/drivers/Linux/IPAddress.o
      cc1plus: error: bad value (cortex-a7) for -mtune switch
      Makefile:98: recipe for target 'build/drivers/Linux/IPAddress.o' failed
      make: *** [build/drivers/Linux/IPAddress.o] Error 1
      

      Or do I just compile the sketch? If so, how do I do that?

      d00616D 1 Reply Last reply
      0
      • mfalkviddM mfalkvidd

        @d00616 Sorry, seems like I am in over my head here.

        Do I need to run configure? If so, with which parameters? Then, do I run make? I tried this:

        pi@raspberrypi ~/d00616/MySensors $ ./configure --my-gateway=ethernet --my-transport=nrf24 --my-rf24-irq-pin=15 --my-rf24-channel=119
        [SECTION] Detecting target machine.
          [OK] machine detected: SoC=BCM2836, Type=rpi2, CPU=armv7l.
        [SECTION] Detecting SPI driver.
          [OK] SPI driver detected:BCM.
        [SECTION] Detecting init system.
          [OK] init system detected: sysvinit.
        [SECTION] Saving configuration.
        [SECTION] Cleaning previous builds.
        [OK] Finished.
        pi@raspberrypi ~/d00616/MySensors $ make
        gcc -MT build/drivers/Linux/log.o -MMD -MP -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DRPI_TYPE=\"rpi2\" -DMY_RF24_CHANNEL=119 -DMY_RX_MESSAGE_BUFFER_FEATURE -DMY_RF24_IRQ_PIN=15  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/BCM -c drivers/Linux/log.c -o build/drivers/Linux/log.o
        g++ -MT build/drivers/Linux/IPAddress.o -MMD -MP -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DRPI_TYPE=\"rpi2\" -DMY_RF24_CHANNEL=119 -DMY_RX_MESSAGE_BUFFER_FEATURE -DMY_RF24_IRQ_PIN=15  -Ofast -g -Wall -Wextra  -I. -I./core -I./drivers/Linux -I./drivers/BCM -c drivers/Linux/IPAddress.cpp -o build/drivers/Linux/IPAddress.o
        cc1plus: error: bad value (cortex-a7) for -mtune switch
        Makefile:98: recipe for target 'build/drivers/Linux/IPAddress.o' failed
        make: *** [build/drivers/Linux/IPAddress.o] Error 1
        

        Or do I just compile the sketch? If so, how do I do that?

        d00616D Offline
        d00616D Offline
        d00616
        Contest Winner
        wrote on last edited by
        #5

        @mfalkvidd It requires the option "--my-signing=software --my-signing-request-signatures". But i don't know if it is all.

        mfalkviddM 1 Reply Last reply
        0
        • d00616D d00616

          @mfalkvidd It requires the option "--my-signing=software --my-signing-request-signatures". But i don't know if it is all.

          mfalkviddM Offline
          mfalkviddM Offline
          mfalkvidd
          Mod
          wrote on last edited by mfalkvidd
          #6

          Sorry @d00616, seems like compiling is too hard for me. I am not able to get past the IPAddress.o error. I get the same problem when compiling against vanilla MySensors master so it's not your fault ;-)

          d00616D 1 Reply Last reply
          0
          • mfalkviddM mfalkvidd

            Sorry @d00616, seems like compiling is too hard for me. I am not able to get past the IPAddress.o error. I get the same problem when compiling against vanilla MySensors master so it's not your fault ;-)

            d00616D Offline
            d00616D Offline
            d00616
            Contest Winner
            wrote on last edited by
            #7

            @mfalkvidd said in Randomness:

            Sorry @d00616, seems like compiling is too hard for me. I am not able to get past the IPAddress.o error. I get the same problem when compiling against vanilla MySensors master so it's not your fault ;-)

            Thank you.

            mfalkviddM 1 Reply Last reply
            0
            • d00616D d00616

              @mfalkvidd said in Randomness:

              Sorry @d00616, seems like compiling is too hard for me. I am not able to get past the IPAddress.o error. I get the same problem when compiling against vanilla MySensors master so it's not your fault ;-)

              Thank you.

              mfalkviddM Offline
              mfalkviddM Offline
              mfalkvidd
              Mod
              wrote on last edited by mfalkvidd
              #8

              @d00616 I got a bit further by upgrading from gcc 4.6 to gcc 4.7 (and same for g++). Instructions here: http://helloraspberrypi.blogspot.se/2014/06/install-gcc-47-on-raspberry-pi-and-set.html

              Now I can compile MySensors master, but not MySensors development. I'll create a separate thread for this.

              1 Reply Last reply
              0
              • mfalkviddM Offline
                mfalkviddM Offline
                mfalkvidd
                Mod
                wrote on last edited by
                #9

                @d00616 your branch compiles with the following settings on Raspberry Pi, if I revert 4c31e2 (see the other thread)

                ./configure --my-transport=nrf24 --my-gateway=serial --my-serial-is-pty --my-serial-pty=/dev/ttyMySensors2Gateway --spi-driver=BCM --my-signing=software --my-signing-request-signatures
                

                I don't have any signing nodes and I don't know how to run the test sketch though.

                d00616D 2 Replies Last reply
                1
                • mfalkviddM mfalkvidd

                  @d00616 your branch compiles with the following settings on Raspberry Pi, if I revert 4c31e2 (see the other thread)

                  ./configure --my-transport=nrf24 --my-gateway=serial --my-serial-is-pty --my-serial-pty=/dev/ttyMySensors2Gateway --spi-driver=BCM --my-signing=software --my-signing-request-signatures
                  

                  I don't have any signing nodes and I don't know how to run the test sketch though.

                  d00616D Offline
                  d00616D Offline
                  d00616
                  Contest Winner
                  wrote on last edited by
                  #10

                  @mfalkvidd said in Randomness:

                  ./configure --my-transport=nrf24 --my-gateway=serial --my-serial-is-pty --my-serial-pty=/dev/ttyMySensors2Gateway --spi-driver=BCM --my-signing=software --my-signing-request-signatures

                  Thank you.

                  1 Reply Last reply
                  0
                  • mfalkviddM mfalkvidd

                    @d00616 your branch compiles with the following settings on Raspberry Pi, if I revert 4c31e2 (see the other thread)

                    ./configure --my-transport=nrf24 --my-gateway=serial --my-serial-is-pty --my-serial-pty=/dev/ttyMySensors2Gateway --spi-driver=BCM --my-signing=software --my-signing-request-signatures
                    

                    I don't have any signing nodes and I don't know how to run the test sketch though.

                    d00616D Offline
                    d00616D Offline
                    d00616
                    Contest Winner
                    wrote on last edited by
                    #11

                    @mfalkvidd With "./configure --my-transport=nrf24 --my-gateway=serial --my-serial-is-pty --my-serial-pty=/dev/ttyMySensors2Gateway --spi-driver=SPIDEV --my-signing=software --my-signing-request-signatures" I can compile on my x86 machine.

                    Now, I can write some code to check the generated random data.

                    1 Reply Last reply
                    1
                    • d00616D Offline
                      d00616D Offline
                      d00616
                      Contest Winner
                      wrote on last edited by
                      #12

                      I have checked the hwGetentropy() on my x86 Linux. When https://github.com/mysensors/MySensors/pull/830 is merged, I create a new Pull Request.

                      1 Reply Last reply
                      1

                      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                      With your input, this post could be even better 💗

                      Register Login
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      7

                      Online

                      12.1k

                      Users

                      11.2k

                      Topics

                      113.4k

                      Posts


                      Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • MySensors
                      • OpenHardware.io
                      • Categories
                      • Recent
                      • Tags
                      • Popular