Navigation

    • Register
    • Login
    • Search
    • OpenHardware.io
    • Categories
    • Recent
    • Tags
    • Popular
    1. Home
    2. Didou
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    Didou

    @Didou

    3
    Reputation
    23
    Posts
    83
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    Didou Follow

    Best posts made by Didou

    • NRF5 Hardware module crash after while

      Re: nRF5 action!

      I have build up a few NRF modules, including main supply power, Relais, Heating control by pilot wire, all to fit within a 2 DIN unit module within power panel.

      They all suffer the same issue, after some time could be few hours or even more than a day they do crash on trying sending something

      I have spent nearly a month reading left and right about this in mysensor but did not find ant thread on such issue. I have also tryed either the lastes stable or the dev release without any change. This is propably something evident I dont figure out and thick you help !😀

      I did attach part of the code and part of the debug output when failing

      /*
       * This example sketch shows how you can manage the nRF5 pin mapping as part of your code.
       * You can use the method for any nRF51822 or nRF52832 board or module.
       * 
       * Most components, like UART, SPI, Wire Bus, of the nRF5 series chips don't
       * have a fixed pin mapping. There are some pins with restrictions like analog
       * inputs, NFC or pins near the radio module. Please refer the latest
       * documentation about pin restrictions at http://infocenter.nordicsemi.com 
       * 
       * To use the custom pin mapping you have to do following steps:
       * 
       * 1. Install "arduino-nrf5" like described at
       *    https://github.com/sandeepmistry/arduino-nRF5/
       * 2. Install the "My Sensors nRF5 Boards" with the board manager like
       *    explained at https://github.com/mysensors/ArduinoBoards
       * 3. Copy the files "MyBoardNRF5.cpp" and "MyBoardNRF5.h" from
       *    "MyBoardNRF5" example into your sketch.
       * 4. Modify pin mappings in "MyBoardNRF5.cpp" and "MyBoardNRF5.h" to fit
       *    your requirements.
       * 5. Select "MyBoardNRF5 nrf52832" or "MyBoardNRF5 nrf52822" as your board.
       *    Choose the correct parameters and programmer in the Tools menu.
       */
      
      /* Module DIN 6xPilotes
       *  LED verte Power
       *  LED Rouge état Pilote (6x)
       *    P0.20 -> LED D4 Pilote 1
       *    P0.25 -> LED D8 Pilote 2
       *    P0.19 -> LED D3 Pilote 3
       *    P0.23 -> LED D6 Pilote 4
       *    P0.18 -> LED D2 Pilote 5
       *    P0.24 -> LED D7 Pilote 6
       *  LED Bleu Communication Radio
       *    P0.22 -> LED D5 Comunication
       */
      
      #define MY_DEBUG
      #define MY_SPECIAL_DEBUG
      #define MY_DEBUG_VERBOSE
      #define MY_DEBUG_VERBOSE_NRF5_ESB
      // #define MY_TRANSPORT_SANITY_CHECK
      
      
      #define MY_RADIO_NRF5_ESB
      #define MY_NODE_ID 121
      //#define MY_PASSIVE_NODE
      
      // Inverses the behavior of leds
      #define MY_WITH_LEDS_BLINKING_INVERSE
      
      // Flash leds on rx/tx/err
      // Uncomment to override default HW configurations
      //#define MY_DEFAULT_ERR_LED_PIN 22  // Error led pin
      #define MY_DEFAULT_RX_LED_PIN  22  // Receive led pin
      #define MY_DEFAULT_TX_LED_PIN  22  // Transmit led pin
      
      #define INTER_MESSAGES_WAIT 50
      
      #include <MySensors.h>
      #include <Wire.h>
      #include "Adafruit_MCP23017.h"
      
      #define LED_ON 0
      #define LED_OFF 1
      
      #define LED_PILOTE_1 20 
      #define LED_PILOTE_2 25 
      #define LED_PILOTE_3 19
      #define LED_PILOTE_4 23
      #define LED_PILOTE_5 18
      #define LED_PILOTE_6 24
      
      #define NB_LED_PILOTE 6
      
      const int LEDS_PILOTE[6] = {
        LED_PILOTE_1,
        LED_PILOTE_2,
        LED_PILOTE_3,
        LED_PILOTE_4,
        LED_PILOTE_5,
        LED_PILOTE_6
      };
      
      typedef struct {
         char mode_code;
         int code_A;
         int code_B;
      } modeFilPilote;
      
      const modeFilPilote modesFilPilote[4] = {
        {'O', 0, 1}, // Mode Off
        {'G', 1, 0}, // Mode hors gel
        {'E', 0, 0}, // Mode éco
        {'C', 1, 1}  // Mode confort
      };
      
      typedef struct {
         int childID;
         char *name;
         char lastOrder;
         int pin_A;
         int pin_B;
         bool newState;
      } FilPilote;
      
      FilPilote ListFilPilote[6] = {
        {0, "Pilote1", 'O', 0, 8, true},
        {1, "Pilote2", 'O', 1, 9, true},
        {2, "Pilote3", 'O', 2, 10, true},
        {3, "Pilote4", 'O', 3, 11, true},
        {4, "Pilote5", 'O', 4, 12, true},
        {5, "Pilote6", 'O', 5, 13, true}
      };
      
      #define NB_PILOTE 6
      
      int LedTimer = 0;
      int BatteryTimer = 0;
      
      MyMessage msg_S_HEATER(14,V_STATUS); 
      
      Adafruit_MCP23017 mcp;
      
      //-------------------------------------
      void nRF_Init() {
        NRF_POWER->DCDCEN = 0; // Not reducing the radio current   
        NRF_PWM0  ->ENABLE = 0;
        NRF_PWM1  ->ENABLE = 0;
        NRF_PWM2  ->ENABLE = 0;
        NRF_TWIM1 ->ENABLE = 0;
        NRF_TWIS1 ->ENABLE = 0;
        //NRF_RADIO->TXPOWER = 8;
      }
      
      void disableNfc() {
        NRF_NFCT->TASKS_DISABLE = 1;
        NRF_NVMC->CONFIG = 1;
        NRF_UICR->NFCPINS = 0;
        NRF_NVMC->CONFIG = 0;
      }
      
      void turnOffAdc() {
        if (NRF_SAADC->ENABLE) {
          NRF_SAADC->TASKS_STOP = 1;
          while (NRF_SAADC->EVENTS_STOPPED) {}
          NRF_SAADC->ENABLE = 0;
          while (NRF_SAADC->ENABLE) {}
        }
      }
      
      //void sleepI2C() {
      //  NRF_TWI1->ENABLE=TWI_ENABLE_ENABLE_Disabled << TWI_ENABLE_ENABLE_Pos;  // I2C Begin is then required on resume (sensor.begin();)
      //  *(volatile uint32_t *)0x40004FFC = 0;
      //  *(volatile uint32_t *)0x40004FFC;
      //  *(volatile uint32_t *)0x40004FFC = 1;
      //}
      //---------------------------------------
      
      void preHwInit() 
      { 
        // Configure Leds ports 
        pinMode(22, OUTPUT);  
        
        for (int i = 0; i < NB_LED_PILOTE; i++) {
          pinMode(LEDS_PILOTE[i], OUTPUT); 
          digitalWrite(LEDS_PILOTE[i], LED_OFF); 
        }  
      
        // Test Leds
        for(int i=0; i < NB_LED_PILOTE +1; i++)
        {
          if (i-1>=0)digitalWrite(LEDS_PILOTE[i-1], LED_OFF);
          if (i < NB_LED_PILOTE)digitalWrite(LEDS_PILOTE[i], LED_ON);
          wait(250);
        }  
      }
      
      void before()
      {    
        nRF_Init();
        disableNfc();
        turnOffAdc();       
        wait(200);
      }
      
      void setup() 
      {  
        mcp.begin();      // use default address 0  
      
        // Load Pilot saved states
        for (int i = 0; i < NB_PILOTE; i++) {
          ListFilPilote[i].lastOrder = loadState(ListFilPilote[i].childID);    
        }     
      
        // Set MCP ports
        for (int i = 0; i <= 15; i++) {
          mcp.pinMode(i, OUTPUT);
          mcp.digitalWrite(0, HIGH);
        }
      }
      
      void presentation()
      {
        sendSketchInfo("DIN 6xPILOTES Gite 1", "0.8");
        wait(INTER_MESSAGES_WAIT);  
      
        // Present Pilote
        for (int i = 0; i < NB_PILOTE; i++) 
        {
          present(ListFilPilote[i].childID, S_HEATER, ListFilPilote[i].name);  
          wait(INTER_MESSAGES_WAIT); 
        }  
      }
      
      void loop() 
      {
        /*
         * Off: Half upper                 Led: Off
         * Confort: Nothing                Led: On 
         * Eco: Half upper & lower (Full)  Led: Blinking 50/50
         * Frizing Protect: Half lower     Led: Blinking 10/90
         */
         
        for(int i=0; i < NB_LED_PILOTE; i++)
        {
          switch (ListFilPilote[i].lastOrder)
          {      
            case 'G': // horsgel
             if (LedTimer <9) digitalWrite(LEDS_PILOTE[i], LED_OFF); 
             else digitalWrite(LEDS_PILOTE[i], LED_ON);        
             break;
            case 'E': // Eco
             if (LedTimer < 5) digitalWrite(LEDS_PILOTE[i], LED_ON); 
             else digitalWrite(LEDS_PILOTE[i], LED_OFF); 
             break;
            case 'O': // off
             digitalWrite(LEDS_PILOTE[i], LED_OFF); 
             break;
            case 'C': // Confort
             digitalWrite(LEDS_PILOTE[i], LED_ON); 
             break;
          }       
        }
        LedTimer++;
        if (LedTimer > 9) LedTimer = 0;
        BatteryTimer++;
        if (BatteryTimer > 599)
        {
          BatteryTimer = 0;
          #ifdef MY_DEBUG
            Serial.println("Send Battery Level");      
          #endif
          sendBatteryLevel(100);
          //  sendHeartbeat();
        }
        
        wait(100);
      }
      
      void receive(const MyMessage &message)
      {   
       if (message.type == V_HVAC_FLOW_STATE)
        {
          for(int p=0; p < NB_PILOTE; p++) 
          {
            if (message.sensor == ListFilPilote[p].childID)
            {
              #ifdef MY_DEBUG
                Serial.print("--Incoming change for: ");
                Serial.print(ListFilPilote[p].name);
                Serial.print("  --Command: ");
                Serial.print(message.getString()[0]);
                Serial.println();
              #endif
      
              for(int e=0; e < 4; e++)
              {
                if(message.getString()[0] == modesFilPilote[e].mode_code)
                {
                  // Set new state
                  mcp.digitalWrite(ListFilPilote[p].pin_A, modesFilPilote[e].code_A); 
                  mcp.digitalWrite(ListFilPilote[p].pin_B, modesFilPilote[e].code_B);        
                  
                  // Save state
                  ListFilPilote[p].lastOrder = modesFilPilote[e].mode_code;
                  saveState(ListFilPilote[p].childID, modesFilPilote[e].mode_code); 
      
                  // Send status update
                  send(msg_S_HEATER.setSensor(ListFilPilote[p].childID).set((const char *)(modesFilPilote[e].mode_code)));
                  return;
                }
              }
              // Unknown Order
              #ifdef MY_DEBUG
                Serial.print("--Unknown Order: ");
                Serial.println(message.getString()[0]);
              #endif
            }
            // Wrong Child_ID
            #ifdef MY_DEBUG
                Serial.print("--Wrong ChildID: ");
                Serial.println(message.sensor);
              #endif
          }
        }
      }
      

      and the logs

      05:08:52.392 -> 72652589 NRF5:SND:TO=0,LEN=8,PID=0,NOACK=0
      05:08:52.392 -> 72652596 NRF5:SND:END=1,ACK=1,RTRY=2,RSSI=-45,WAKE=8
      05:08:52.392 -> 72652601 TSF:MSG:SEND,121-121-0-0,s=255,c=3,t=0,pt=1,l=1,sg=0,ft=0,st=OK:100
      05:09:52.387 -> Send Battery Level
      05:09:52.387 -> 72712609 NRF5:SND:TO=0,LEN=8,PID=1,NOACK=0
      05:09:52.387 -> 72712616 NRF5:SND:END=1,ACK=1,RTRY=2,RSSI=-45,WAKE=8
      05:09:52.387 -> 72712621 TSF:MSG:SEND,121-121-0-0,s=255,c=3,t=0,pt=1,l=1,sg=0,ft=0,st=OK:100
      05:10:52.433 -> Send Battery Level
      05:10:52.433 -> 72772629 NRF5:SND:TO=0,LEN=8,PID=2,NOACK=0
      05:10:52.433 -> 72772636 NRF5:SND:END=1,ACK=1,RTRY=2,RSSI=-45,WAKE=8
      05:10:52.433 -> 72772641 TSF:MSG:SEND,121-121-0-0,s=255,c=3,t=0,pt=1,l=1,sg=0,ft=0,st=OK:100
      05:11:52.429 -> Send Battery Level
      05:11:52.429 -> 72832649 NRF5:SND:TO=0,LEN=8,PID=3,NOACK=0
      05:11:52.429 -> 72832656 NRF5:SND:END=1,ACK=1,RTRY=2,RSSI=-45,WAKE=8
      05:11:52.429 -> 72832661 TSF:MSG:SEND,121-121-0-0,s=255,c=3,t=0,pt=1,l=1,sg=0,ft=0,st=OK:100
      05:12:52.459 -> Send Battery Level
      05:12:52.459 -> 72892669 NRF5:SND:TO=0,LEN=8,PID=0,NOACK=0
      05:12:52.459 -> 72892676 NRF5:SND:END=1,ACK=1,RTRY=2,RSSI=-45,WAKE=8
      05:12:52.459 -> 72892681 TSF:MSG:SEND,121-121-0-0,s=255,c=3,t=0,pt=1,l=1,sg=0,ft=0,st=OK:100
      05:13:52.481 -> Send Battery Level
      05:13:52.481 -> 72952689 NRF5:SND:TO=0,LEN=8,PID=1,NOACK=0
      05:13:52.481 -> 72952696 NRF5:SND:END=1,ACK=1,RTRY=2,RSSI=-45,WAKE=8
      05:13:52.481 -> 72952701 TSF:MSG:SEND,121-121-0-0,s=255,c=3,t=0,pt=1,l=1,sg=0,ft=0,st=OK:100
      05:14:52.511 -> Send Battery Level
      05:14:52.511 -> 73012709 NRF5:SND:TO=0,LEN=8,PID=2,NOACK=0
      05:14:52.511 -> 73012716 NRF5:SND:END=1,ACK=1,RTRY=2,RSSI=-45,WAKE=8
      05:14:52.511 -> 73012721 TSF:MSG:SEND,121-121-0-0,s=255,c=3,t=0,pt=1,l=1,sg=0,ft=0,st=OK:100
      05:15:52.484 -> Send Battery Level
      05:15:52.484 -> 73072729 NRF5:SND:TO=0,LEN=8,PID=3,NOACK=0
      
      posted in My Project
      Didou
      Didou
    • RE: NRF5 Hardware module crash after while

      @Didou After a few days of test of your NRF fix, I can say there is a huge improuvement either for USB, AC supply or battery powered nodes, they just do not failed ! this is great. thanks for your efforts improving the mysensor code

      It's a while since the mysensor master has been updated, any ideas when it's goanna happend, it will also be good for others to benefits

      posted in My Project
      Didou
      Didou
    • RE: NRF5 Hardware module crash after while

      @ncollins I'm using NRF52832 Ebyte modules

      posted in My Project
      Didou
      Didou

    Latest posts made by Didou

    • RE: Water in-pipe temperature sensor

      @David-Pizu-Micallef May be using DS18 waterproof one's

      posted in My Project
      Didou
      Didou
    • RE: NRF5 Hardware module crash after while

      @Didou After a few days of test of your NRF fix, I can say there is a huge improuvement either for USB, AC supply or battery powered nodes, they just do not failed ! this is great. thanks for your efforts improving the mysensor code

      It's a while since the mysensor master has been updated, any ideas when it's goanna happend, it will also be good for others to benefits

      posted in My Project
      Didou
      Didou
    • RE: Supply 230V/5V for node ? Mini Pro, NRF24L01, ams1117

      @skywatch Good advise, I was also on the price. There is some time huge price difference in Europ between regular suppliers en Chiness market, especially when you order low quantities, items are expensive and you do incure transportation cots in addition ... So for the time being I do limit that to the things I can't find on chines market !

      But your call is also important, as ensuring safety !

      posted in Troubleshooting
      Didou
      Didou
    • RE: NRF5 Hardware module crash after while

      @ncollins I'm using NRF52832 Ebyte modules

      posted in My Project
      Didou
      Didou
    • RE: NRF5 Hardware module crash after while

      @ncollins OK thanks, I did try that pulling diretly from github, so branch + files (Alpha-1)

      I did upgrade 3 modules and keep many others with previous to have a comparison basis

      Let's cross fingers 🙂

      It is about 12 hours for now, none of the updated one did crash and one for the unpatched did crash. I need to wait at lest 24 to 36 hours to confirm

      posted in My Project
      Didou
      Didou
    • RE: Supply 230V/5V for node ? Mini Pro, NRF24L01, ams1117

      @skywatch on my side I do alway add air gaps to be sure on the module as well on relay or other main supply related components

      posted in Troubleshooting
      Didou
      Didou
    • RE: NRF5 Hardware module crash after while

      @evb You do undertstand it very well, it was also my first understanding and to avoid any issue relating to EMC I did also tried outside the cabinet, not using my own power supply adding extra capacitors and lately power up the CPU module with the NFC on batteries .... In all cases the crash issue is still there !

      I was pretty surprises as there is quiet a lot of different modules been built on openhardwareio and I have seen no report about this issue, so i was conviced the issue was mine !

      posted in My Project
      Didou
      Didou
    • RE: NRF5 Hardware module crash after while

      @ncollins Will try that just have to understand how to just add the fix to the latest stable release

      posted in My Project
      Didou
      Didou
    • RE: Supply 230V/5V for node ? Mini Pro, NRF24L01, ams1117

      @skywatch For me always blue for Neutral and black or red or brown for phase

      posted in Troubleshooting
      Didou
      Didou
    • RE: Supply 230V/5V for node ? Mini Pro, NRF24L01, ams1117

      @skywatch Get them from ali, there are fake one's ? any security issues with tem ? . Some of them are working well till 2 years at least.

      posted in Troubleshooting
      Didou
      Didou