Tuesday, November 24, 2015

P2 - ESP8266 DevBoard - CBDB nEXT EVO - Firmware


  Part 2 of the the new ESP8266 nEXT Evolution Board Series


--------------------------------------------------------------------------------------------------------------------------
For any new CBDB orders/requests please feel free to use as usual:
     tech at esp8266-projects.com.

CBDB nEXT Evo bare PCB has also been made available directly at Dirty PCBs, our preferred PCB House for experimenting (**):
 http://dirtypcbs.com/view.php?share=9699&accesskey=91d782fd4a10943fd36ecc371c7ff2cd


(**) - Actually you have there 2 Boards for the price of one, a CBDB nEXT Evo together with a secondary nEXT Extesion Board that brings you a 18Bit ADC (autoscale 0-40V input!), 4x12Bit DAC, Precison Temperature measurement, 8bit I/O port, etc. But more about this one in the next articles.  -------------------------------------------------------------------------------------------------------------------------



First thing to see is how easy is the process to configure and start using CBCB nEXT EVO Board. It will come preconfigured with NodeMCU, so, if LUA is your desired programming language you can just start using it.

   In case of firmware update needed or if you want to change the environment, it is a very easy process, almost similar with the one used for MPSM Board for example.




What we will need:




Uploading  new firmware:


  • connect CBDB nEXT EVO Board with the USB Cable.
  •  Press PROG + RESET Buttons and power up (plug it into PC USB port)
  • Start NodeMCU Flasher. Choose you USB adapter corresponding port
  • Add from Config Menu latest previously downloaded firmware. It must start from 0x0000. Disable anything else. 
  • Go back on Operation tab. Power off your CBDB Module. Press FLASH Button. power ON quick CBDB module. It will be recognised and will start flashing. Give it a second try if necessary.
  •  When finished succesfully A green OK checkmark will appear
  •  Power Off CBDB Module, Remove yellow jumper. Power back ON. Your nEXT EVO Board should be now programmed with the new NodeMCU Firmware.

If you have trouble to keep pressed both PROG and RESET buttons ,you can use a jumper from GPIO to GND as a replacement for PROG button and press just RESET when necessary:








For further programming in LUA, it might be possible to do it directly in your Serial Terminal Program but I will recomend you to use a more dedicated program for that, like ESPlorer or LuaUploader. I will stay with the latest one, for it's great flexibility and simplicity.

   To run a quick test, you can just use the code snippets provided by LuaUploader at start-up. Select the piece of code that you want to run and press "Execute Selection" button.


  • To quick setup your WIFI network :
        -- One time ESP Setup --
        wifi.setmode(wifi.STATION)
         wifi.sta.config ( "YOUR_WIFI_SSID" , "PASSWORD" ) 
         print(wifi.sta.getip())


  • For the Blinky test we will use the onboard LED connected to GPIO2 and run the code from below

                -- Blink using timer alarm --
                timerId = 0 -- we have seven timers! 0..6
                dly = 500 -- milliseconds
                ledPin = 4 -- 4=GPIO2
                gpio.mode(ledPin,gpio.OUTPUT)
               ledState = 0
               tmr.alarm( timerId, dly, 1, function()
                  ledState = 1 - ledState;
                  gpio.write(ledPin, ledState)
               end)









 For all the Arduino IDE lovers:

Arduino IDE first test for direct programming and firmware uploading on the new ESP8266 CBDB nEXT EVO DevBoard.

 Running Blinky LED program on GPIO2:

// the setup function runs once when you press reset or power the board
void setup() {
     // initialize digital pin 2 as an output - GPIO2
     pinMode(4, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
     digitalWrite(2, HIGH);   // turn the LED on (HIGH is the voltage level)
     delay(500);              // wait for a second
     digitalWrite(2, LOW);    // turn the LED off by making the voltage LOW
     delay(500);              // wait for a second
}






If you want to use it without RESET + PROG buttons control, then just solder the back jumpers as in the picture below and No manual reset needed , no buttons to press, just press Upload in Arduino IDE and that's it!







No comments:

Post a Comment