OpenSprinkler Forums OpenSprinkler Unified Firmware [patch] Errata fix to enc28j60.cpp

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #34751

    ianf
    Participant

    Just in case you missed it, there’s been a fix to the Ethercard library recently to correct the fix for the Silicone Errata #12 clarified in revision B7.  The bundled Ethercard library does not have the fix.

    The second patch raises the ‘x’ in the wifi icon by one pixel to avoid shortening the the right bar by one pixel when the network is unavailable.  It’s purely cosmetic and you may have had good reasons for not using the top pixel row.

    I also have a set of patches to eliminate most of the warnings and compile time errors I experienced in my environment if you’re interested.  They’re mostly due to non-constant PROGMEM declarations. I use arduino-1.0.5 and avr-gcc-4.8.3.  The newer avr-gcc generates code that’s a bit smaller.  On my ATMega1284 with Optiboot:

    Binary sketch size: 51,694 bytes (of a 130,048 byte maximum)

    Ian

    [Edit to inline the patches]

    
    --- enc28j60.cpp        2014-11-13 09:30:29.000000000 +0200
    +++ enc28j60.cpp        2014-11-19 11:37:32.000000000 +0200
    @@ -418,10 +418,12 @@
     }
     
     void ENC28J60::packetSend(uint16_t len) {
    -    while (readOp(ENC28J60_READ_CTRL_REG, ECON1) & ECON1_TXRTS)
    +    // see http://forum.mysensors.org/topic/536/
    +    // while (readOp(ENC28J60_READ_CTRL_REG, ECON1) & ECON1_TXRTS)
             if (readRegByte(EIR) & EIR_TXERIF) {
                 writeOp(ENC28J60_BIT_FIELD_SET, ECON1, ECON1_TXRST);
                 writeOp(ENC28J60_BIT_FIELD_CLR, ECON1, ECON1_TXRST);
    +            writeOp(ENC28J60_BIT_FIELD_CLR, EIR, EIR_TXERIF);
             }
         writeReg(EWRPT, TXSTART_INIT);
         writeReg(ETXND, TXSTART_INIT+len);
    
    
    --- OpenSprinklerGen2.cpp       2014-11-13 09:30:29.000000000 +0200
    +++ OpenSprinklerGen2.cpp       2014-11-20 10:51:19.000000000 +0200
    @@ -276,9 +276,9 @@
       // define lcd custom icons
       byte lcd_wifi_char[8] = {
         B00000,
    -    B10100,
    -    B01000,
    -    B10101,
    +    B00000,
    +    B00001,
    +    B00001,
         B00001,
         B00101,
         B00101,
    @@ -314,11 +314,11 @@
         B10000,
         B00000
       };
    -  lcd.createChar(1, lcd_wifi_char);  
    -  lcd_wifi_char[1]=0;
    -  lcd_wifi_char[2]=0;
    -  lcd_wifi_char[3]=1;    
       lcd.createChar(0, lcd_wifi_char);  
    +  lcd_wifi_char[1]=B10100;
    +  lcd_wifi_char[2]=B01000;
    +  lcd_wifi_char[3]=B10101;    
    +  lcd.createChar(1, lcd_wifi_char);  
       lcd.createChar(2, lcd_sd_char);
       lcd.createChar(3, lcd_rain_char);
       lcd.createChar(4, lcd_connect_char);
    
    #34760

    Ray
    Keymaster

    1) Yes I am aware of the recent update on the EtherCard library. The fix has been integrated to the current firmware 2.1.1 code:
    https://github.com/OpenSprinkler/OpenSprinklerGen2/blob/master/enc28j60.cpp
    which will be released soon.

    This explained the few cases I’ve seen before that the controller locks up after some amount of time. The good thing is that the firmware uses a watchdog timer to restart the controller if wdt_reset is not called in the inner loop after a couple of minutes.

    2) Thanks for the change to the icon. I will check it out and integrate it.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

OpenSprinkler Forums OpenSprinkler Unified Firmware [patch] Errata fix to enc28j60.cpp