Jump to content
43oh

michanisani

Members
  • Content Count

    9
  • Joined

  • Last visited

Reputation Activity

  1. Like
    michanisani got a reaction from oPossum in TM4c1294 - Program over Ethernet   
    1.
    Run program eflash.exe with the following parameters:
    This program downloads a file to a remote device, using the Ethernet Boot Loader.
    Open windows CMD
    eflash -i <IP address>  -m <MAC address>  <file_to_program.bin>
     
    IP address foirmat: XXX.XXX.XXX.XXX
    MAC address format example: 00.1A.B6.03.0F.0C
     
    2.
    Jump in your TM4C1294 board to the boot loader
     
    void UpgradeSoftware(void)     {    uint32_t *Reg_OPA_REG_1;       // Disable all processor interrupts.  Instead of disabling them     // one at a time (and possibly missing an interrupt if new sources     // are added), a direct write to NVIC is done to disable all     // peripheral interrupts.     HWREG(NVIC_DIS0) = 0xffffffff;     HWREG(NVIC_DIS1) = 0xffffffff;     HWREG(NVIC_DIS2) = 0xffffffff;     HWREG(NVIC_DIS3) = 0xffffffff;     HWREG(NVIC_DIS4) = 0xffffffff;       // Also disable the SysTick interrupt.     SysTickIntDisable();     SysTickDisable();         // Return control to the boot loader.  This is a call to the SVC     // handler in the flashed-based boot loader, or to the ROM if configured.       ROM_UpdateEMAC(g_ui32SysClock);       }   3. How to find your board MAC addressUsing LM Flash programmer connected to USB port of CPU card
     
    Or
     
    void read_mac_address()   {     uint32_t ui32User0, ui32User1;     uint8_t pui8MAC[6];       // Get the MAC address from the user registers.     MAP_FlashUserGet(&ui32User0, &ui32User1);     // Convert the 24/24 split MAC address from NV ram into a 32/16 split MAC     // address needed to program the hardware registers, then program the MAC     // address into the Ethernet Controller registers.     pui8MAC[0] = ((ui32User0 >>  0) & 0xff);     pui8MAC[1] = ((ui32User0 >>  8) & 0xff);     pui8MAC[2] = ((ui32User0 >> 16) & 0xff);     pui8MAC[3] = ((ui32User1 >>  0) & 0xff);     pui8MAC[4] = ((ui32User1 >>  8) & 0xff);     pui8MAC[5] = ((ui32User1 >> 16) & 0xff);       sprintf(Str, "MAC address= %02x-%02x-%02x-%02x-%02x-%02x\n",pui8MAC[0],pui8MAC[1],pui8MAC[2],pui8MAC[3],pui8MAC[4],pui8MAC[5]);     UARTprintf(Str);   }    
     
     
    4.
    https://github.com/kroesche/stellaris_eflash
     
     
     

     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     bootp_server.c
    bootp_server.h
    eflash.c
    eflash.h
    SW_update by Enternet.rar
  2. Like
    michanisani got a reaction from atdt in link to simple energia OTA for CC3200   
    https://github.com/michanisani/CC3200-OTA
  3. Like
    michanisani got a reaction from energia in link to simple energia OTA for CC3200   
    https://github.com/michanisani/CC3200-OTA
  4. Like
    michanisani got a reaction from reaper7 in link to simple energia OTA for CC3200   
    https://github.com/michanisani/CC3200-OTA
  5. Like
    michanisani got a reaction from bluehash in link to simple energia OTA for CC3200   
    https://github.com/michanisani/CC3200-OTA
  6. Like
    michanisani got a reaction from Rei Vilo in Current date and time   
    // Part of my project
    // did not compile it, only for expains how to get NTP time
     
    // Do not include SPI for CC3200 LaunchPad //#include <SPI.h> #include <WiFi.h> #include <Wire.h> /*  Udp NTP Client  Get the time from a Network Time Protocol (NTP) time server  Demonstrates use of UDP sendPacket and ReceivePacket  For more on NTP time servers and the messages needed to communicate with them,  see http://en.wikipedia.org/wiki/Network_Time_Protocol   */ void get_NTP_Time(); unsigned int localPort = 2390;      // local port to listen for UDP packets   //1-jan-2015 00:00 #define DEFULT_EPOCH 1420070410   //***************************************************************************** // NTP Server List //***************************************************************************** //! ######################### list of SNTP servers ############################ //! ## //! ##          hostname             |        IP       |       location //! ## ----------------------------------------------------------------------------- //! ##   2.in.pool.ntp.org           | 113.30.137.34   | //! ##   dmz0.la-archdiocese.net     | 209.151.225.100 |   Los Angeles, CA //! ##   ntp.inode.at                | 195.58.160.5    |   Vienna //! ##   ntp3.proserve.nl            | 212.204.198.85  |   Amsterdam //! ##   ntp.spadhausen.com          | 109.168.118.249 |   Milano - Italy //! ##   Optimussupreme.64bitVPS.com | 216.128.88.62   |   Brooklyn, New York //! ##   ntp.mazzanet.id.au          | 203.206.205.83  |   Regional Victoria, Australia //! ##   a.ntp.br                    | 200.160.0.8     |   Sao Paulo, Brazil //IPAddress timeServer(132, 163, 4, 101); // time-a.timefreq.bldrdoc.gov NTP server // IPAddress timeServer(132, 163, 4, 102); // time-b.timefreq.bldrdoc.gov NTP server // IPAddress timeServer(132, 163, 4, 103); // time-c.timefreq.bldrdoc.gov NTP server //! ################################################################### IPAddress timeServer(129,6,15,30);  // time-c.nist.gov  NIST, Gaithersburg, Maryland IPAddress timeServer2(132, 163, 4, 101); // IPAddress timeServer3(24,56,178,140); // wwv.nist.gov IPAddress timeServer4(131,107,13,100); // time-nw.nist.gov IPAddress timeServer5(132,163,4,103); // time-c.timefreq.bldrdoc.gov NTP server   const int NTP_PACKET_SIZE = 48; // NTP time stamp is in the first 48 bytes of the message byte packetBuffer[ NTP_PACKET_SIZE]; //buffer to hold incoming and outgoing packets // A UDP instance to let us send and receive packets over UDP WiFiUDP Udp;   int status = WL_IDLE_STATUS; int SERVER_PORT = 80; const unsigned long CISRAEL_SUMMER =  (3 * 60 * 60); const unsigned long CISRAEL_WINTER =  (2 * 60 * 60); const unsigned long DIFF_SUMMER_WINTER = (CISRAEL_SUMMER - CISRAEL_WINTER); unsigned long ISRAEL_DAY_LIGHT; const unsigned long seventyYears = 2208988800UL; const unsigned long interval_1Sec  = 1000UL;       // interval at which to update (milliseconds) const unsigned long interval_NTP   = (120*1000);       // interval at which to update (milliseconds) const unsigned int     TWO_HOURS    =  (120 * 60); const unsigned int     ONEP5_HOURS  =  (90  * 60); const unsigned int     ONE_HOURS    =  (60  * 60); const unsigned int     HALF_HOURS   =  (30  * 60); const unsigned int     MIN_45       =  (45  * 60); unsigned long epoch; // NTP time unsigned long on_epoch; unsigned int HOURS; unsigned int MIN; unsigned int SEC;     // get NTP variables unsigned long highWord ; unsigned long lowWord; unsigned long secsSince1900;   //============================================================================= void setup() {   Serial.begin(9600);      // initialize serial communication   epoch=DEFULT_EPOCH; // set to defult   Serial.println("\nStarting connection to NTP server...");   Udp.begin(localPort);   get_NTP_Time(); // update EPOC houres , min , sec } //=========================================================================================   //======================================================================================= void loop() {    Update_NTP_Server(); } // end main loop     //=================================================================== // send an NTP request to the time server at the given address unsigned long sendNTPpacket(IPAddress& address) {   // set all bytes in the buffer to 0   memset(packetBuffer, 0, NTP_PACKET_SIZE);   // Initialize values needed to form NTP request   // (see URL above for details on the packets)   packetBuffer[0] = 0b11100011;   // LI, Version, Mode   packetBuffer[1] = 0;     // Stratum, or type of clock   packetBuffer[2] = 6;     // Polling Interval   packetBuffer[3] = 0xEC;  // Peer Clock Precision   // 8 bytes of zero for Root Delay & Root Dispersion   packetBuffer[12]  = 49;   packetBuffer[13]  = 0x4E;   packetBuffer[14]  = 49;   packetBuffer[15]  = 52;     // all NTP fields have been given values, now   // you can send a packet requesting a timestamp:   Udp.beginPacket(address, 123); //NTP requests are to port 123   Udp.write(packetBuffer, NTP_PACKET_SIZE);   Udp.endPacket(); }   //============================ NTP server ===================================== // UPDATE EPOCH VARIABLE void get_NTP_Time() {       digitalWrite(EXT_GREEN_LED, HIGH);       digitalWrite(EXT_BLUE_LED, HIGH);       digitalWrite(EXT_RED_LED, HIGH);         sendNTPpacket(timeServer); // send an NTP packet to a time server       delay(4000);   if ( Udp.parsePacket() )   {     // We've received a packet, read the data from it     Udp.read(packetBuffer, NTP_PACKET_SIZE); // read the packet into the buffer     //the timestamp starts at byte 40 of the received packet and is four bytes,     // or two words, long. First, extract the two words:     highWord = word(packetBuffer[40], packetBuffer[41]);     lowWord = word(packetBuffer[42], packetBuffer[43]);     // combine the four bytes (two words) into a long integer     // this is NTP time (seconds since Jan 1 1900):     secsSince1900 = highWord << 16 | lowWord;     // now convert NTP time into everyday time:     // Unix time starts on Jan 1 1970. In seconds, that's 2208988800:     // subtract seventy years:     epoch = (secsSince1900 - seventyYears) + ISRAEL_DAY_LIGHT; // israel day light 3 hours in second in summer     update_time_variables ();  } // end UDP parsePacket else // 2   {       Serial.print("Try 2'd NTP server\n\r");       sendNTPpacket(timeServer2); // send an NTP packet to a time server       delay(4000);       if ( Udp.parsePacket() )       {        Udp.read(packetBuffer, NTP_PACKET_SIZE); // read the packet into the buffer        highWord = word(packetBuffer[40], packetBuffer[41]);        lowWord = word(packetBuffer[42], packetBuffer[43]);        secsSince1900 = highWord << 16 | lowWord;        epoch = (secsSince1900 - seventyYears) + ISRAEL_DAY_LIGHT; // israel day light 3 hours in second        update_time_variables ();       }       else // 3       {        Serial.print("Try 3'rd NTP server\n\r");        sendNTPpacket(timeServer3); // send an NTP packet to a time server        delay(4000);        if ( Udp.parsePacket() )        {        Udp.read(packetBuffer, NTP_PACKET_SIZE); // read the packet into the buffer        highWord = word(packetBuffer[40], packetBuffer[41]);        lowWord = word(packetBuffer[42], packetBuffer[43]);        secsSince1900 = highWord << 16 | lowWord;        epoch = (secsSince1900 - seventyYears) + ISRAEL_DAY_LIGHT; // israel day light 3 hours in second        update_time_variables ();        }         else         {         Write_log(BOILER_NTP_ERROR);         Serial.print("NTP ERROR\n\r");         }       } // 3 }//2   // restore LEDs       digitalWrite(EXT_GREEN_LED,EXT_GREEN_LED_reg);       digitalWrite(EXT_BLUE_LED,EXT_BLUE_LED_reg);       digitalWrite(EXT_RED_LED,EXT_RED_LED_reg); }     //======================================================================= void update_time_variables () {     HOURS = ((epoch  % 86400L) / 3600);     MIN =  ((epoch  % 3600) / 60);     SEC = (epoch % 60); }     //======================================================================= void Update_NTP_Server() { //--- update time from NTP server every 500 sec   if((currentMillis - previousMillis_500Sec) > interval_NTP) // every 500 sec    {       get_NTP_Time();  // update variibale by NTP server       previousMillis_500Sec = currentMillis;    }   }
×
×
  • Create New...